Reputation: 101
Does anyone know how to solve the problem with this error:
library(nlme)
gls(Number.of.Fish~Julian.Date+Temperature+Size.Class,na.action=na.omit,data=mydata,correlation=corAR1(form=~Julian.Date))
Error in Initialize.corAR1(X[[1L]], ...) :
covariate must have unique values within groups for "corAR1" objects
Upvotes: 3
Views: 6110
Reputation: 174778
You have two or more samples taken on the same Julian.Date
and you can't have this in an corAR1()
corStruct()
object.
How you solve this will depend upon your sampling design. Are these values from two different sites? If so site
should probably be in the corAR1()
:
corAR1(form ~ Julian.Date | site)
Beyond that, I struggling to envision equally-spaced observations in time with two sample occurring on the same day.
If your response is a count, you might want to think again about using gls()
, using a model for discrete count data instead.
Upvotes: 4