Dear all:

I'm trying to model series of data with autocorrelation. measurements (Con)
are taken on different day (A) and different period (B) in each day. I want
to model the correlation of Con between different day and different Period
and AR(1) is supposed.

Con_ij = mu +  a_i + b_ij + epsilon_ij

If I use A as grouping factor, (different day measurements belong to
different groups),  and no AR1 is assumed for A, I can model a_i as

random = ~1|A

and model b_ij as

corAR1(0.2, ~1|A)

Following is some simulations:

A <- as.factor(rep(c(1,2,3),each=4))
B <- as.factor(rep(c(1,2,3,4),3))
Sig1 <- matrix(c(1,.5,.25,.5,1,.5,.25,.5,1),ncol=3)
require(mnormt)
mran1 <- rmnorm(1,0,Sig1)
Sig2 <-
matrix(c(1,.6,.36,.216,.6,1,.6,.36,.36,.6,1,.6,.216,.36,.6,1),ncol=4)
mran2 <- rmnorm(3,0,Sig2)
Con <- rep(mran1,each=4)+c(t(mran2))+rnorm(12)
pData <- data.frame(A=A,B=B,Con=Con)
pData <- groupedData(Con~ B|A, data=pData)
fm1 <- lme(Con~1,random=~1|A,data=pData)
fm2 <- update(fm1,corr=corAR1(.2,~1|A))

Do I properly group data? I don't knwo how to model between group
correlation with AR1. Thank you very much for any suggestions.

Best Regards,
Bob

	[[alternative HTML version deleted]]


