Skip to contents

Fits a compound (inverse-variance-weighted combination, "IVWC") mean-difference estimator of the treatment effect for continuous responses under a DesignSeqOneByOne-family KK matching-on-the-fly design (see DesignSeqOneByOneKK14 and DesignSeqOneByOneKK21). Such a design produces two structurally different kinds of subjects: subjects successfully matched into pairs during the sequential design, and unmatched "reservoir" subjects randomized independently. This estimator combines both: $$\hat\beta_T = w^* \bar d + (1 - w^*)\, \bar r, \qquad w^* = \frac{\widehat{\mathrm{Var}}(\bar r)}{\widehat{\mathrm{Var}}(\bar r) + \widehat{\mathrm{Var}}(\bar d)},$$ where \(\bar d\) is the mean within-pair (treated minus control) difference among matched subjects and \(\bar r\) is the treated-minus-control difference in means among reservoir subjects, weighted inversely by their estimated variances (see $compute_asymp_confidence_interval() for the full variance formula and the fallback behavior when only one of the two sub-estimates is usable). Inference is Wald-only: this class has no likelihood tier (likelihood_tier = "none") and provides asymptotic Wald, randomization, and bootstrap (including Bayesian bootstrap) confidence intervals and p-values, but no score/likelihood-ratio/gradient tests.

Initialize KK IVWC mean-difference inference.

Computes the compound IVWC (inverse-variance-weighted compound) mean-difference point estimate \(\hat\beta_T\): the inverse-variance-weighted combination \(w^* \bar d + (1-w^*)\, \bar r\) of the matched-pair mean within-pair difference \(\bar d\) and the reservoir treated-minus-control mean difference \(\bar r\), falling back to whichever of the two is usable if the other is not (see $compute_asymp_confidence_interval() for the full weighting formula and usability conditions).

Computes a \(1-\alpha\) level frequentist confidence interval for the compound IVWC (inverse-variance-weighted compound) mean-difference estimator \(\hat\beta_T\).

Computes a two-sided Wald p-value for the compound IVWC mean-difference estimator \(\hat\beta_T\) testing \(H_0: \beta_T = \code{delta}\), using the same asymptotically-normal point estimate and standard error (\(z = (\hat\beta_T - \code{delta})/\widehat{\mathrm{SE}}(\hat\beta_T)\)) that $compute_asymp_confidence_interval() inverts to form its interval — see that method's documentation for the full inverse-variance-weighted combination formula. This class has no likelihood tier (likelihood_tier = "none"), so no score, likelihood-ratio, or gradient test is available here; this is a plain Wald test, not a likelihood-backed one.

Value

The setting-appropriate (see description) numeric estimate of the treatment effect

A (1 - alpha)-sized frequentist confidence interval for the treatment effect

The approximate frequentist p-value

Details

The point estimate combines two sub-estimates depending on which are usable: the mean within-pair difference among matched subjects, \(\bar d\), with estimated variance \(\widehat{\mathrm{Var}}(\bar d)\), and the treated-minus-control difference in means among reservoir (unmatched) subjects, \(\bar r\), with estimated variance \(\widehat{\mathrm{Var}}(\bar r)\). When both are usable (at least 2 matched pairs and at least 2 treated/2 control reservoir subjects, with finite positive variance estimates), they are combined by classical inverse-variance weighting, $$\hat\beta_T = w^* \bar d + (1 - w^*)\, \bar r, \qquad w^* = \frac{\widehat{\mathrm{Var}}(\bar r)}{\widehat{\mathrm{Var}}(\bar r) + \widehat{\mathrm{Var}}(\bar d)},$$ with combined variance the standard inverse-variance-pooled form \(\widehat{\mathrm{Var}}(\hat\beta_T) = \left(\widehat{\mathrm{Var}}(\bar r)^{-1} + \widehat{\mathrm{Var}}(\bar d)^{-1}\right)^{-1} = \widehat{\mathrm{Var}}(\bar r)\,\widehat{\mathrm{Var}}(\bar d) \big/ \left(\widehat{\mathrm{Var}}(\bar r) + \widehat{\mathrm{Var}}(\bar d)\right)\). If only one of the two sub-estimates is usable (e.g. the reservoir is empty or degenerate, or no pairs matched), \(\hat\beta_T\) and its variance fall back to that sub-estimate alone. The compound estimator is treated as asymptotically normal, so the interval is \(\hat\beta_T \pm z_{1-\alpha/2}\sqrt{\widehat{\mathrm{Var}}(\hat\beta_T)}\) (or a \(t\)-based critical value, depending on private$compute_z_or_t_ci_from_s_and_df's degrees-of-freedom resolution).

Legacy status

Legacy class. Not fully tested in comprehensive_tests.R; prefer a more actively maintained KK continuous-response inference class (e.g. InferenceContinKKOLSIVWC) for new analyses unless this specific unadjusted mean-difference estimator is required.

References

Kapelner, A., and Krieger, A. M. (2014). "Matching on-the-fly: Sequential allocation with higher power and efficiency." Biometrics, 70(2), 378-388, doi:10.1111/biom.12148 , for the KK matching-on-the-fly design this estimator targets, and for the inverse-variance combination of matched-pair and reservoir estimates.

Super class

Inference -> InferenceAllKKMeanDiffIVWC

Methods

+ inherited public methods from Inference


InferenceAllKKMeanDiffIVWC$new()

Usage

InferenceAllKKMeanDiffIVWC$new(
  des_obj,
  verbose = FALSE,
  harden = TRUE,
  model_formula = NULL,
  smart_cold_start_default = NULL
)

Arguments

des_obj

A KK matching-on-the-fly design object.

verbose

Whether to print progress messages.

harden

Whether to use hardened model-matrix fitting.

model_formula

Optional formula for covariate adjustment.

smart_cold_start_default

Whether to use smart cold start values.


InferenceAllKKMeanDiffIVWC$compute_estimate()

Usage

InferenceAllKKMeanDiffIVWC$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, compute only the point estimate \(\hat\beta_T\) and skip the variance-component computations needed for confidence intervals or p-values (faster when only the point estimate is needed).


InferenceAllKKMeanDiffIVWC$compute_asymp_confidence_interval()

Usage

InferenceAllKKMeanDiffIVWC$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

The confidence level in the computed confidence interval is 1 - alpha. The default is 0.05.


InferenceAllKKMeanDiffIVWC$compute_asymp_two_sided_pval()

Usage

InferenceAllKKMeanDiffIVWC$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

The null difference to test against. For any treatment effect at all this is set to zero (the default).


InferenceAllKKMeanDiffIVWC$clone()

The objects of this class are cloneable with this method.

Usage

InferenceAllKKMeanDiffIVWC$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

seq_des = DesignSeqOneByOneKK14$new(n = 6, response_type = "continuous")
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[1, 2 : 10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[2, 2 : 10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[3, 2 : 10])
#> [1] 1
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[4, 2 : 10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[5, 2 : 10])
#> [1] 0
seq_des$add_one_subject_to_experiment_and_assign(MASS::biopsy[6, 2 : 10])
#> [1] 1
seq_des$add_all_subject_responses(c(4.71, 1.23, 4.78, 6.11, 5.95, 8.43))

seq_des_inf = InferenceAllKKMeanDiffIVWC$
  new(seq_des)
seq_des_inf$compute_estimate()
#> [1] 2.105
seq_des_inf$compute_asymp_confidence_interval()
#>      2.5%     97.5% 
#> -1.884097  6.094097 
seq_des_inf$compute_asymp_two_sided_pval()
#> [1] 0.3010192