
Quantile Regression Compound Estimator for KK Matching-on-the-Fly Designs (Proportion Outcomes)
Source:R/inference_proportion_KK_quantile_regr_ivwc.R
InferencePropKKQuantileRegrIVWC.RdA variance-weighted compound quantile regression estimator for KK matching-on-the-fly designs with proportion responses. Inference is performed on the logit (log-odds) scale: responses \(y \in (0,1)\) are transformed via \(\text{logit}(y) = \log(y/(1-y))\) before quantile regression.
The estimator combines:
Quantile regression on logit-scale within-pair differences \(\text{logit}(y_T) - \text{logit}(y_C)\) (matched pairs)
Quantile regression of \(\text{logit}(y)\) on treatment and covariates (reservoir)
using the same variance-weighted combination logic as the OLS compound estimator.
The estimated treatment effect is a log-odds-ratio shift at quantile tau.
Default quantile: tau = 0.5 (median regression).
To target a different quantile — for example the 25th or 75th percentile — pass
tau = 0.25 or tau = 0.75 to the constructor:
inf = InferencePropKKQuantileRegrIVWC$
new(seq_des, tau = 0.75)Any value strictly between 0 and 1 is accepted.
Standard errors use Powell's "nid" sandwich estimator (non-iid), falling back to "iid" on failure. Asymptotic z-based inference is used throughout.
This class requires the quantreg package, which is listed in Suggests and is not installed automatically with EDI. Install quantreg before using this class.
Legacy class. Not fully tested in comprehensive_tests.R.
Bayesian bootstrap. Each Bayesian-bootstrap replicate is a weighted refit of
this estimator: under the draw's Dirichlet weights (a matched pair's weight is the mean
of its two subjects' row weights) both halves are refit by weighted
quantile regression (quantreg::rq(weights = )) (on the logit scale). Each half's standard error comes
from its weighted fit (the "nid" sandwich, then "iid", then a weighted-IQR
fallback) and the two halves are pooled by inverse variance exactly as in
compute_estimate(). Units with a zero weight, or one below \(10^{-10}\) times the
mean weight, are dropped from the refit; the
remaining weights are rescaled to mean 1 (the coefficients do not depend on the scale, and
uniform weights then reproduce the unweighted fit and its standard errors).
Super class
Inference -> InferencePropKKQuantileRegrIVWC
Methods
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()Inference$compute_asymp_confidence_interval()Inference$compute_asymp_two_sided_pval()Inference$compute_estimate()Inference$compute_exact_confidence_interval()Inference$compute_exact_two_sided_pval_for_treatment_effect()Inference$duplicate()Inference$get_analysis_data()Inference$get_covariates()Inference$get_design_object()Inference$get_estimand()Inference$get_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_procedure_validity()Inference$get_response()Inference$get_response_type()Inference$get_summary()Inference$get_supported_estimands()Inference$get_treatment()Inference$is_nonestimable()Inference$set_estimand()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferencePropKKQuantileRegrIVWC$new()
Initialize proportion-response KK IVWC quantile-regression
inference on the logit response scale; see
InferencePropKKQuantileRegrIVWC.
Usage
InferencePropKKQuantileRegrIVWC$new(
des_obj,
model_formula = NULL,
tau = 0.5,
verbose = FALSE,
smart_cold_start_default = NULL
)Arguments
des_objA DesignSeqOneByOne object whose entire n subjects are assigned and response y is recorded within.
model_formulaOptional formula for covariate adjustment. If
NULL(default), the formula from the design object is used and its pre-computed design matrix is reused. If a formula is provided, a new design matrix is constructed from the design's imputed covariates.tauThe quantile level for regression on the logit scale, strictly between 0 and 1. The default
tau = 0.5estimates the median log-odds-ratio treatment effect. Pass a different value (e.g.tau = 0.25ortau = 0.75) to target a different percentile of the treatment effect distribution.verboseA flag indicating whether messages should be displayed to the user. Default is
FALSE.smart_cold_start_defaultWhether to use smart cold start values.
Examples
if (requireNamespace("quantreg", quietly = TRUE)) {
# \donttest{
seq_des = DesignSeqOneByOneKK14$new(n = 10, response_type = 'proportion')
for (i in 1:10) {
seq_des$add_one_subject_to_experiment_and_assign(data.frame(x1 = rnorm(1), x2 = rnorm(1)))
}
seq_des$add_all_subject_responses(runif(10))
inf = InferencePropKKQuantileRegrIVWC$new(seq_des)
inf$compute_estimate()
# }
}
#> [1] 1.302767