Documentation Index
Fetch the complete documentation index at: https://mintlify.com/namakala/inappropriate-acid-suppressor-agent-use/llms.txt
Use this file to discover all available pages before exploring further.
meta-analysis.R provides four functions that implement the full statistical modeling pipeline. fitMetaprop() fits an overall proportion meta-analysis, fitSubMetaprop() extends it to subgroup analyses, fitMetareg() fits univariable or multivariable meta-regression, and applyCopas() applies the Copas selection model to adjust for publication bias.
fitMetaprop()
Parameters
Cleaned data frame from
clean(). Must contain Inappropriate_indication (event count), Sample_size (total n), and Author (study label).Additional arguments passed to
meta::metaprop(). Use these to override model settings such as subgroup or keepdata.Returns
Ametaprop object from the meta package. Key slots include TE.random, lower.random, upper.random, I2, tau2, H, Q, k, n, and event.
Model settings
| Setting | Value | Description |
|---|---|---|
sm | "PFT" | Freeman-Tukey double arcsine transformation |
method.tau | "REML" | Restricted maximum likelihood for heterogeneity |
method.random.ci | "HK" | Hartung-Knapp confidence intervals |
common | FALSE | Common-effect model not fitted |
random | TRUE | Random-effects model fitted |
prediction | TRUE | Prediction interval included |
Usage
fitSubMetaprop()
Parameters
Cleaned data frame from
clean().A
rlang symbol identifying the grouping variable. Valid columns in the pipeline are Age, Continent, Setting, JBI_Classification, and use_guideline. Pass as rlang::sym("Continent").Additional arguments passed to
fitMetaprop().Returns
Ametaprop object with subgroup structure. The subgroup slot contains the grouping variable values; TE.random.w, lower.random.w, and upper.random.w hold the per-subgroup estimates.
How it works
The function first drops rows wherevarname is NA using rlang::as_name() to convert the symbol to a string for subsetting. It then calls fitMetaprop() with the subgroup argument set to the pulled column and keepdata = TRUE so the original data is retained in the model object.
Usage
_targets.R:
fitMetareg()
Parameters
Cleaned data frame from
clean().A character vector of column names to use as moderators. A single element fits a univariable model; two or more elements fit a multivariable model with all terms joined by
+.Additional arguments passed to
metafor::rma().Returns
Anrma object from the metafor package. Key slots include b (coefficients), ci.lb, ci.ub, pval, I2, tau2, QE, and QEp.
How it works
Before fitting, the function removes rows wherevar_logit_prevalence is Inf and drops any remaining NA rows via na.omit(). The formula is constructed dynamically: a single varname produces ~ varname; multiple names produce ~ var1 + var2 + .... The outcome is logit_prevalence and the weights are var_logit_prevalence, both fitted with REML.
Usage
applyCopas()
Parameters
Either a fitted
meta object (e.g., from fitMetaprop()) for direct Copas analysis, or a raw data frame when you want applyCopas() to handle fitting internally.Column name to use for subgroup iteration. When
NULL, Copas analysis is applied to the overall model. When provided along with a data frame obj, the function splits the data by unique levels of varname and returns one Copas object per subgroup.Additional arguments passed to
metasens::copas().Returns
Acopas object when applied to a single model, or a list of copas objects (one per subgroup level) when varname is provided with a data frame.
How it dispatches
The function checksclass(obj) for the string "meta" using grepl():
objis ametaobject — callsmetasens::copas(obj, backtransf = TRUE, ...)directly and returns the result.objis a data frame andvarnameisNULL— callsfitMetaprop(obj)first, then recurses with the resulting model.objis a data frame andvarnameis given — splits the data into per-group subsets, fitsfitMetaprop()on each, and appliesapplyCopas()recursively to produce a list.
Usage
_targets.R:
