Here is the SAS proc mixed model procedure. I wonder how I can fit the same model in R with separate within-subject variance/covariance matrices for each treatment arm.
proc mixed data=cRMData method=reml;
class time subj; model y=time2 arm arm*time2/ddfm=kenwardroger solution;
repeated time/subject=subj type=un group=arm rcorr;
I tried this in R but it does not give me different covariance matrices
mixed.model<-gls(y~time2+arm:time2,data=cRM, correlation=corSymm(form = ~ 1 | subj), weights=varIdent(form=~1|arm), method="REML")