
Zero/One-Inflated Beta Inference for Proportion Responses
Source:R/inference_proportion_zero_one_inflated_beta.R
InferencePropZeroOneInflatedBetaRegr.RdInternal class for non-KK zero/one-inflated beta regression models. The response is modeled as a three-component mixture with point masses at 0 and 1 plus a beta-distributed interior component on \((0, 1)\). The reported treatment effect is the treatment coefficient from the beta mean submodel, on the logit scale, conditional on the response falling strictly inside \((0, 1)\): it is not, and should not be read as, the effect on the unconditional mean \(E[Y]\), which also depends on how treatment shifts the zero/one inflation probabilities. A design where treatment moves mass between the point masses and the interior, with no shift in the interior beta mean, will report a null treatment coefficient here even though \(E[Y]\) changed.
The beta mean submodel uses treatment alone in the univariate class and
treatment plus covariates in the multivariate class. The zero/one inflation
submodels use model_formula_zero_one, which defaults to ~ .
so that treatment plus all available covariates enter those auxiliary pieces.
See the class-level description above for what the reported coefficient does
and does not represent.
Marginal estimand. This class composes
MarginalEstimand
(set_estimand()/get_estimand()/get_supported_estimands());
in addition to the default "conditional" estimand described above, it
supports "marginal_mean_diff": the model-implied unconditional mean
recombines all three mixture components,
\(E[Y \mid x, w] = \pi_1(x, w) \cdot 1 + (1 - \pi_0(x, w) - \pi_1(x, w))
\cdot \mathrm{logit}^{-1}(x^\top \beta + \beta_T w)\) (the zero mass
contributes nothing), where \(\pi_0\)/\(\pi_1\) are the normalized
zero/one-inflation mixture probabilities. The reported treatment effect
under "marginal_mean_diff" is the g-computation average
\(\hat\tau = n^{-1} \sum_i [\hat E(Y \mid x_i, w=1) - \hat E(Y \mid x_i,
w=0)]\), on the response's natural \([0,1]\) scale (not the log-odds
scale of the conditional estimand). Standard errors are delta-method,
against the joint covariance of \([\beta, \log\phi, \gamma_0, \gamma_1]\)
already returned by fast_zero_one_inflated_beta_cpp, using a
numerical (central-difference) gradient of \(\hat\tau\) — see
marginal_estimand_report.md → TODO-4 for why analytic
differentiation was not used. This is a pure post-fit transform of the same
cached maximum-likelihood fit (no refit), so only Wald-via-delta-method
inference is available under a marginal estimand (no likelihood-ratio/
score/gradient test — see set_estimand()'s testing-type
interaction).
References
Ospina, R., and Ferrari, S. L. P. (2010). "Inflated beta distributions." Statistical Papers, 51(1), 111-126, doi:10.1007/s00362-008-0125-4 , for the zero/one-inflated beta mixture density; Ferrari, S., and Cribari-Neto, F. (2004). "Beta regression for modelling rates and proportions." Journal of Applied Statistics, 31(7), 799-815, doi:10.1080/0266476042000214501 , for the interior beta-regression submodel.
See also
InferencePropBetaRegr
for the plain (non-inflated) beta regression model.
Super class
Inference -> InferencePropZeroOneInflatedBetaRegr
Methods
Public methods
+ inherited public methods from Inference
Inference$capabilities()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_model_formula()Inference$get_nonestimable_reason()Inference$get_nonestimable_stage()Inference$get_optimization_alg()Inference$get_response()Inference$get_response_type()Inference$get_treatment()Inference$is_nonestimable()Inference$set_optimization_alg()Inference$set_seed()Inference$supports()
InferencePropZeroOneInflatedBetaRegr$new()
Initialize inference for the three-component zero/one-inflated
beta mixture model; see
InferencePropZeroOneInflatedBetaRegr
for the model form and the important caveat that the reported treatment
coefficient is conditional on the interior \((0,1)\) component, not an
unconditional-mean effect. Does not fit the model; the fit is deferred to
the first call to compute_estimate() or a method that requires it.
Usage
InferencePropZeroOneInflatedBetaRegr$new(
des_obj,
model_formula = NULL,
model_formula_zero_one = NULL,
verbose = FALSE,
smart_cold_start_default = NULL
)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.model_formula_zero_oneFormula for the zero/one inflation submodels. Defaults to
~ ., meaning treatment plus all available covariates.verboseWhether to print progress messages.
smart_cold_start_defaultWhether to use smart cold start values.
InferencePropZeroOneInflatedBetaRegr$compute_estimate()
Fits the zero/one-inflated beta mixture model by maximum
likelihood (jointly the beta mean submodel, the zero/one inflation
submodels, and the beta precision). Under the default
estimand = "conditional", returns \(\hat\beta_T\), the
treatment log-odds-ratio from the beta mean submodel conditional
on the interior \((0,1)\) component — see
InferencePropZeroOneInflatedBetaRegr's
estimand caveat. Under estimand = "marginal_mean_diff" (set via
set_estimand()), returns the g-computation marginal mean
difference instead — see the class-level @details for the
formula. The underlying model fit is identical either way (a pure
post-fit transform of the same cached fit, no refit).
InferencePropZeroOneInflatedBetaRegr$compute_asymp_confidence_interval()
Wald confidence interval, dispatched by
testing_type for the conditional estimand (score/gradient/
likelihood-ratio/Bartlett available; see
InferenceAsympLik); under a
marginal estimand testing_type is always "wald" (the
only value set_estimand() permits there), so this always
resolves to the delta-method interval. Calls
self$compute_estimate() first (not
private$shared() directly) so the estimand-aware cache is
always current regardless of call order.
InferencePropZeroOneInflatedBetaRegr$compute_asymp_two_sided_pval()
Wald two-sided p-value, dispatched by testing_type
exactly as compute_asymp_confidence_interval(); see that
method's description for the marginal-estimand always-Wald note.
InferencePropZeroOneInflatedBetaRegr$compute_estimate_with_bootstrap_weights()
Refits the zero/one-inflated beta model with subject/block-level
weights applied to the fitting log-likelihood (Bayesian-bootstrap or
nonparametric-bootstrap draw weights, expanded to row level via
private$expand_subject_or_block_weights_to_row_weights()), and
returns the reweighted conditional log-odds-ratio estimate
\(\hat\beta_T^{(w)}\).
Examples
# \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 = InferencePropZeroOneInflatedBetaRegr$new(seq_des)
inf$compute_estimate()
#> [1] 0.2433734
# }