[R] A question about nlme

Peter Dalgaard p.dalgaard at biostat.ku.dk
Thu Apr 20 09:51:11 CEST 2006


"zhongmiao wang" <zhongmiao at gmail.com> writes:

> 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!

Is the character following "~" _really_ a space in all three cases?
Shift-space sometimes catches people off guard.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list