Running ‘bugfix.R’ [3s/3s]
Running the tests in ‘tests/bugfix.R’ failed.
Complete output:
  > 
  > library("multcomp")
  Loading required package: mvtnorm
  Loading required package: survival
  Loading required package: TH.data
  Loading required package: MASS
  
  Attaching package: 'TH.data'
  
  The following object is masked from 'package:MASS':
  
      geyser
  
  > set.seed(290875)
  > 
  > ### mcp didn't accept objects of class `contrMat'
  > ### spotted by Yves Brostaux <brostaux.y@fsagx.ac.be>
  > amod <- aov(response ~ trt, data = cholesterol)
  > cht1 <- glht(amod, linfct = mcp(trt = "Tukey"))
  > K <- contrMat(table(cholesterol$trt), type = "Tukey")
  > cht2 <- glht(amod, linfct = mcp(trt = K))
  > stopifnot(all.equal(coef(cht1), coef(cht2)))
  > 
  > ### several inconsistencies spotted by 
  > ### Rich Heiberger <rmh@temple.edu> 2006-11-28
  > 
  > ### need to be identical
  > stopifnot(identical(cht1, print(cht1)))
  
  	 General Linear Hypotheses
  
  Multiple Comparisons of Means: Tukey Contrasts
  
  
  Linear Hypotheses:
                       Estimate
  2times - 1time == 0     3.443
  4times - 1time == 0     6.593
  drugD - 1time == 0      9.579
  drugE - 1time == 0     15.166
  4times - 2times == 0    3.150
  drugD - 2times == 0     6.136
  drugE - 2times == 0    11.723
  drugD - 4times == 0     2.986
  drugE - 4times == 0     8.573
  drugE - drugD == 0      5.586
  
  > 
  > ### was: error
  > summary(cht1)$test
  $pfunction
  function (type = c("univariate", "adjusted", p.adjust.methods), 
      ...) 
  {
      type <- match.arg(type)
      pfct <- function(q) {
          switch(object$alternative, two.sided = {
              low <- rep(-abs(q), dim)
              upp <- rep(abs(q), dim)
          }, less = {
              low <- rep(q, dim)
              upp <- rep(Inf, dim)
          }, greater = {
              low <- rep(-Inf, dim)
              upp <- rep(q, dim)
          })
          pmvt(lower = low, upper = upp, df = df, corr = cr, ...)
      }
      switch(object$alternative, two.sided = {
          if (df > 0) pvals <- 2 * (1 - pt(abs(tstat), df)) else pvals <- 2 * 
              (1 - pnorm(abs(tstat)))
      }, less = {
          if (df > 0) pvals <- pt(tstat, df) else pvals <- pnorm(tstat)
      }, greater = {
          if (df > 0) pvals <- 1 - pt(tstat, df) else pvals <- 1 - 
              pnorm(tstat)
      })
      if (type == "univariate") 
          return(pvals)
      if (type == "adjusted") {
          ret <- numeric(length(tstat))
          error <- 0
          for (i in 1:length(tstat)) {
              tmp <- pfct(tstat[i])
              if (attr(tmp, "msg") != "Normal Completion" && length(grep("^univariate", 
                  attr(tmp, "msg"))) == 0) 
                  warning(attr(tmp, "msg"))
              if (error < attr(tmp, "error")) 
                  error <- attr(tmp, "error")
              ret[i] <- tmp
          }
          ret <- 1 - ret
          attr(ret, "error") <- error
          return(ret)
      }
      return(p.adjust(pvals, method = type))
  }
  <environment: 0x55ca54a1d8e8>
  
  $qfunction
  function (conf.level, adjusted = TRUE, ...) 
  {
      tail <- switch(object$alternative, two.sided = "both.tails", 
          less = "lower.tail", greater = "upper.tail")
      if (adjusted) {
          calpha <- qmvt(conf.level, df = df, corr = cr, tail = tail, 
              ...)
      }
      else {
          calpha <- qmvt(conf.level, df = df, corr = matrix(1), 
              tail = tail, ...)
      }
      ret <- calpha$quantile
      attr(ret, "error") <- calpha$estim.prec
      return(ret)
  }
  <environment: 0x55ca54a1d8e8>
  
  $coefficients
   2times - 1time  4times - 1time   drugD - 1time   drugE - 1time 4times - 2times 
          3.44300         6.59281         9.57920        15.16555         3.14981 
   drugD - 2times  drugE - 2times  drugD - 4times  drugE - 4times   drugE - drugD 
          6.13620        11.72255         2.98639         8.57274         5.58635 
  
  $sigma
   2times - 1time  4times - 1time   drugD - 1time   drugE - 1time 4times - 2times 
         1.443376        1.443376        1.443376        1.443376        1.443376 
   drugD - 2times  drugE - 2times  drugD - 4times  drugE - 4times   drugE - drugD 
         1.443376        1.443376        1.443376        1.443376        1.443376 
  
  $tstat
   2times - 1time  4times - 1time   drugD - 1time   drugE - 1time 4times - 2times 
         2.385379        4.567631        6.636661       10.506996        2.182251 
   drugD - 2times  drugE - 2times  drugD - 4times  drugE - 4times   drugE - drugD 
         4.251282        8.121617        2.069031        5.939366        3.870335 
  
  $pvalues
   [1] 1.380883e-01 3.524764e-04 3.563710e-07 2.897682e-14 2.050268e-01
   [6] 9.917862e-04 6.540452e-10 2.512705e-01 3.447725e-06 3.042641e-03
  attr(,"error")
  [1] 0.0001910665
  
  $type
  [1] "single-step"
  
  attr(,"class")
  [1] "mtest"
  > 
  > 
  > ### NAs in coefficients
  > tmp.data <- data.frame(EE=gl(2, 1, 24, letters[1:2]),
  +                 FF=gl(3, 2, 24, LETTERS[3:5]),
  +                 GG=gl(4, 6, 24, letters[6:9]))
  > tmp.data$x <- rep(12, 24)
  > tmp.data$y <- rep(7, 24)
  > tmp.data$z <- c(9, 14, 3, 4, 15, 1, 11, 13, 24, 10, 22, 18,
  +                 20, 21, 6, 7, 16, 2, 19, 12, 17, 8, 23, 5)
  > tmp.data$w <- c(15, 9, 18, 21, 17, 11, 23, 12, 1, 10, 2, 14, 24, 7,
  +                 13, 4, 5, 19, 16, 20, 3, 8, 22, 6)
  > 
  > tmp.aov <- aov(z ~ EE+FF*GG + x*y +x*EE + y*FF, data=tmp.data)
  > 
  > try(glht(tmp.aov, linfct=mcp(EE="Tukey")))
  Error in modelparm.default(model, ...) : 
    dimensions of coefficients and covariance matrix don't match
  In addition: Warning message:
  In mcp2matrix(model, linfct = linfct) :
    covariate interactions found -- default contrast might be inappropriate
  > try(glht(tmp.aov, linfct=mcp(FF="Tukey")))
  Error in modelparm.default(model, ...) : 
    dimensions of coefficients and covariance matrix don't match
  In addition: Warning message:
  In mcp2matrix(model, linfct = linfct) :
    covariate interactions found -- default contrast might be inappropriate
  > glht(tmp.aov, linfct=mcp(GG="Tukey"))
  Error in modelparm.default(model, ...) : 
    dimensions of coefficients and covariance matrix don't match
  Calls: glht ... glht -> glht.matrix -> modelparm -> modelparm.default
  In addition: Warning message:
  In mcp2matrix(model, linfct = linfct) :
    covariate interactions found -- default contrast might be inappropriate
  Execution halted