[R] converting lme commands from S-PLUS to R
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Mon Apr 12 00:53:49 CEST 2004
"Roger D. Peng" <rpeng at jhsph.edu> writes:
> 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.
Which version of S-PLUS? lme has changed and the newer versions insist
on having grouping levels for the random effects, so I think you're
looking for
> g <- rep(1,200)
> f <- lme(y ~ 1, random = list(g=pdIdent(~ z-1)))
> f
Linear mixed-effects model fit by REML
Data: NULL
Log-restricted-likelihood: -111.2290
Fixed: y ~ 1
(Intercept)
0.3568754
Random effects:
Formula: ~z - 1 | g
Structure: Multiple of an Identity
z1 z2 z3 z4 Residual
StdDev: 1.623315 1.623315 1.623315 1.623315 0.398023
Number of Observations: 200
Number of Groups: 1
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list