guido-s / meta

Official Git repository of R package meta
http://cran.r-project.org/web/packages/meta/index.html
GNU General Public License v2.0
82 stars 32 forks source link

No "pval.random.w" element for certain metaprop models #51

Closed dchiu911 closed 1 year ago

dchiu911 commented 1 year ago

Hi @guido-s ,

I'm trying to perform a subgroup analysis for a meta-analysis of proportions. I've found that when specifying certain parameters for metaprop(), I'm not able to extract and report the pval.random.w element as referenced in your book. In particular, I'm trying to run the HKSJ method with arcsine transformation of proportions. However, I've seen other examples of metaprop() subgroup analysis where pval.random.w (and other associated elements) is not NA.

library(meta)
#> Loading 'meta' package (version 6.2-1).
#> Type 'help(meta)' for a brief overview.
#> Readers of 'Meta-Analysis with R (Use R!)' should install
#> older version of 'meta' package: https://tinyurl.com/dt4y5drs
dat <- structure(
  list(xi = c(182, 5, 209, 7, 19, 22, 17, 2, 4, 50, 9, 10, 3, 14, 30, 3, 32, 2, 25),
       ni = c(2905, 30, 1633, 30, 49, 157, 106, 15, 70, 150, 28, 38, 100, 100, 35, 48, 46, 18, 82), 
       subgroup = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L),
                            levels = c("A", "B"), class = "factor")),
  row.names = c(NA, -19L),
  class = c("tbl_df", "tbl", "data.frame")
)
mod <- metaprop(
  event = xi,
  n = ni,
  data = dat,
  sm = "PAS",
  fixed = FALSE,
  method.random.ci = "HK",
  method.tau = "SJ",
  subgroup = subgroup
)
mod$pval.random.w
#>  A  B 
#> NA NA

Created on 2023-05-08 with reprex v2.0.2

Session info ``` r sessionInfo() #> R version 4.2.2 (2022-10-31) #> Platform: aarch64-apple-darwin20 (64-bit) #> Running under: macOS Ventura 13.3.1 #> #> Matrix products: default #> BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib #> LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib #> #> locale: #> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base #> #> other attached packages: #> [1] meta_6.2-1 #> #> loaded via a namespace (and not attached): #> [1] Rcpp_1.0.10 rstudioapi_0.14 xml2_1.3.3 #> [4] mathjaxr_1.6-0 knitr_1.42 splines_4.2.2 #> [7] MASS_7.3-59 lattice_0.21-8 rlang_1.1.1 #> [10] fastmap_1.1.1 minqa_1.2.5 tools_4.2.2 #> [13] grid_4.2.2 nlme_3.1-162 xfun_0.39 #> [16] cli_3.6.1 metafor_4.2-0 withr_2.5.0 #> [19] htmltools_0.5.5 yaml_2.3.7 lme4_1.1-32 #> [22] digest_0.6.31 lifecycle_1.0.3 numDeriv_2016.8-1.1 #> [25] Matrix_1.5-4 nloptr_2.0.3 fs_1.6.2 #> [28] glue_1.6.2 evaluate_0.21 rmarkdown_2.21 #> [31] reprex_2.0.2 compiler_4.2.2 metadat_1.2-0 #> [34] boot_1.3-28.1 CompQuadForm_1.4.3 ```
guido-s commented 1 year ago

For the meta-analysis of single proportions, there is no obvious null hypothesis to test. Accordingly, by default, list elements 'pval.random' and 'pval.random.w' are NA.

You can use argument 'null.effect' in metaprop() to specify the null hypothesis, e.g., update(mod, null.effect = 0.3) to test whether the proportions are equal to 0.3.