When I try to run the example from Variogram with an lme object, I get an error (although summary works): R : Copyright 2005, The R Foundation for Statistical Computing Version 2.2.1 (2005-12-20 r36812) ISBN 3-900051-07-0 ...> fm1 <- lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat)Error: couldn't find function "lme"> Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE)Error: couldn't find function "Variogram"> library(nlme) > fm1 <- lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat) > Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE)Error in "$<-.data.frame"(`*tmp*`, "n.pairs", value = c(160, 0, 160, 16, : replacement has 10 rows, data has 9> summary(fm1)Linear mixed-effects model fit by REML Data: BodyWeight AIC BIC logLik 1171.720 1203.078 -575.8599 Random effects: Formula: ~Time | Rat Structure: General positive-definite, Log-Cholesky parametrization StdDev Corr (Intercept) 36.9390723 (Intr) Time 0.2484113 -0.149 Residual 4.4436052 Fixed effects: weight ~ Time * Diet Value Std.Error DF t-value p-value (Intercept) 251.65165 13.094025 157 19.218816 0.0000 Time 0.35964 0.091140 157 3.946019 0.0001 Diet2 200.66549 22.679516 13 8.847873 0.0000 Diet3 252.07168 22.679516 13 11.114509 0.0000 Time:Diet2 0.60584 0.157859 157 3.837858 0.0002 Time:Diet3 0.29834 0.157859 157 1.889903 0.0606 Correlation: (Intr) Time Diet2 Diet3 Tm:Dt2 Time -0.160 Diet2 -0.577 0.092 Diet3 -0.577 0.092 0.333 Time:Diet2 0.092 -0.577 -0.160 -0.053 Time:Diet3 0.092 -0.577 -0.053 -0.160 0.333 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -3.25558796 -0.42196874 0.08229384 0.59933559 2.78994477 Number of Observations: 176 Number of Groups: 16 Information on package 'nlme' Description: Package: nlme Version: 3.1-68.1 Date: 2006-01-05 Rick B.
So this is most likely a bug in package nlme. However, we need a reproducible example to be able to do anything about it, and without even the traceback() we cannot be sure that it is in nlme. Please follow the bug-reporting procedure. On Mon, 13 Mar 2006, Rick Bilonick wrote:> When I try to run the example from Variogram with an lme object, I get > an error (although summary works): > > R : Copyright 2005, The R Foundation for Statistical Computing > Version 2.2.1 (2005-12-20 r36812) > ISBN 3-900051-07-0 > ... > >> fm1 <- lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat) > Error: couldn't find function "lme" >> Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE) > Error: couldn't find function "Variogram" >> library(nlme) >> fm1 <- lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat) >> Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE) > Error in "$<-.data.frame"(`*tmp*`, "n.pairs", value = c(160, 0, 160, > 16, : > replacement has 10 rows, data has 9[...]> Information on package 'nlme' > > Description: > > Package: nlme > Version: 3.1-68.1 > Date: 2006-01-05-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Rick Bilonick <rab45+ <at> pitt.edu> writes:> > When I try to run the example from Variogram with an lme object, I get > an error (although summary works): > > > library(nlme) > > fm1 <- lme(weight ~ Time * Diet, BodyWeight, ~ Time | Rat) > > Variogram(fm1, form = ~ Time | Rat, nint = 10, robust = TRUE) > Error in "$<-.data.frame"(`*tmp*`, "n.pairs", value = c(160, 0, 160, > 16, : > replacement has 10 rows, data has 9 >The example is does not run, but if you leave out nint=10 (giving default nint=20), or use any number nint >=12, it works. The example has a "don't run" in the docs, but it could easily be cleaned up. If it should serve as documentation of the error message, it's a bit confusing. Dieter