Dear Jose and all the S+ users,
I already install the nlme version 3.0. I used the gls function to estimate
the fixed effects
models but i have a problem to define the UNSTRUCTURED covariance matrix.
First I'll describe the dataset that I'm using
(this dataset is from SAS/STAT Software:Changes and Enhancements through
Release 6.12,
page 662, Example 18.2.):
Each one of the subjects was measured 4 times,
another covariate in the model is the sex group
(there are no missing values in this specific dataset).
Example of the data:
sex resp time subject(=idnr)
1 1 21.0 8 11
2 1 20.0 10 11
3 1 21.5 12 11
4 1 23.0 14 11
5 1 21.0 8 21
6 1 21.5 10 21
7 1 24.0 12 21
8 1 25.5 14 21
. . . . .
. . . . .
. . . . .
. . . . .
. . . . .
45 2 26.0 8 12
46 2 25.0 10 12
47 2 29.0 12 12
48 2 31.0 14 12
49 2 21.5 8 22
50 2 22.5 10 22
51 2 23.0 12 22
52 2 26.5 14 22
. . . . .
. . . . .
I want to fit the following three models:
Model 1 : simple covariance matrix.
Model 2 : random intercept model.
Model 3 : unstructured covariance matrix.
I don't have any problems to estimate model 1 and 2 using the following code:
MODEL1 1: Fixed effects model (Vi=sigma^2*I)
SPlus code:
gls(resp~as.factor(sex)+time:as.factor(sex),data=Gro2,method="ML")
-------------------------------------------------------------------------------
MODEL2 2: Random intercept model (Vi=tau^2*J+sigma^2*I)
SPlus code:
1. hhh <- lme(fixed=resp~as.factor(sex)+time:as.factor(sex),
random=~1,
cluster=~idnr,
est.method=c("ML"),
data=Gro2)
OR
2. hhh <- gls(resp~as.factor(sex)+time:as.factor(sex),data=Gro2,
method="ML",corCompSymm(form = ~ 1 | idnr))
this model can be estimated in two ways: random intercept model (code 1) or
fixed effects
model with compound symmetry matrix for the measurement error(code 2)
-----------------------------------------------------------------------------
Model 3 : Fixed effect model with unstructured covariance matrix.
(Vi is a 4*4 matrix with the entries sigma_ij)
Just to make sure that I'm clear, I include first the SAS code for proc MIXED.
SAS code:
proc mixed data=gro2 method=ml covest;
class idnr sex;
model measure = sex time1*sex / s;
repeated / type=un subject=idnr r rcorr;
run;
SPlus code:
hhh <- gls(resp~as.factor(sex)+time:as.factor(sex),data=Gro2,method="ML",
correlation=corSymm(???????)))
I thought that since the time covariate in my case is "time" and the
grouping level (for the covariance matrix)
is the subjects "idnr" i should use the following code:
correlation=corSymm(form= ~ time|idnr))
But this gives me the folloeing error:
Error in ## Initialize objects: Unique values of the covariate for
"corSymm" objects must be a sequence of consecutive integers
Dumped
SO HOW CAN I ESTIMATED A FIXED EFFECTS MODEL WITH UNSTRUCTURED CO VARIANCE
MATRIX ?
I also what to mention the motivation in my questions (from today and from
yesterday):
If we think about a model building process then the three model that I
mentioned before are nested models and we can test
model 3 (as the null model) versus model 2 (or 1) using the LR test. From
this reason, we have to estimate the fixed effects model with
unstructured covariance matrix.
thanks, Ziv.
I also include the SAS code for model 1 and 2:
MODEL 1 :
proc mixed data=gro2 method=reml covest;
class idnr sex;
model measure = sex sex*time1/ s;
repeated/ type=simple subject=idnr r rcorr;
run;
MODEL 2 :
proc mixed data=gro2 method=ml ;
class idnr sex;
model measure = sex sex*time1/ s;
random intercept/ type=un subject=idnr g;
run;
OR
proc mixed data=gro2 method=ml ;
class idnr sex;
model measure = sex sex*time1/ s;
repeated/ type=cs subject=idnr r rcorr;
run;
=========================================================
Ziv Shkedy
Biostatistics
Center for Statistics
Limburgs Universitair Centrum
Universitaire Campus, department WNI
B-3590 Diepenbeek, Belgium
Tel: +32-(0)11-26.82.57
e-mail: ziv.shkedy@luc.ac.be
=========================================================
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|