
Sensitivity of a substantive contrast to bounded methodological departures
masmr_sensitivity.RdSensitivity of a substantive contrast to bounded methodological departures
Usage
masmr_sensitivity(
object,
substantive,
methodology,
departures,
bounds,
target_weights = NULL,
outcome = NULL,
covariance = c("fitted", "known", "refit"),
total_covariance = NULL,
inference = c("model", "KH", "mKH", "robust"),
level = 0.95,
grid = NULL,
threshold = 0,
rank_tol = 1e-09,
adjustment = c("none", "bonferroni")
)Arguments
- object
Fitted MASMR object with target-design support.
- substantive, methodology, target_weights, outcome
Target arguments as in
masmr_contrast(). Omit outcome to return each multivariate outcome separately.- departures
A
masmr_departures()specification.- bounds
Scientifically described
masmr_bounds()object; names must match the evaluated departure columns, including outcome prefixes.- covariance
"fitted"freezes fitted weights (approximate inference);"known"requires a known total covariance;"refit"re-estimates heterogeneity at specified departure values with sampling covariance fixed.- total_covariance
Known total covariance in analysis_data row order, only for covariance="known". Includes sampling covariance AND heterogeneity.
- inference
"model","KH","mKH", or"robust". Known-covariance normal inference uses model only. KH variants require independent records.- level
Confidence level.
- grid
Optional explicit departure grid (matrix with named columns). Required for refit; robust/KH fitted-weight intervals also require a grid. Such envelopes cover the declared finite grid only, not a continuous box.
- threshold
Substantive threshold in analysis-scale effect units, scalar or named per returned outcome.
- rank_tol
Relative singular-value tolerance for structural diagnostics.
- adjustment
Multiplicity control: none (pointwise) or bonferroni across returned outcome targets. Known-normal guarantees require fixed targets.
Value
A masmr_sensitivity object with result, distortion components, estimability, information, target, bounds and optional grid evaluations.
Details
With \(A=(X'WX)^{-1}X'W\), \(D=LAQ-K\) and bias \(D\gamma\), the fixed-weight corrected estimate is \(LAy-D\gamma\). Box bounds give exact point ranges. Normal known-covariance union envelopes have at least nominal pointwise coverage if the true departure is inside the fixed class and errors are normal. Fitted and refit intervals are approximate. Bounds are not learned from the outcome; data-dependent elicitation is outside that guarantee. This is sensitivity to specified functions of recorded moderators, not correction for arbitrary unmeasured confounding or a new regression estimator. Different outcome scales are never averaged or silently back-transformed.
With shared EM-completed predictors, results have
inference_status = "conditional_single_completion", including
known-covariance calculations. Imputation uncertainty is not propagated;
known covariance does not supply an unconditional missing-data guarantee.
Examples
dat <- data.frame(study = 1:18, S = rep(c(0, 1, 0), each = 6),
M = rep(c(0, 0, 1), each = 6), vi = .0075)
dat$yi <- .20 + .15 * dat$S - .05 * dat$M + rep(seq(-.02, .02, length.out = 6), 3)
fit <- masmr(dat, "M", "S", formula = yi ~ 1, studyID = "study",
variance = "vi", varcov_type = "univariate", measure = "SMD",
structure = "univariate", tau2 = 0)
target <- list(A = data.frame(S = 0), B = data.frame(S = 1))
bounds <- masmr_bounds(
lower = c("S:M" = -.1), upper = c("S:M" = .1),
meaning = "Assessment-by-group interaction", units = "SMD",
justification = "Illustrative bounds on a binary interaction",
source = "Constructed example", status = "elicited",
analysis_scale = "standardized_mean_difference"
)
masmr_sensitivity(fit, target, data.frame(M = 1),
masmr_departures(~ S:M), bounds)$result
#> outcome estimate std_error point_low point_high conf_low conf_high
#> B effect 0.15 0.05 0.05 0.25 -0.0479982 0.3479982
#> max_abs_distortion undetectable_shift_bound bounded_normal_low
#> B 0.1 0.1 -0.03224269
#> bounded_normal_high threshold interval_change_multiplier expanded_estimable
#> B 0.3322427 0 0.520018 FALSE
#> covariance interval_scope inference_status
#> B fitted continuous_box approximate