
Network Meta-analysis with MARS
network_meta.RdFits a network meta-analysis using mars in either multilevel or
multivariate mode and returns direct, indirect, and total treatment effects.
Multilevel models always use flexible heterogeneity across random levels.
Multivariate models can use either common or flexible heterogeneity. The
"wls" model type provides a common-effect weighted least-squares
compatibility estimator for comparisons against graph-theoretical network
meta-analysis implementations.
Usage
network_meta(
data,
study_id,
treatment_1,
treatment_2,
effect,
variance,
reference = NULL,
model_type = c("multilevel", "multivariate", "wls"),
heterogeneity = NULL,
tau_components = c("comparison", "treatment"),
nested_levels = NULL,
moderators = NULL,
estimation_method = "REML",
varcov_type = "multilevel",
within_varcov_type = NULL,
sample_size = NULL,
robustID = NULL,
tau2 = NULL,
control = list(),
ci_level = 0.95,
optim_method = "L-BFGS-B",
tol = 1e+07,
...
)Arguments
- data
A data frame with one row per observed treatment contrast.
- study_id
Character string naming the study ID column.
- treatment_1
Character string naming the first treatment column.
- treatment_2
Character string naming the second treatment column.
- effect
Character string naming the effect-size column, interpreted as treatment_2 minus treatment_1.
- variance
Character string naming the sampling-variance column.
- reference
Optional treatment label to use as network reference. If
NULL, the first treatment in sorted order is used.- model_type
One of
"multilevel","multivariate", or"wls".- heterogeneity
For
model_type = "multilevel", must be"flexible". Formodel_type = "multivariate", choose"common"or"flexible".- tau_components
For
model_type = "multilevel", choose"comparison"(default) or"treatment"random components.- nested_levels
Optional character vector of additional column names to append after
study_id/component_idin the multilevel random-effects nesting.- moderators
Optional moderators to include in both model types. Either a one-sided formula (e.g.,
~ age + risk) or a character vector of column names.- estimation_method
Estimation method passed to
mars.- varcov_type
Variance-covariance type passed to
mars.- within_varcov_type
For
model_type = "multivariate", optional override for within-study covariance estimation used inestimation. Defaults tovarcov_typewhen not provided.- sample_size
Optional sample-size column for multivariate mode.
- robustID
Optional cluster column name for cluster-robust standard errors (for example, study ID) in
model_type = "multivariate".- tau2
Optional user-supplied between-study variance or covariance passed to
mars/estimation. For multilevel network models, supply one value per random-effect component. For multivariate common heterogeneity, supply one value; for flexible diagonal heterogeneity, supply one value per comparison; or supply a positive semidefinite covariance matrix to use an unstructured multivariate heterogeneity covariance.- control
Optional named list of speed diagnostics controls. Supported entries are
use_sparse,reuse_inverses,parallel, andsingular_threshold.- ci_level
Confidence level for normal-approximation confidence intervals returned for direct, indirect, and total effects. Defaults to 0.95.
- optim_method
Optimization method passed to
mars.- tol
Optimization tolerance passed to
mars.- ...
Additional arguments passed to
mars.
Value
A list with class nma_mars containing fitted model output,
direct/indirect/total effects, incoherence-factor summaries,
contribution decomposition summaries, node-splitting summaries, design
inconsistency diagnostics, ranking outputs, and model-fit statistics.
Examples
# \donttest{
nma_dat <- data.frame(
study = c("S1", "S2", "S3", "S4"),
treatment_1 = c("A", "A", "B", "A"),
treatment_2 = c("B", "C", "C", "B"),
effect = c(0.20, 0.35, 0.10, 0.15),
variance = c(0.04, 0.05, 0.04, 0.06)
)
nma_fit <- network_meta(
nma_dat,
study_id = "study",
treatment_1 = "treatment_1",
treatment_2 = "treatment_2",
effect = "effect",
variance = "variance",
model_type = "wls"
)
summary(nma_fit)
#> Network Meta-analysis (MARS)
#> Model Type: wls
#> Heterogeneity: common
#> Reference: A
#> Treatments: A, B, C
#>
#> Evidence Summary:
#> $n_comparisons_total
#> [1] 3
#>
#> $n_comparisons_with_direct
#> [1] 3
#>
#> $n_comparisons_with_indirect
#> [1] 3
#>
#> $n_comparisons_indirect_only
#> [1] 0
#>
#> $n_direct_effects
#> [1] 4
#>
#> $n_indirect_effects
#> [1] 8
#>
#>
#> Incoherence-Factor Assessment:
#> Global test:
#> Q_incoherence df p_value
#> 1.593342 3 0.6609003
#>
#> Per-comparison incoherence factors:
#> treatment_1 treatment_2 incoherence_factor if_se z p_value
#> A B 0.1652632 0.2587419 0.6387182 0.5230063
#> A C 0.3807018 0.3578689 1.0638022 0.2874183
#> B C 0.0754386 0.3255225 0.2317462 0.8167352
#> ci_lower ci_upper
#> -0.3418616 0.672388
#> -0.3207085 1.082112
#> -0.5625738 0.713451
#>
#> Contribution Matrix (% information from direct comparisons):
#> A vs B A vs C B vs C
#> A vs B 92.87 3.17 3.96
#> A vs C 41.90 32.95 25.14
#> B vs C 28.30 13.58 58.12
#>
#> Model Fixed Effects (SE fallback applied when needed):
#> term estimate std_error z_value p_value se_source
#> d_B 0.1947368 0.1376494 1.414730 0.15714757 hessian
#> d_C 0.3192982 0.1675416 1.905785 0.05667807 hessian
#>
#> Fit Statistics:
#> model_type heterogeneity n_treatments n_edges estimator QE QE_df
#> <NA> <NA> 3 3 WLS 0.06798246 2
#> QE_p logLik Dev AIC BIC AICc
#> 0.96658 2.413702 -4.827404 -0.8274039 -2.054815 11.1726
#>
#> Node-Splitting Assessment:
#> Q_node_split df p_value
#> 1.593342 3 0.6609003
#>
#> treatment_1 treatment_2 direct indirect direct_indirect_diff diff_se
#> A B 0.18 0.01473684 0.1652632 0.2587419
#> A C 0.35 -0.03070175 0.3807018 0.3578689
#> B C 0.10 0.02456140 0.0754386 0.3255225
#> z p_value ci_lower ci_upper
#> 0.6387182 0.5230063 -0.3418616 0.672388
#> 1.0638022 0.2874183 -0.3207085 1.082112
#> 0.2317462 0.8167352 -0.5625738 0.713451
#>
#> Treatment Ranking:
#> treatment mean_effect std_error mean_rank median_rank sucra sucr_a p_best
#> C 0.3192982 0.1675416 1.2375 1 88.125 88.125 0.78100
#> B 0.1947368 0.1376494 1.8640 2 56.800 56.800 0.21325
#> A 0.0000000 0.0000000 2.8985 3 5.075 5.075 0.00575
#>
#> Contribution Decomposition (top rows):
#> Fixed-Effect Design Diagnostics:
#> $rank
#> [1] 2
#>
#> $ncol
#> [1] 2
#>
#> $condition_number
#> [1] 2.906201
#>
#> $info_condition_number
#> [1] 1.5
#>
#> $singular
#> [1] FALSE
#>
#> $near_singular
#> [1] FALSE
#>
#> $recommendation
#> [1] "No major fixed-effect rank/conditioning issues detected."
#>
#>
#> Treatment Order:
#> rank treatment effect_vs_reference
#> 1 C 0.3193
#> 2 B 0.1947
#> 3 A 0.0000
#>
#> Direct / Indirect / Total Effects:
#> treatment_1 treatment_2 direct direct_se direct_n_studies direct_n_effects
#> A B 0.18 0.1549 2 2
#> A C 0.35 0.2236 1 1
#> B C 0.10 0.2000 1 1
#> direct_observed direct_observed_se indirect indirect_se indirect_n_paths
#> 0.18 0.1549 0.0147 0.2072 1
#> 0.35 0.2236 -0.0307 0.2794 1
#> 0.10 0.2000 0.0246 0.2568 1
#> indirect_n_studies indirect_n_effects total total_se total_n_studies
#> 2 2 0.1947 0.1376 4
#> 3 3 0.3193 0.1675 4
#> 3 3 0.1246 0.1611 4
#> total_n_effects direct_ci_lower direct_ci_upper direct_observed_ci_lower
#> 4 -0.1236 0.4836 -0.1236
#> 4 -0.0883 0.7883 -0.0883
#> 4 -0.2920 0.4920 -0.2920
#> direct_observed_ci_upper indirect_ci_lower indirect_ci_upper total_ci_lower
#> 0.4836 -0.3914 0.4209 -0.0751
#> 0.7883 -0.5783 0.5169 -0.0091
#> 0.4920 -0.4788 0.5280 -0.1913
#> total_ci_upper
#> 0.4645
#> 0.6477
#> 0.4404
#>
#> Indirect SE note:
#> Indirect SEs are approximate; for mixed direct+indirect comparisons, var(indirect) is computed as var(total) + var(direct) assuming zero covariance.
#>
#> Heterogeneity Summary:
#> Overall Q:
#> $value
#> [1] 0.06798246
#>
#> $df
#> [1] 2
#>
#> $p
#> [1] 0.96658
#>
#>
#> Between-study variance (tau^2):
#> [1] component tau2
#> <0 rows> (or 0-length row.names)
#>
# }