[R-sig-ME] (no subject)

Ben Bolker bbolker at gmail.com
Wed Jun 1 21:49:56 CEST 2011


On 06/01/2011 01:59 PM, Adewale, Adeniyi wrote:
> Does anyone know how to fit a repeated measures model in R with
> unstructured variance-covariance matrix? Below is a SAS equivalent of
> the model I am interested in:
> 
> proc mixed data=longdat;
> 	class alloc week;
> 	model y =  week  trt2wk1 trt2wk2 trt2wk3 trt2wk4/ddfm=kr covb
> corrb solution;
> 	repeated week/type=un subject=alloc;
> run;
> 
> I was able to fit a simpler model with compound symmetric
> variance-covariance structure (or equivalently, for positively
> correlated data, a simple random intercept model) using the lme function
> in the nlme package:
> 
> fit <- lme(y ~ week + trt2wk1 + trt2wk2 + trt2wk3 +
> trt2wk4,data=longdat,random=~1|alloc)
> 
> My example data is attached.
>  <<longdat.txt>> 
> Thanks.
> 
> Adeniyi Adewale

  Take a look at ?pdSymm in the nlme package.  Something like

lme(...,random=list(alloc=pdSymm(~1))

  although this is completely untested; investing in a copy of Pinheiro
and Bates 2000 would be a great idea ...

  Ben Bolker




More information about the R-sig-mixed-models mailing list