On Mon, Jan 14 2008, Jonathan Berant wrote:

> So the items are nested in a fixed factor called 'cond' (with 3
> ordered levels).  I am not sure what is the syntax for fitting such a
> model
>
> the dependent variable is 'expScore' and the predictors are 'sex'
> (between subject factor with 2 levels), 'relig' (between subject
> factor with 2 levels) and 'cond' (within subject factor with 3 levels
> within which the items are nested)
>
> I tried doing:
> lmerA = lmer(expScore~(relig+sex+cond)^2+(1|subjId) + (1|itemId),
> data=religData)
>
> So how do I specify that items is a random factor nested in a fixed
> factor?

Jonathan--

The correct answer partly depends on what variance structure you want to
fit for the random effects.  You can try the following variations to get
an idea of the different ways of dealing with nested effects within
lmer:

--8<---------------cut here---------------start------------->8---
lmerB = lmer(expScore ~ (relig+sex+cond)^2 +
                        (1 | subjId) +
                        (1 | cond / itemId),
             data=religData)

lmerC = lmer(expScore ~ (relig+sex+cond)^2 +
                        (1 | subjId) +
                        (1 | cond : itemId),
             data=religData)

lmerD = lmer(expScore ~ (relig+sex+cond)^2 +
                        (1 | subjId) +
                        (1 | cond) + 
                        (1 | cond : itemId),
             data=religData)             
--8<---------------cut here---------------end--------------->8---

HTH,
/au

-- 
Austin Frank
http://aufrank.net
GPG Public Key (D7398C2F): http://aufrank.net/personal.asc

Attachment: pgpdzQCoKvtyX.pgp
Description: PGP signature

_______________________________________________
R-lang mailing list
[email protected]
http://pidgin.ucsd.edu/mailman/listinfo/r-lang

Reply via email to