Dear Luciano,
The "1" in (1|NestID) indicates only a random intercept. Note that in
most models in R, a "1" on the righthandside of the formula indicates
the intercept, "-1" or "0" indicates no intercept. ~X, which
is
equivalent to ~X + 1, indicates a slope along X and an intercept. Hence
a random slope and intercept is write as (X|NestID). If you only want
the random slope then write (X + 0|Nest).
Note that (X|NestID) implies that the random slope and the random
intercept can be correlated. If you need them to be independent you will
have to write (X + 0|NestID) + (1|NestID).
HTH,
Thierry
PS Next time try to send questions about lmer to the R-sig-mixed-models
mailinglist.
------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
Thierry.Onkelinx op inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org]
Namens Luciano La Sala
Verzonden: woensdag 17 december 2008 15:47
Aan: r help
Onderwerp: [R] Model building using lmer
Dear R-experts,
Quite new to R on this end, but learning fast (I hope).
I am running version 2.7.1 on Windows Vista. I have small dataset
which consists of:
# NestID: nest indicator for each chicken. Siblings sharing the same
nest have the same nest indicator.
# Chick: chick indicator consisting of a unique ID for each single
chick.
# Year: 1, 2.
# ClutchSize: 1-, 2- , 3-eggs.
# HO: hatching order within each clutch (1, 2, 3 [first, second and
third-hatched chick]).
# SibComp: sibling competence: present/ absent (0, 1)
# Death2: death at two days post-hatch (0, 1)
# Death10: death at ten days post-hatch (0, 1)
So a subset of my dataset looks something like this:
NestID Chick Year ClutchSize HO Hatching SibComp Death2 Death10
1 1 1 1 1 1 1 1 1
2 2 1 1 1 1 1 0 0
3 3 1 1 1 0 0 0 0
4 4 1 1 1 1 0 1 0
4 5 1 2 2 0 1 0 1
5 6 1 2 1 1 0 0 0
5 7 1 2 2 0 0 0 0
6 8 2 3 1 1 1 0 0
6 9 2 3 2 1 0 1 0
6 10 2 3 3 0 1 0 0
7 11 2 3 1 0 0 0 1
7 11 2 3 2 0 0 0 0
7 11 2 3 3 1 1 1 1
............
In order to account for lack of independence at the nest level (many
chicks are siblings), I'd like to run a GLMM with random slopes and
intercepts for nests.
Using lmer, my model for survival at 10 days, for example, would read as
follows (or not!):
> model <- lmer(Death10 ~ HO + ClutchSize + SibComp + Year + (1|NestID),
family=binomial, 1)
> summary(model)
>From what I understand, the model above includes only random intercepts
for NestID. So at this point my question is how do I make this model
into one which includes both random intercepts and slopes for NestID?
Look forward to receiving your input. Thank you all for your time!
Luciano
______________________________________________
R-help op 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.
Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in this message
and any annex are purely those of the writer and may not be regarded as stating
an official position of INBO, as long as the message is not confirmed by a duly
signed document.