[R-meta] Constraint rrror when using Wald_test_cwb
Michael Dewey
||@t@ @end|ng |rom dewey@myzen@co@uk
Sat Sep 14 14:31:46 CEST 2024
Dear Brendan
When I run your MWE (after inserting library(metafor) I get
Error in Wald_test_cwb(full_model = meta_analysis_robust, constraints =
constrain_equal(1:3), :
could not find function "Wald_test_cwb"
Michael
On 14/09/2024 10:28, Pearl, Brendan via R-sig-meta-analysis wrote:
> Hello,
>
> I am trying to run a cluster wild bootstrap, but am getting the following error:
>
> Error in constrain_zero(constraints = constraints, coefs = coefs) :
> Constraint indices must be less than or equal to 1.
>
> Question: What does this mean?
>
> Thankyou,
> Brendan
>
> Background (if relevant):
> I am running a purely exploratory series of meta-analyses of the relationships between several predictors and outcomes (i.e. n x m meta-analyses).
> There is non-independence within each predictor-relationship pair (some studies report multiple effect sizes for the same group of participants) and the effect sizes are nested.
> I am following the general workflow outlined here: (https://wviechtb.github.io/metafor/reference/misc-recs.html#general-workflow-for-meta-analyses-involving-complex-dependency-structures) and want to use cluster wild bootstrapping because some analyses have very few studies (and cluster-robust inference methods led to very wide confidence intervals)
>
> Minimal working example:
>
> ```{r}
> dat_temp_mwe <- structure(list(study = c("A", "B", "C", "D", "E", "E", "F", "F",
> "F", "F", "G"), effect_id = c(11, 28, 73, 93, 115, 232, 236,
> 242, 252, 266, 284), Paper = c("AA", "BB", "CC", "DD", "EE1",
> "EE2", "FF1", "FF2", "FF3", "FF4", "GG"), Mean_age_when_outcome_measured = c(21,
> 19, 26, 19, 19, 21, 21, 21, 21, 19, 19), yi = structure(c(-0.0401817896328312,
> -0.0700000000000002, -0.151002873536528, -0.113328685307003,
> -0.139761942375159, -0.0392207131532808, -0.0487901641694324,
> -0.05, -0.041141943331175, -0.0421011760186351, -0.604315966853329
> ), ni = c(1566, 844, 624, 355, 7449, 2135, 2410, 4853, 6912,
> 7842, 1202), measure = "GEN"), vi = c(0.00014647659162424, 0.000527143487544687,
> 0.00336452354486442, 0.00116040765035603, 0.00667694039383453,
> 9.6295107522168e-05, 9.44692075770055e-05, 0.000100003675148229,
> 2.50009187870589e-05, 2.50009187870581e-05, 0.0292124283937479
> )), row.names = c(NA, 11L), class = c("escalc", "data.frame"), yi.names = "yi", vi.names = "vi", digits = c(est = 4,
> se = 4, test = 4, pval = 4, ci = 4, var = 4, sevar = 4, fit = 4,
> het = 4))
>
> V <- vcalc(vi,
> cluster = study,
> obs = effect_id,
> time1 = Mean_age_when_outcome_measured,
> data = dat_temp_mwe,
> rho = 0.8,
> phi = 0.9)
>
> meta_analysis_output <- rma.mv(
> yi,
> V = V,
> random = ~ 1 | study / Paper / effect_id,
> data = dat_temp_mwe,
> control = list(rel.tol = 1e-8))
>
> Wald_test_cwb(full_model = meta_analysis_robust,
> constraints = constrain_equal(1:3),
> R = 99,
> seed = 20201229)
> ```
> _______________________________________________
> R-sig-meta-analysis mailing list @ R-sig-meta-analysis using r-project.org
> To manage your subscription to this mailing list, go to:
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
>
--
Michael
More information about the R-sig-meta-analysis
mailing list