Thank you for your answer Ben B., it is helpful. 

The post on Fixed vs Random effects is particularly interesting. 


I had in mind to create a fixed interaction, as you propose (time*A). I 
actually wanted to compare it with a random interaction, so to decide on which 
model to go with based on this comparison... 


I would just ask one more thing, if someone is feeling like answering... what's 
the difference between (1 | A:B) and (1 | A/B) ?  I though it was exactly the 
same thing, but the
(1 | A/B) form was used in older versions of the lmer package...?

Regards




________________________________
 De : Ben Bolker <bbol...@gmail.com>
À : r-h...@stat.math.ethz.ch 
Envoyé le : Mardi 13 août 2013 15h55
Objet : Re: [R] Lme4 and syntax of random factors


Robert U <tacsunday <at> yahoo.fr> writes:

> 
> Dear
> R-users,
> 

[snip]

  This question probably belongs on r-sig-mixed-mod...@r-project.org .
Followups there, please.

> Let's say that I have 2 random effects, A (e.g. species, k=2) and B
(e.g. individuals, n=100). I made some research about model syntax,
and I have the understanding that everything at the left side of the
random parameter is about SLOPE and everything at the right
side about intercept :

  You really can't practically fit a random effect to 2 species (see 
http://glmm.wikidot.com/faq#fixed_vs_random

>  + (1 |B)
> would give me an intercept per individual.
  
>  + (1 |A)
> would give me an intercept per species.

  yes

>  + (1 |A:B)
> would give me an intercept per individuals with nested effect (individual
> inside species)

  This would be the same as (1|B) if the individuals are uniquely
identified.  Otherwise you probably want (1|A/B) [except that you
can't really fit a random effect for k=2, as discussed above]

>  I would like to have random slopes per species. So I thought I
> could do something like that :

  Probably not feasible.

>  + (A |B) so to have an intercept per individual and a slope value
> per species. Graphically, I would therefore obtain 100 lines with
> 100 different intercepts and 2 possible slopes (1 per
> species). However, when I extract random parameter values (ranef()),
> I have :

  what variable is your slope with respect to?  Suppose it's time.
Then I would recommend

~ A*time + (1|A:B)

which will fit a (FIXED effect) interaction between species and time
(different slopes and intercepts for each species), and a random
intercept per individual.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to