meta_pdiff_two {esci} | R Documentation |
Estimate meta-analytic difference in proportions over multiple studies with two independent groups and a categorical outcome variable.
Description
meta_pdiff_two
is suitable for synthesizing across multiple two-group
studies with a categorical outcome variable. It takes as input the
the number of cases/events in the comparison and reference groups as
well as the total number of samples in the comparison and reference groups.
Usage
meta_pdiff_two(
data,
comparison_cases,
comparison_ns,
reference_cases,
reference_ns,
labels = NULL,
moderator = NULL,
contrast = NULL,
effect_label = "My effect",
reported_effect_size = c("RD", "RR", "OR", "AS", "PETO"),
random_effects = TRUE,
conf_level = 0.95
)
Arguments
data |
A dataframe or tibble |
comparison_cases |
A collection of case/event counts for the comparison groups, 1 per study, all integers >= 0 |
comparison_ns |
A collection of sample sizes for the comparison groups, 1 per study, all integers > 2 |
reference_cases |
A collection of case/event counts for the reference groups, 1 per study, all integers >= 0 |
reference_ns |
A collection of sample sizes for the reference groups, 1 per study, all integers > 2 |
labels |
An optional collection of study labels |
moderator |
An optional factor to analyze as a categorical moderator, must have k > 2 per groups |
contrast |
An optional contrast to estimate between moderator levels; express as a vector of contrast weights with 1 weight per moderator level. |
effect_label |
Optional character giving a human-friendly name of the effect being synthesized |
reported_effect_size |
Character specifying effect size to return:
Must be one of 'RD' (risk difference, default), 'RR' (log risk
ratio), 'OR' (log odds ratio), 'AS' (arcsine square root transformed
risk difference), or 'PETO' (log odds ratio estimated using Peto's
method). See |
random_effects |
TRUE for random effect model; FALSE for fixed effects |
conf_level |
The confidence level for the confidence interval. Given in decimal form. Defaults to 0.95. |
Details
Once you generate an estimate with this function, you can visualize
it with plot_meta()
.
The meta-analytic effect size, confidence interval and heterogeneity
estimates all come from metafor::rma()
.
The conversion of events into suitable effect sizes is handled by
metafor::escalc()
Value
An esci-estimate object; a list of data frames and properties. Returned tables include:
-
es_meta - A data frame of meta-analytic effect sizes. If a moderator was defined, there is an additional row for each level of the moderator.
-
effect_label - Study label
-
effect_size - Effect size
-
LL - Lower bound of conf_level% confidence interval
-
UL - Upper bound of conf_level% confidence interval
-
SE - Expected standard error
-
k - Number of studies
-
diamond_ratio - ratio of random to fixed effects meta-analytic effect sizes
-
diamond_ratio_LL - lower bound of conf_level% confidence interval for diamond ratio
-
diamond_ratio_UL - upper bound of conf_level% confidence interval for diamond ratio
-
I2 - I2 measure of heterogeneity
-
I2_LL - Lower bound of conf_level% confidence interval for I2
-
I2_UL - upper bound of conf_level% confidence interval for I2
-
PI_LL - lower bound of conf_level% of prediction interval
-
PI_UL - upper bound of conf_level% of prediction interval
-
p - p value for the meta-analytic effect size, based on null of exactly 0
*width - width of the effect-size confidence interval
-
FE_effect_size - effect size of the fixed-effects model (regardless of if fixed effects was selected
-
RE_effect_size - effect size of the random-effects model (regardless of if random effects was selected
-
FE_CI_width - width of the fixed-effects confidence interval, used to calculate diamond ratio
-
RE_CI_width - width of the fixed-effects confidence interval, used to calculate diamond ratio
-
-
es_heterogeneity - A data frame of of heterogeneity values and conf_level% CIs for the meta-analytic effect size. If a moderator was defined also reports heterogeneity estimates for each level of the moderator.
-
effect_label - study label
-
moderator_variable_name - if moderator passed, gives name of the moderator
-
moderator_level - 'Overall' and each level of moderator, if passed
-
measure - Name of the measure of heterogeneity
-
estimate - Value of the heterogeneity estimate
-
LL - lower bound of conf_level% confidence interval
-
UL - upper bound of conf_level% confidence interval
-
-
raw_data - A data from with one row for each study that was passed
-
label - study label
-
effect_size - effect size
-
weight - study weight in the meta analysis
-
sample_variance - expected level of sampling variation
-
SE - expected standard error
-
LL - lower bound of conf_level% confidence interval
-
UL - upper bound of conf_level% confidence interval
-
mean - used to calculate study p value; this is the d value entered for the study
-
sd - use to calculate study p value; set to 1 for each study
-
n - study sample size
-
p - p value for the study, based on null of exactly 0
-
Examples
# Data set: Replications of power on egocentric behavior
esci_meta_pdiff_two <- data.frame(
studies = c(
"Online",
"Original",
"Online Pilot",
"Exact replication"
),
control_egocentric = c(
33,
4,
4,
7
),
control_sample_size = c(
101,
33,
10,
53
),
power_egocentric = c(
48,
8,
4,
11
),
power_sample_size = c(
105,
24,
12,
56
),
setting = as.factor(
c(
"Online",
"In-Person",
"Online",
"In-Person"
)
)
)
# Meta-analysis, risk difference as effect size
estimate <- esci::meta_pdiff_two(
esci_meta_pdiff_two,
power_egocentric,
power_sample_size,
control_egocentric,
control_sample_size,
studies,
reported_effect_size = "RD"
)
# Forest plot
myplot_forst <- esci::plot_meta(estimate)
# Add a categorical moderator (setting)
estimate_moderator <- esci::meta_pdiff_two(
esci_meta_pdiff_two,
power_egocentric,
power_sample_size,
control_egocentric,
control_sample_size,
studies,
moderator = setting,
reported_effect_size = "RD"
)
# Forest plot
myplot_forest_moderator <- esci::plot_meta(estimate_moderator)