[Rd] inheritance problem in multcomp package (PR#6978)
rmh at temple.edu
rmh at temple.edu
Mon Jun 14 03:35:57 CEST 2004
# Your mailer is set to "none" (default on Windows),
# hence we cannot send the bug report directly from R.
# Please copy the bug report (after finishing it) to
# your favorite email program and send it to
#
# r-bugs at r-project.org
#
######################################################
The multcomp functions work on "lm" objects as anticipated.
They do not work on "aov" objects. Somehow the inheritance isn't
being acknowledged. I can't spot where in the code the problem lies.
Somewhere the df argument for "aov" objects is not defined.
My workaround is to change the class of the "aov" object to "lm".
Rich
> search()
[1] ".GlobalEnv" "package:multcomp" "package:mvtnorm" "package:methods"
[5] "package:stats" "package:utils" "package:graphics" "package:lattice"
[9] "package:grid" "Autoloads" "package:base"
> ## from R/rw1091alpha/library/multcomp/R-ex/simint.R
> data(recovery)
> lmmod <- lm(minutes ~ blanket, data=recovery, contrasts=list(blanket =
+ "contr.Dunnett"))
> summary(simint(lmmod, psubset=2:4, conf.level=0.9,
+ alternative="less",eps=0.0001))
Simultaneous 90% confidence intervals: model contrasts
model contrasts for factor
Contrast matrix:
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1
Absolute Error Tolerance: 1e-04
90 % quantile: 1.8431
Coefficients:
Estimate -- 90 % t value Std.Err. p raw p Bonf p adj
blanketb1-b0 -2.1333 -Inf 0.8226 -1.3302 1.6038 0.0958 0.2874 0.2412
blanketb2-b0 -7.4667 -Inf -4.5108 -4.6556 1.6038 0.0000 0.0001 0.0001
blanketb3-b0 -1.6667 -Inf -0.0360 -1.8837 0.8848 0.0337 0.1012 0.0924
> ## change lm to aov
> aovmod <- aov(minutes ~ blanket, data=recovery, contrasts=list(blanket =
+ "contr.Dunnett"))
> aovmod
Call:
aov(formula = minutes ~ blanket, data = recovery, contrasts = list(blanket = "contr.Dunnett"))
Terms:
blanket Residuals
Sum of Squares 151.9772 248.2667
Deg. of Freedom 3 37
Residual standard error: 2.590349
Estimated effects may be unbalanced
> simint(aovmod)
Error in floor(df) : Non-numeric argument to mathematical function
> names(aovmod)
[1] "coefficients" "residuals" "effects" "rank"
[5] "fitted.values" "assign" "qr" "df.residual"
[9] "contrasts" "xlevels" "call" "terms"
[13] "model"
> names(lmmod)
[1] "coefficients" "residuals" "effects" "rank"
[5] "fitted.values" "assign" "qr" "df.residual"
[9] "contrasts" "xlevels" "call" "terms"
[13] "model"
> all.equal(lmmod, aovmod)
[1] "Attributes: < Component 1: Lengths (1, 2) differ (string compare on first 1) >"
[2] "Attributes: < Component 1: 1 string mismatches >"
[3] "Component 11: target, current don't match when deparsed"
> attributes(lmmod)
$names
[1] "coefficients" "residuals" "effects" "rank"
[5] "fitted.values" "assign" "qr" "df.residual"
[9] "contrasts" "xlevels" "call" "terms"
[13] "model"
$class
[1] "lm"
> attributes(aovmod)
$names
[1] "coefficients" "residuals" "effects" "rank"
[5] "fitted.values" "assign" "qr" "df.residual"
[9] "contrasts" "xlevels" "call" "terms"
[13] "model"
$class
[1] "aov" "lm"
> lmmod$call
lm(formula = minutes ~ blanket, data = recovery, contrasts = list(blanket = "contr.Dunnett"))
> aovmod$call
aov(formula = minutes ~ blanket, data = recovery, contrasts = list(blanket = "contr.Dunnett"))
> ### play games
> class(aovmod) <- "lm"
> summary(simint(aovmod, psubset=2:4, conf.level=0.9,
+ alternative="less",eps=0.0001))
Simultaneous 90% confidence intervals: model contrasts
model contrasts for factor
Contrast matrix:
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1
Absolute Error Tolerance: 1e-04
90 % quantile: 1.8431
Coefficients:
Estimate -- 90 % t value Std.Err. p raw p Bonf p adj
blanketb1-b0 -2.1333 -Inf 0.8226 -1.3302 1.6038 0.0958 0.2874 0.2412
blanketb2-b0 -7.4667 -Inf -4.5107 -4.6556 1.6038 0.0000 0.0001 0.0001
blanketb3-b0 -1.6667 -Inf -0.0359 -1.8837 0.8848 0.0337 0.1012 0.0924
> bug.report("inheritance problem in multcomp package")
--please do not edit the information below--
Version:
platform = i386-pc-mingw32
arch = i386
os = mingw32
system = i386, mingw32
status = alpha
major = 1
minor = 9.1
year = 2004
month = 05
day = 25
language = R
Windows XP Home Edition (build 2600) Service Pack 1.0
Search Path:
.GlobalEnv, file:c:/HOME/rmh/hh/splus.library/.RData,
file:c:/HOME/rmh/hh/splus.library/HH/.RData, package:multcomp, package:mvtnorm, package:methods,
package:stats, package:utils, package:graphics, package:lattice, package:grid, Autoloads,
package:base
More information about the R-devel
mailing list