[R] A question about nlme

zhongmiao wang zhongmiao at gmail.com
Thu Apr 20 07:10:00 CEST 2006


Hello,
I have used nlme to fit a model, the R syntax is like

fmla0<-as.formula(paste("~",paste(colnames(ldata[,9:13]),collapse="+"),"-1"))
> fmla1<-as.formula(paste("~",paste(colnames(ldata[,14:18]),collapse="+"),"-1"))
> fmla2<-as.formula(paste("~",paste(colnames(ldata[,19:23]),collapse="+"),"-1"))
> Block=pdBlocked(list(pdIdent(fmla0),pdIdent(fmla1),pdIdent(fmla2)))
> lme(fixed=Score ~ factor(time)-1,data=ldata,random=list(Block),
+     weights=varIdent(form= ~ 1|time),
+     correlation=corSymm(form= ~ 1|Block/ID))

and the Error message is
Error in parse(file, n, text, prompt) : syntax error in "~ "

I repeatedly check the "~", however, I cannot find anything wrong with
it. Is there anybody can tell what is wrong? Thank you so much!

Zhongmiao Wang




More information about the R-help mailing list