
Quantile Regression Inference for Proportion Responses
Source:R/inference_proportion_quantile_regr.R
InferencePropQuantileRegr.RdFits a quantile regression for proportion responses (constrained to (0, 1)) using
the treatment indicator and, optionally, all recorded covariates as predictors.
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, so the estimated treatment effect is a log-odds-ratio
shift at quantile tau; by default tau = 0.5, so this is a median
log-odds-ratio shift.
Fitting is via quantreg (method "fn", the Frisch-Newton interior-point
algorithm, for both the estimate-only rq.fit call and the variance-computing
rq fit; the Bayesian-bootstrap reweighted fit uses
rq's default "br" method) on logit(y) ~ w + covariates
with no intercept column (the design matrix already carries one). Standard errors use
quantreg's Powell (1991) kernel sandwich "nid" estimator (heteroskedasticity-
and design-robust, valid under non-i.i.d. errors) when available, falling back to the
i.i.d.-errors "iid" estimator if "nid" extraction fails. The asymptotic
CI/p-value paths are Wald-type (estimate divided by this standard error, not a
resampling-based reference distribution):
compute_asymp_confidence_interval/compute_asymp_two_sided_pval use the
fit's residual degrees of freedom \(n - p\) in a \(t\)-reference (via
compute_z_or_t_ci_from_s_and_df) rather than a plain normal reference, so the
interval/test remain slightly conservative in small samples relative to a bare Wald z.
This class requires the quantreg package, which is listed under
Suggests and is not installed automatically with EDI.
Install quantreg manually before use. Only uncensored proportion responses are
supported (checked via assertNoCensoring at construction).
Small-sample behaviour
How fast the size (and coverage) error of each procedure is expected to vanish as the
effective sample size \(n_{eff}\) grows, from EDI's convergence-rate registry
(inference_convergence_expectation()). Exact procedures are valid at every
n by construction; the others are asymptotic, so a small-sample excess is expected, and
its constant is not given by an order. The table is the expectation for a balanced
complete-randomization design; it is not a measured size. Reference keys are explained
under References.
| Procedure | Regime | Error order | Effective n | Regularity | Basis | References |
rand | finite sample | exact | subjects | regular | theory | [Fisher1935], [LehmannRomano2005] |
wald | asymptotic | \(O(n_{eff}^{-2/3})\) | subjects | nonparametric rate | literature | [HallSheather1988], [Koenker1994], [Koenker2005] |
jackknife | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [ShaoTu1995] |
bootstrap | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Hall1992] |
bayes_boot | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Rubin1981], [Lo1987] |
rand_bootstrap | asymptotic | \(O(n_{eff}^{-1})\) | subjects | regular | assumed default | [Hall1992], [Kallus2018] |
The point estimate's bias is of order \(O(n_{eff}^{-1})\) (assumed default: [CoxSnell1968]).
Rows with basis assumed default: the order shown is the procedure's rate in a regular parametric model, and the cited works establish it for that case only. EDI has not derived it for this class.
Regularity nonparametric rate: the standard error needs a nonparametric (kernel sparsity) estimate, so the rate is slower than the parametric one.
Design-specific differences from the table:
On any design with unequal allocation (
prob_Tnot 0.5), forwald,jackknife,bootstrap,bayes_boot,rand_bootstrap: the effective n is the size of the smaller arm.On
DesignFixedBlockedCluster,DesignFixedCluster, forwald,jackknife,bootstrap,bayes_boot,rand_bootstrap: the effective n is the number of clusters.
Blocking designs
On a blocking design
(DesignFixedBlocking and relatives)
the regression-type inference classes do not add block fixed effects
(or block-by-treatment interactions) automatically: the model uses only the
covariate matrix. Whether the blocks enter the regression therefore depends
on how they were supplied: not at all with m=; as dummies when the
blocking column is a factor/character (or few-level integer) covariate; as a
single linear term when it is numeric. Randomization, bootstrap and
jackknife inference are block-aware regardless; only the model-based
(asymptotic, likelihood) path ignores the blocks.
When the proportion treated is the same in every block, the pooled
treatment estimate of a linear model is unbiased and its model-based SE is
conservative (it is inflated by the block variation it fails to remove), at a
cost in power. If the proportion treated differs across blocks (for example
equal_block_sizes = FALSE with very small blocks and an extreme
prob_T, where per-block rounding changes the allocation, or a
user-supplied m), the pooled treated-vs-control comparison is
confounded by block (Simpson's paradox) and can be biased; then include the
blocking covariate(s) explicitly as factor covariates. For non-linear models
(GLM, ordinal, survival) omitting blocks changes the estimand to a
block-marginal effect. See DesignFixedBlocking.
References
Koenker, R. and Bassett, G. (1978). "Regression Quantiles."
Econometrica, 46(1), 33-50, doi:10.2307/1913643
, for quantile regression itself.
Powell, J. L. (1991). "Estimation of Monotonic Regression Models under Quantile
Restrictions," in Nonparametric and Semiparametric Methods in Econometrics and
Statistics, Cambridge University Press, for the "nid" sandwich standard error.
[Fisher1935] Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.
[LehmannRomano2005] Lehmann, E. L., and Romano, J. P. (2005). Testing Statistical Hypotheses (3rd ed.). Springer.
[HallSheather1988] Hall, P., and Sheather, S. J. (1988). "On the Distribution of a Studentized Quantile." Journal of the Royal Statistical Society: Series B, 50(3), 381-391.
[Koenker1994] Koenker, R. (1994). "Confidence Intervals for Regression Quantiles." In P. Mandl and M. Huskova (eds.), Asymptotic Statistics: Proceedings of the Fifth Prague Symposium on Asymptotic Statistics, 349-359. Physica-Verlag.
[Koenker2005] Koenker, R. (2005). Quantile Regression. Cambridge University Press.
[ShaoTu1995] Shao, J., and Tu, D. (1995). The Jackknife and Bootstrap. Springer.
[Hall1992] Hall, P. (1992). The Bootstrap and Edgeworth Expansion. Springer.
[Rubin1981] Rubin, D. B. (1981). "The Bayesian Bootstrap." The Annals of Statistics, 9(1), 130-134.
[Lo1987] Lo, A. Y. (1987). "A Large Sample Study of the Bayesian Bootstrap." The Annals of Statistics, 15(1), 360-375.
[Kallus2018] Kallus, N. (2018). "Optimal a priori balance in the design of controlled experiments." Journal of the Royal Statistical Society: Series B, 80(1), 85-112. Section 5 ("Algorithms for inference"), Algorithm 4.
[CoxSnell1968] Cox, D. R., and Snell, E. J. (1968). "A General Definition of Residuals." Journal of the Royal Statistical Society: Series B, 30(2), 248-265 (discussion 265-275).
See also
InferenceContinQuantileRegr for the
untransformed (continuous-scale) analogue of this class.
Super class
Inference -> InferencePropQuantileRegr
Methods
+ inherited public methods from Inference
Inference$capabilities()Inference$clear_randomization_cache()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()
InferencePropQuantileRegr$new()
Uses the shared randomization two-sided p-value contract; see
InferenceRand.
Initialize a quantile-regression inference object for a completed design with a proportion response.
Usage
InferencePropQuantileRegr$new(
des_obj,
model_formula = NULL,
tau = 0.5,
verbose = FALSE
)Arguments
des_objA completed
Designobject with a proportion response.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 to estimate. Default 0.5.
verboseWhether to print progress messages. Default FALSE.
InferencePropQuantileRegr$compute_estimate()
Computes the fitted treatment coefficient of the tau-quantile
regression of logit(y) on the treatment indicator (plus any adjustment
covariates) — a log-odds-ratio shift at quantile tau of the
proportion response, not a difference in means or in the raw-scale quantile.
Caches beta_hat_T (and, unless estimate_only, the standard error
and residual degrees of freedom) so repeated calls are cheap; returns
NA_real_ if the reduced design matrix is degenerate (fewer usable rows
than columns) or the quantreg fit fails/errors.
InferencePropQuantileRegr$compute_estimate_with_bootstrap_weights()
Recomputes compute_estimate's treatment log-odds-ratio-shift
coefficient with each subject's (or block's) contribution to the tau-quantile
fit reweighted by subject_or_block_weights (expanded to per-row weights and
passed as quantreg::rq(..., weights = ...)), for the Bayesian bootstrap
contract; see InferenceBayesianBootstrap.
The call runs inside the package's weighted-refit isolation wrapper, which
restores the cached values afterwards, so a later compute_estimate()
still returns the original-data estimate. Returns
NA_real_ under the same degenerate-design/fit-failure conditions as
compute_estimate.
InferencePropQuantileRegr$compute_asymp_confidence_interval()
Uses the shared asymptotic confidence-interval contract; see
InferenceAsymp.
InferencePropQuantileRegr$compute_asymp_two_sided_pval()
Uses the shared asymptotic two-sided p-value contract; see
InferenceAsymp.
Examples
if (requireNamespace("quantreg", quietly = TRUE)) {
# \donttest{
seq_des = DesignSeqOneByOneBernoulli$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)))
}
seq_des$add_all_subject_responses(runif(10))
inf = InferencePropQuantileRegr$new(seq_des)
inf$compute_estimate()
# }
}
#> [1] 1.469222