I have finally gotten the chapter drafts of the book, "lme4: Mixed-effects Modeling with R", that I am writing to the point where I think they can be helpful to others. I believe I have properly committed them to the R-forge site but they will not appear for an hour or so. They should be available under http://lme4.R-forge.R-project.org/book/ Chapters 1, 2, 4 and 5 are currently available as are the .R files for those chapters. Chapters 4 and 5 will have material added to them. I don't expect to change chapters 1 and 2 until I get reviewers reports. When pointing out errors, inconsistencies, bad writing, obtuse explanations, etc., please be gentle.
Saturday, February 13, 2010
draft of new mixed models book
I just received this email through the r-sig-mixed-models group, from Douglas Bates:
Tuesday, November 24, 2009
lme - lmer mixed models
Dear Kim,
first of all, please use lmer() from library "lme4", instead of lme. I think that is currently better maintained and developed than the "nlme" library.
The model you suggest is a random regression per individual (obs_nr)?
The syntax would become
library(lme4)
cocon_mixed<-lmer(MiWi~host_spec*ins_spec+(date|obs_nr),data=cocon_nash)
It should work provided there are several observations of MiWi for each level of obs_nr, which seems to be the case given your explanation of the data.
Cheers, Tom
first of all, please use lmer() from library "lme4", instead of lme. I think that is currently better maintained and developed than the "nlme" library.
The model you suggest is a random regression per individual (obs_nr)?
The syntax would become
library(lme4)
cocon_mixed<-lmer(MiWi~host_spec*ins_spec+(date|obs_nr),data=cocon_nash)
It should work provided there are several observations of MiWi for each level of obs_nr, which seems to be the case given your explanation of the data.
Cheers, Tom
Mixed effects models
Hi,
I am currently trying the exercises of Crawley on mixed effects model (ex. 7). I remade the example on page 33/34 and am currently trying tho do this analysis with my own data. I have a response variable (size=MiWi), measured at different dates (date) on the same individual (obs_nr = random variable). Further more I have insects species (ins_spec) and host species (host_spec) as fixed variables. When I run it I get the error message:
cocon_mixed<-lme(fixed=MiWi~host_spec*ins_spec,data=cocon_nash,random=~date|obs_nr) Error in lme.formula(fixed = MiWi ~ host_spec * ins_spec, data = cocon_nash, :
nlminb problem, convergence error code = 1
message = iteration limit reached without convergence (9)
What is going wrong?
Kim
I am currently trying the exercises of Crawley on mixed effects model (ex. 7). I remade the example on page 33/34 and am currently trying tho do this analysis with my own data. I have a response variable (size=MiWi), measured at different dates (date) on the same individual (obs_nr = random variable). Further more I have insects species (ins_spec) and host species (host_spec) as fixed variables. When I run it I get the error message:
cocon_mixed<-lme(fixed=MiWi~host_spec*ins_spec,data=cocon_nash,random=~date|obs_nr) Error in lme.formula(fixed = MiWi ~ host_spec * ins_spec, data = cocon_nash, :
nlminb problem, convergence error code = 1
message = iteration limit reached without convergence (9)
What is going wrong?
Kim
Thursday, November 12, 2009
Course GLM Groningen
Hi,
I just returned from the glm course in Groningen. I will invite all participants to this blog in the coming days. Meanwhile, I already add a link to a page with several simple scripts:
http://tomvandooren.eu/tuto.html
As you will see, these files haven't been updated at all.
If things in them have become obsolete, please let me know.
Cheers, Tom
I just returned from the glm course in Groningen. I will invite all participants to this blog in the coming days. Meanwhile, I already add a link to a page with several simple scripts:
http://tomvandooren.eu/tuto.html
As you will see, these files haven't been updated at all.
If things in them have become obsolete, please let me know.
Cheers, Tom
Saturday, April 07, 2007
random effects
Dear Tom,
my apologies for the long delay between you request and this answer.
First of all, why not include precipitation ("Precip") as a main effect too?
Using libray "nlme" and lme():
Random intercepts per station:
random= ~1|station
Don't forget the vertical bar!
Including random slope:
random= ~Precip|station
or
random= ~1+Precip|station
Make sure that all stations have different names, otherwise you run the risk that stations with identical names at different distances will be considered as a single station.
You could also consider to use the updated library now called "lme4".
Then the random effects are simply included as extra terms in the model statement.
Cheers, Tom
my apologies for the long delay between you request and this answer.
First of all, why not include precipitation ("Precip") as a main effect too?
Using libray "nlme" and lme():
Random intercepts per station:
random= ~1|station
Don't forget the vertical bar!
Including random slope:
random= ~Precip|station
or
random= ~1+Precip|station
Make sure that all stations have different names, otherwise you run the risk that stations with identical names at different distances will be considered as a single station.
You could also consider to use the updated library now called "lme4".
Then the random effects are simply included as extra terms in the model statement.
Cheers, Tom
Subscribe to:
Posts (Atom)