Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: supporting metaplus models #266

Closed
IndrajeetPatil opened this issue Jun 10, 2020 · 0 comments
Closed

feature request: supporting metaplus models #266

IndrajeetPatil opened this issue Jun 10, 2020 · 0 comments
Labels
Enhancement 💥 Implemented features can be improved or revised

Comments

@IndrajeetPatil
Copy link
Member

Of course, this needs to be de-tidyversified, but broadly this is the kind of output I would expect.

# setup
set.seed(123) 
library(metaplus)
#> 
#> Note: The second parameter is the study standard error not the standard error squared as in the metafor package.
library(tidyverse)

# perform meta-analysis for mag studies, which have no outliers
# fit standard normal random-effect model 
mag.meta <- metaplus(yi, sei, slab = study, data = mag)

# class
class(mag.meta)
#> [1] "metaplus"

# summary
summary(mag.meta)
#>          Est. 95% ci.lb 95% ci.ub   pvalue
#> muhat -0.7463   -1.2583   -0.3428 0.000501
#> tau2   0.2540                             
#> 
#>      logLik      AIC      BIC
#>   -19.68459 43.36918 44.91436

# possible output 
mag.meta %>% {
  dplyr::inner_join(
    x = as_tibble(as.data.frame(.$results), rownames = "term"),
    y = as_tibble(as.data.frame(.$profile@summary@coef), rownames = "term"),
    by = "term"
  ) %>%
    dplyr::rename_all(.tbl = ., .funs = tolower) %>%
    dplyr::select(
      .data = .,
      term,
      estimate,
      conf.low = `95% ci.lb`,
      conf.high = `95% ci.ub`,
      p.value = pvalue,
      z.value = `z value`
    ) %>%
    dplyr::filter(.data = ., term == "muhat")
}
#> # A tibble: 1 x 6
#>   term  estimate conf.low conf.high  p.value z.value
#>   <chr>    <dbl>    <dbl>     <dbl>    <dbl>   <dbl>
#> 1 muhat   -0.746    -1.26    -0.343 0.000501      NA

Created on 2020-06-10 by the reprex package (v0.3.0)

@IndrajeetPatil IndrajeetPatil added the Enhancement 💥 Implemented features can be improved or revised label Jun 10, 2020
strengejacke added a commit that referenced this issue Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 💥 Implemented features can be improved or revised
Projects
None yet
Development

No branches or pull requests

1 participant