mice icon indicating copy to clipboard operation
mice copied to clipboard

pool() fails when tidy returns contrasts rather than terms

Open LukasWallrich opened this issue 1 year ago • 0 comments

I am trying to pool the results of multcomp::glht - however, when tidy() does not return terms but contrasts, these are dropped, yielding meaningless results (averaged across contrasts). Should contrast be treated equivalently to term, parameter etc in pool.fitlist?

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
library(mice)
#> 
#> Attaching package: 'mice'
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following objects are masked from 'package:base':
#> 
#>     cbind, rbind

lmod <- lm(mpg ~ am + cyl, mtcars)
lin_comp <- glht(lmod, linfct = c("am = 0", "cyl = 0"))
tidy(lin_comp)
#> # A tibble: 2 × 6
#>   contrast null.value estimate std.error statistic adj.p.value
#>   <chr>         <dbl>    <dbl>     <dbl>     <dbl>       <dbl>
#> 1 am                0     2.57     1.29       1.99 0.100      
#> 2 cyl               0    -2.50     0.361     -6.93 0.000000254

lin_comp_mira <- rep(list(lin_comp), 10) |> as.mira()

pool(lin_comp_mira)
#>  [OMITTING LOTS OF WARNINGS RE UNSUPPORTED tidy() ARGUMENTS]
#> Class: mipo    m = 10 
#>    m   estimate      ubar        b        t dfcom       df      riv    lambda
#> 1 20 0.03303853 0.8989917 6.759091 7.996037   Inf 24.11837 7.894451 0.8875704
#>         fmi
#> 1 0.8958621

Created on 2022-08-31 by the reprex package (v2.0.1)




 

LukasWallrich avatar Aug 31 '22 12:08 LukasWallrich