0
$\begingroup$

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;

run;

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")
$\endgroup$
0
$\begingroup$

you may or may not be aware of this blog which compares SAS and R code for specific purposes. I searched the site for 'mixed' and it seems to provide the answer to your Q(?), "Example 2014.3: Allow different variances by group": http://sas-and-r.blogspot.ca/search?q=mixed

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.