From: <Arne.Muller_at_sanofi-aventis.com>

Date: Wed 08 Jun 2005 - 21:43:34 EST

*> fm2
*

Linear mixed-effects model fit by REML

Data: Orthodont

Log-restricted-likelihood: -218.7563

Fixed: mod

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 08 21:50:27 2005

Date: Wed 08 Jun 2005 - 21:43:34 EST

Dear All,

I've come across a problem in predict.lme. Assigning a model formula to a variable and then using this variable in lme (instead of typing the formula into the formula part of lme) works as expect. However, when performing a predict on the fitted model I gan an error messag - predict.lme (but not predictlm) seems to expect a 'properly' typed in formula and a cannot extract the formula from the variable. THe code below demonstrates this.

Is this a known or expected behavour of predict.lme or is this a bug?

kind regards,

Arne

(R-2.1.0)

> library(nlme)

...

> mod <- distance ~ age + Sex # example from ?lme

*> mod
*

distance ~ age + Sex

> fm2 <- lme(mod, data = Orthodont, random = ~ 1)

> anova(fm2)

numDF denDF F-value p-value (Intercept) 1 80 4123.156 <.0001 age 1 80 114.838 <.0001 Sex 1 25 9.292 0.0054

Linear mixed-effects model fit by REML

Data: Orthodont

Log-restricted-likelihood: -218.7563

Fixed: mod

^^^^

...

> predict(fm2, Orthodont)

Error in mCall[["fixed"]][-2] : object is not subsettable

> fm2 <- update(fm2, . ~ .) # this replaces "mod" by the contents of variable mod

*> fm2
*

Linear mixed-effects model fit by REML

Data: Orthodont

Log-restricted-likelihood: -218.7563

Fixed: distance ~ age + Sex

...

> predict(fm2, Orthodont)

M01 M01 M01 M01 ... 25.39237 26.71274 28.03311 29.35348 21.61052 ...

> fm2 <- lm(mod, data = Orthodont)

> predict(fm2, Orthodont)

1 2 3 4 ...

22.98819 24.30856 25.62894 26.94931 ...

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 08 21:50:27 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:32:27 EST
*