malcolmbarrett / tidymeta

:evergreen_tree::evergreen_tree::evergreen_tree: Tidy and plot meta-analyses in R
Other
51 stars 10 forks source link

feature request: supporting `mvmeta` objects #7

Open IndrajeetPatil opened 4 years ago

IndrajeetPatil commented 4 years ago

# setup
set.seed(123)
library(mvmeta)
#> Loading required package: mixmeta
#> This is mixmeta 1.0.7. For an overview type: help('mixmeta-package').
#> This is mvmeta 1.0.2. For an overview type: help('mvmeta-package').

# model
model <- mvmeta(cbind(PD,AL),S=berkey98[5:7],data=berkey98)

# class
class(model)
#> [1] "mvmeta"

# summary
summary(model)
#> Call:  mvmeta(formula = cbind(PD, AL) ~ 1, S = berkey98[5:7], data = berkey98)
#> 
#> Multivariate random-effects meta-analysis
#> Dimension: 2
#> Estimation method: REML
#> 
#> Fixed-effects coefficients
#>     Estimate  Std. Error        z  Pr(>|z|)  95%ci.lb  95%ci.ub     
#> PD    0.3534      0.0588   6.0057    0.0000    0.2381    0.4688  ***
#> AL   -0.3392      0.0879  -3.8589    0.0001   -0.5115   -0.1669  ***
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
#> 
#> Between-study random-effects (co)variance components
#> Structure: General positive-definite
#>     Std. Dev    Corr
#> PD    0.1083      PD
#> AL    0.1807  0.6088
#> 
#> Multivariate Cochran Q-test for heterogeneity:
#> Q = 128.2267 (df = 8), p-value = 0.0000
#> I-square statistic = 93.8%
#> 
#> 5 studies, 10 observations, 2 fixed and 3 random-effects parameters
#> logLik     AIC     BIC  
#> 2.0823  5.8353  6.2325

Created on 2019-12-10 by the reprex package (v0.3.0)

Session info ``` r devtools::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R version 3.6.1 (2019-07-05) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Europe/Berlin #> date 2019-12-10 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.6.0) #> backports 1.1.5 2019-10-02 [1] CRAN (R 3.6.1) #> callr 3.4.0 2019-12-09 [1] CRAN (R 3.6.1) #> cli 2.0.0 2019-12-09 [1] CRAN (R 3.6.1) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.1) #> desc 1.2.0 2019-11-11 [1] Github (r-lib/desc@61205f6) #> devtools 2.2.1 2019-09-24 [1] CRAN (R 3.6.1) #> digest 0.6.23 2019-11-23 [1] CRAN (R 3.6.1) #> ellipsis 0.3.0 2019-09-20 [1] CRAN (R 3.6.1) #> evaluate 0.14 2019-05-28 [1] CRAN (R 3.6.0) #> fansi 0.4.0 2018-11-05 [1] Github (brodieG/fansi@ab11e9c) #> fs 1.3.1 2019-05-06 [1] CRAN (R 3.6.0) #> glue 1.3.1 2019-03-12 [1] CRAN (R 3.6.0) #> highr 0.8 2019-03-20 [1] CRAN (R 3.6.0) #> htmltools 0.4.0 2019-10-04 [1] CRAN (R 3.6.1) #> knitr 1.26 2019-11-12 [1] CRAN (R 3.6.1) #> magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.1) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.6.0) #> mixmeta * 1.0.7 2019-12-09 [1] CRAN (R 3.6.1) #> mvmeta * 1.0.2 2019-12-10 [1] CRAN (R 3.6.1) #> pkgbuild 1.0.6 2019-10-09 [1] CRAN (R 3.6.1) #> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.6.0) #> prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.1) #> processx 3.4.1 2019-07-18 [1] CRAN (R 3.6.1) #> ps 1.3.0 2018-12-21 [1] CRAN (R 3.6.0) #> R6 2.4.1 2019-11-12 [1] CRAN (R 3.6.1) #> Rcpp 1.0.3 2019-11-08 [1] CRAN (R 3.6.1) #> remotes 2.1.0 2019-06-24 [1] CRAN (R 3.6.0) #> rlang 0.4.2 2019-11-23 [1] CRAN (R 3.6.1) #> rmarkdown 1.18 2019-11-27 [1] CRAN (R 3.6.1) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.1) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.6.0) #> stringi 1.4.3 2019-03-12 [1] CRAN (R 3.6.0) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.6.0) #> testthat 2.3.1 2019-12-01 [1] CRAN (R 3.6.1) #> usethis 1.5.1.9000 2019-11-28 [1] Github (r-lib/usethis@c7314cf) #> withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1) #> xfun 0.11 2019-11-12 [1] CRAN (R 3.6.1) #> yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.1) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-3.6.1/library ```
malcolmbarrett commented 4 years ago

Thanks for the suggestion! I definitely plan to expand support for other packages (and probably develop broom tidiers that will eventually go in that package). Unfortunately, I don't have a firm timeline of when that will be yet. I will take a good look at this example when I am able.

IndrajeetPatil commented 4 years ago

Eventually, do you plan to release tidymeta on CRAN?

Also, do you think it will be better to rename the package as broom.meta since it follows the same philosophy as broom and broom.mixed and fits in perfectly in that universe? The name is, of course, not that important but still thought I would raise this suggestion.

malcolmbarrett commented 4 years ago

re 1) yes, definitely 2) no, because I don't really see this package as filling exactly the same role as broom.mixed, although I could see a package doing that. The tidiers here, as you know, have already been ported to broom, so I could see them being ported to broom.meta, which could then be included in the metaverse (cc @alexpghayes, @mjwestgate).

In addition to plotting functions, which already exist in this package, I am starting to think that one role tidymeta should have is to better support working with input and output from other packages in the metaverse (joining functions and so on). Even when I am thinking about adding new tidiers, I now think that they should ultimately end up in broom (or a variant). So if there end up being multiple sets of meta tidiers, it may make sense to split off into a separate package. Then again, it seems like broom has not really gone full-force in the direction of modular packages.