Dear
R-users,

I’ve been
looking at the lmer function (lme4 package) in order to set up a mixed linear 
model
and something about the syntax of the random effects eludes me. I’d like a 
hand
with understanding a specific point, if someone does master this function… 


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 : 


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


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

… + (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 :

·         First
column is the intercept : varying values per line (individuals), so OK

·         2nd and 3rd column are Species 1 and 2: I have different 
across
individuals (without obvious pattern: I do not have similar values for 
individual
of the same species), which is not what I was expecting (1 value per species : 
the
slope parameter). 


Is the
mistake I’m doing (or in my understanding of lme4) obvious to somebody? 


With
regards
        [[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