[Rd] 'anova.gls' in 'nlme' (PR#13567)
richard_raubertas at merck.com
richard_raubertas at merck.com
Wed Mar 4 02:10:07 CET 2009
There is a bug in 'anova.gls' in the 'nlme' package (3.1-90). The=20
bug is triggered by calling the function with a single 'gls' object=20
and specifying the 'Terms' argument but not the 'L' argument:
> library(nlme)
> fm1Orth.gls <- gls(distance ~ Sex * I(age - 11), Orthodont,
+ correlation =3D corSymm(form =3D ~ 1 | Subject),
+ weights =3D varIdent(form =3D ~ 1 | age))
> anova(fm1Orth.gls)
Denom. DF: 104=20
numDF F-value p-value
(Intercept) 1 4246.041 <.0001
Sex 1 7.718 0.0065
I(age - 11) 1 116.806 <.0001
Sex:I(age - 11) 1 7.402 0.0076
> anova(fm1Orth.gls, Terms=3D"Sex")
Error in anova.gls(fm1Orth.gls, Terms =3D "Sex") :=20
object "noZeroColL" not found
>
The bug is in the following lines near the end:
if (!missing(L)) {
if (nrow(L) > 1)
attr(aod, "L") <- L[, noZeroColL, drop =3D FALSE]
else attr(aod, "L") <- L[, noZeroColL]
}
where the problem is that when 'Terms' is provided, earlier code=20
sets 'L' (so it is no longer missing) but does not set 'noZeroColL'.
In the similar function 'anova.lme' the problem is avoided by the=20
first line
Lmiss <- missing(L)
and then testing whether 'Lmiss' is TRUE in the rest of the=20
function, rather than 'missing(L)'.
Rich Raubertas
Merck & Co.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D
> sessionInfo()
R version 2.8.1 (2008-12-22)=20
i386-pc-mingw32=20
locale:
LC_COLLATE=3DEnglish_United States.1252;LC_CTYPE=3DEnglish_United
States.1252;LC_MONETARY=3DEnglish_United
States.1252;LC_NUMERIC=3DC;LC_TIME=3DEnglish_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] nlme_3.1-90
loaded via a namespace (and not attached):
[1] grid_2.8.1 lattice_0.17-20 tools_2.8.1 =20
>=20
Notice: This e-mail message, together with any attachme...{{dropped:12}}
More information about the R-devel
mailing list