[Lign251] homoscedastic intra-cluster variation

Roger Levy rlevy at ucsd.edu
Thu Dec 4 13:42:20 PST 2008


Leslie Lee wrote:
> Hi,
> 
> I have a question about 7.5 in the homework.
> 
> I tried to copy your heteroscdastic BUGS model, removed the sigma_y stuff,
> and created a shared sigma instead. But the model won't run, and I get the
> following error:
> 
> Error in jags.model("sui_tone.bug") : RUNTIME ERROR:
> Dimension mismatch in subset expression of variable y
> 
> I then tried to build the model based on the one you used for the Peterson
> and Barney instead. In the Peterson and Barney file, there were 76
> speakers, and each speaker had 2 tokens. So you did this in R:
> 
> M = 76
> N = 2
> y = aa$F2
> dim(y) <- c(N,M)
> y = t(y)
> 
> However, the number of tokens for each speaker in the sui_tone1 file is
> not constant. How do I deal with this?

Hi Leslie,

Good question!  Take a careful look at page 140 of the lecture notes.
The critical part of the BUGS model is this:

for(i in 1:length(y)) {
y[i] ~ dnorm(mu + b[speaker[i]] + o * origin[i] + mn * migrated.north[i]
+ ms*migrated.south[i], tau[speaker[i]])
}

Notice that the contribution of the b's to the mean for the i'th
observation is written as

  b[speaker[i]]

If speaker is a numeric vector ranging from 1 to the number of speakers,
where the i-th entry is the number indexing which speaker produced the
i-th observation, then this will work properly.

Roger





-- 

Roger Levy                      Email: rlevy at ling.ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy



More information about the Lign251 mailing list