[R] Need help on this problem!
Lijuan Wang
lw7s at cms.mail.virginia.edu
Mon Aug 9 20:27:48 CEST 2004
Hi everyone,
I have posted a similar question to this list, but I don't
get a reply. I really want to solve this problem, so I
post it again...
I am trying to use R to fit some mixed-effects models for
a nested data. The data is a simulated data with 111
subjects. Each subject has 6 waves' data. Below are the
first two subjects' data :
> simu1[1:12,]
Grouped Data: gf ~ age | id
id occasion age gf tau b0
b1 b2
1 1 1 4.056714 35.08943 14.8 14.502078
5.209333 -5.199452
2 1 2 14.056714 87.18276 14.8 14.502078
5.209333 -5.199452
3 1 3 29.056714 91.19566 14.8 14.502078
5.209333 -5.199452
4 1 4 42.056714 91.32411 14.8 14.502078
5.209333 -5.199452
5 1 5 57.056714 91.47233 14.8 14.502078
5.209333 -5.199452
6 1 6 65.056714 91.55138 14.8 14.502078
5.209333 -5.199452
7 2 1 3.353627 16.94166 14.8 -0.331536
5.293478 -5.392813
8 2 2 13.353627 69.87644 14.8 -0.331536
5.293478 -5.392813
9 2 3 28.353627 76.18644 14.8 -0.331536
5.293478 -5.392813
10 2 4 41.353627 74.89508 14.8 -0.331536 5.293478
-5.392813
11 2 5 56.353627 73.40505 14.8 -0.331536 5.293478
-5.392813
12 2 6 64.353627 72.61037 14.8 -0.331536 5.293478
-5.392813
Firstly, I used lme to fit a mixed effects model with
quadratic curve.
> simu1$age2<-simu1$age^2
> mm.lme.2<-lme(gf~age+age2,random=~age+age2|id,data=simu1)
It works well:
> summary(mm.lme.2)
Linear mixed-effects model fit by REML
Data: simu1
AIC BIC logLik
5222.225 5267.193 -2601.113
Random effects:
Formula: ~age + age2 | id
Structure: General positive-definite, Log-Cholesky
parametrization
StdDev Corr
(Intercept) 2.729384e+00 (Intr) age
age 1.068434e-01 0.648
age2 8.285027e-34 0.000 0.000
Residual 1.082344e+01
Fixed effects: gf ~ age + age2
Value Std.Error DF t-value p-value
(Intercept) 23.902926 1.1606163 553 20.59503 <.0001
age 3.046429 0.0815675 553 37.34854 <.0001
age2 -0.034015 0.0011395 553 -29.85176 <.0001
Correlation:
(Intr) age
age -0.790
age2 0.697 -0.964
Standardized Within-Group Residuals:
Min Q1 Med Q3 Max
-2.5233682 -0.6801665 -0.1735055 0.5243569 2.7772921
Number of Observations: 666
Number of Groups: 111
However, when I tried to fit the following model and the
starting value is very close to the true value:
> simu.nlme<-nlme(gf~b00 + b10 * age + b20 *
max(0,(age-tau0)),data=simu1,fixed=b00+b10+b20+tau0~1,random=b00+b10+b20+tau0~1,group=~id,
start=c(b00=4.08,b10=5.32,b20=-5.29,tau0=14.8),method="REML")
It shows following error:
**************************************
Error in MEEM(object, conLin, control$niterEM) :
Singularity in backsolve at level 0, block 1
**************************************
I also fitted the same model by using SAS and winBUGS.
They all worked well...
Do you have any suggestions on this problem?
Any reply will be appreciated!
Lijuan
More information about the R-help
mailing list