[R] converting lme commands from S-PLUS to R

Roger D. Peng rpeng at jhsph.edu
Sun Apr 11 23:10:38 CEST 2004


I'm trying to do some smoothing with lme and am having some difficulty 
bringing commands over from S-PLUS to R.  I have the following setup 
(modified from Ngo and Wand, 2004):

set.seed(1)
x <- runif(200)
y <- sin(3*pi*x) + rnorm(200)*.4
## library(splines)
z <- ns(x, 4)

The following runs without error on S-PLUS

f <- lme(y ~ 1, random = pdIdent(~ -1 + z))

But in R I get

library(nlme)
 > f <- lme(y ~ 1, random = pdIdent(~ -1 + z))
Error in getGroups.data.frame(dataMix, groups) :
         Invalid formula for groups

Does the S-PLUS lme have some default setting that R doesn't?  Any help 
would be appreciated.

Thanks,

-roger




More information about the R-help mailing list