
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 plus the covariates given by
model_formula. The zero/one inflation submodels use
model_formula_zero_one; if that is NULL (default), they use
model_formula when it is supplied and otherwise ~ ., 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).
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 | unknown | subjects | mixture | unknown | [SelfLiang1987] |
jackknife | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
score | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
lik_ratio | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
gradient | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
lik_ratio_bartlett_approx | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
lik_ratio_bartlett_exact | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
param_boot | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
param_boot_direct | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
bootstrap | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
bayes_boot | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
rand_bootstrap | asymptotic | unknown | subjects | mixture | unknown | [SelfLiang1987] |
The point estimate's bias is of order \(O(n_{eff}^{-1})\) (assumed default: [CoxSnell1968]).
Rows with order unknown: no rate is known for this class and procedure, so none is claimed; the cited works describe the non-standard limit, not a rate. Expect a small-sample excess of unquantified size.
Regularity mixture: the mixing probability can sit on the boundary and the information can be singular.
The procedure list is by declared capability; an object can still report a procedure
(for example a Bartlett correction) as unavailable through get_supported_testing_types().
Design-specific differences from the table:
On any design with unequal allocation (
prob_Tnot 0.5), forwald,jackknife,score,lik_ratio,gradient,lik_ratio_bartlett_approx,lik_ratio_bartlett_exact,param_boot,param_boot_direct,bootstrap,bayes_boot,rand_bootstrap: the effective n is the size of the smaller arm.On
DesignFixedBlockedCluster,DesignFixedCluster, forwald,jackknife,score,lik_ratio,gradient,lik_ratio_bartlett_approx,lik_ratio_bartlett_exact,param_boot,param_boot_direct,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
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.
[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.
[SelfLiang1987] Self, S. G., and Liang, K.-Y. (1987). "Asymptotic Properties of Maximum Likelihood Estimators and Likelihood Ratio Tests under Nonstandard Conditions." Journal of the American Statistical Association, 82(398), 605-610.
[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
InferencePropBetaRegr
for the plain (non-inflated) beta regression model.
Super class
Inference -> InferencePropZeroOneInflatedBetaRegr
Methods
Public 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()
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. If
NULL(default), usesmodel_formulawhen it is supplied and otherwise~ ., 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()
Weighted refit for the bootstrap contract. The
subject/block-level weights (Bayesian-bootstrap or
nonparametric-bootstrap draw weights) are expanded to row level via
private$expand_subject_or_block_weights_to_row_weights(). This is
not a weighted joint maximum-likelihood fit of the
zero/one-inflated beta model; the parts are refit separately:
two weighted logistic regressions, of \(1(y = 0)\) and of \(1(y = 1)\), on the zero/one design matrix;
a weighted
betareg::betareg()fit on the interior rows \(0 < y < 1\) only. If betareg is not installed, the fit errors, or its treatment coefficient is not finite, it falls back to a weighted least-squares fit (stats::lm.wfit) of \(\mathrm{logit}(y)\) on the interior rows.
Under the default conditional estimand it returns the treatment
coefficient of that interior-row fit, a log-odds-ratio
\(\hat\beta_T^{(w)}\). Under estimand = "marginal_mean_diff" it
returns the g-computation marginal mean difference built from the
three reweighted fits (when both logistic fits succeed). Because the
parts are fit separately, even unit weights do not reproduce the joint
MLE that compute_estimate() returns (see v1.2.0-TODO-250).
No standard error is computed; returns NA_real_ when there are
no interior rows or every fit fails.
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] -1.649269
# }