[R-sig-ME] Longitudinal Model
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Wed Nov 19 14:13:50 CET 2014
Dear Leonardo,
Your model seems reasonable in case of many sites and a continuous response. However, 3 levels is too low to get sensible estimates of the random effect variance (see http://glmm.wikidot.com/faq). Furthermore your response seem to be counts, for which the Gaussian distribution in not correct. You 'll need a Poisson or negative binomial distribution. nlme handles only the Gaussian distribution.
I'm afraid that you will have to go for some more complicated tools like the INLA package or JAGS.
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
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-sig-mixed-models-bounces op r-project.org [mailto:r-sig-mixed-models-bounces op r-project.org] Namens Leonardo Bergamini
Verzonden: woensdag 19 november 2014 13:44
Aan: r-sig-mixed-models op r-project.org
Onderwerp: [R-sig-ME] Longitudinal Model
Hi fellows,
I would like some help at adjusting a mixed model as follows:
I have collected data on the abundance of caterpillars (NC) on trees at three sites over 48 monthly samplings. I am interested in understanding how the three environmental variables I have for the region (namely mean temperature (Temp) in that month, total precipitation (R) and mean relative humidity (H)) correlate with the number of caterpillars, and whether this relationship is different at the three sites.
So far I've been thinking about a lme model, in order to include the temporal autocorrelation structure, but I'm not sure how to specify the random effects and the error structure. I also would like to test at which temporal lag (same month, last month or two months earlier) the relationship is stronger.
Example:
## simulating the data
set.seed(1)
df<-data.frame(
Temp=rep(26+sin(seq(0,2*pi,(2*pi+1)/13))+rnorm(48,0,0.3),3),
P=rep(500+100*(1-sin(seq(0,2*pi,(2*pi+1)/13)))+rnorm(48,100,30),3),
H=rep(((2+(1-sin(seq(0,2*pi,(2*pi+1)/13))))/4)+rnorm(48,0,0.05),3),
site=rep(c("A","B","C"),each=48),
NC=round(4*(1-sin(seq(0,2*pi,(2*pi+1)/13)))+rnorm(144,10,4)),
month=rep(1:48,3)
)
## model
library(nlme)
model1<-lme(NC~Temp+P+H,
random=~1|site,correlation=corAR1(form=~month|site),data=df)
Any help on this specific problem or pointings towards introductory literature would be great Thanks,
Leonardo
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models op r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
* * * * * * * * * * * * * D I S C L A I M E R * * * * * * * * * * * * *
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.
More information about the R-sig-mixed-models
mailing list