[R] gamm: problems with corCAR1()
Karel V
karel.viaene at ugent.be
Wed Oct 5 16:21:04 CEST 2011
Dear all,
I’m analyzing this dataset containing biodiversity indices, measured over
time (Week), and at various contaminant concentrations (Treatment). We have
two replicates (Replicate) per treatment.
I’m looking for the effects of time (Week) and contaminant concentration
(Treatment) on diversity indices (e.g. richness).
Initial analysis with GAM models showed temporal autocorrelation of
diversity. So now I’m trying to fit this gamm (gamm1):
gamm1 <- gamm(richness~
s(Week,by=as.numeric(Treatment=="0"),k=6) +
s(Week,by=as.numeric(Treatment=="0.5"),k=6) +
s(Week,by=as.numeric(Treatment=="5"),k=6) +
s(Week,by=as.numeric(Treatment=="15"),k=6) +
s(Week,by=as.numeric(Treatment=="50"),k=6) +
s(Week,by=as.numeric(Treatment=="150"),k=6) +
s(Treatment,k=6,fx=FALSE) + factor(Treatment),
correlation=corCAR1(form=~Week|factor(Treatment),data=indices,family=gaussian)
I seem to be having difficulties with the correlation structure. An initial
error occurred because replicates were taken at the same time:
/Error in Initialize.corCAR1(X[[2L]], ...) :
Covariate must have unique values within groups for corCAR1 objects /
I solved this by selecting one replicate but is there another solution for
this?
Moreover, when analyzing the data of one replicate, I received following
error:
/Error in MEestimate(lmeSt, grps) :
Singularity in backsolve at level 0, block 1
/
I have no idea how to solve this. It seems to be related with the complexity
of the model because no error occurred when running a simpler gamm (gamm2):
gamm2 <- gamm(richness~
s(Week,k=6,fx=FALSE) + factor(Treatment),
correlation=corCAR1(form=~Week|conc.f), data=test,family=gaussian)
Any help would be well appreciated!
With kind regards,
Karel
--
View this message in context: http://r.789695.n4.nabble.com/gamm-problems-with-corCAR1-tp3874669p3874669.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list