Skip to contents

Fits Ferrari and Cribari-Neto's (2004) beta regression for proportion responses \(Y_i \in (0, 1)\): \(\mathrm{logit}(E[Y_i \mid w_i, x_i]) = \beta_0 + \beta_T w_i + x_i^\top \gamma\), \(Y_i \mid w_i, x_i \sim \mathrm{Beta}(\mu_i \phi, (1-\mu_i)\phi)\) for fitted mean \(\mu_i\) and a single (constant, not covariate-dependent) precision parameter \(\phi\), by maximum likelihood (fast_beta_regression_cpp/ fast_beta_regression_weighted_cpp). \(\hat\beta_T\) is a log-odds-ratio on the conditional-mean scale: \(\exp(\hat\beta_T)\) is the odds ratio for the expected proportion. Unlike InferencePropFractionalLogit's quasi-likelihood (which specifies only the conditional mean), beta regression also specifies the conditional variance/shape via \(\phi\) — a correctly specified beta model yields a fully efficient likelihood-based fit and genuine likelihood-ratio/score/gradient tests, at the cost of requiring the beta-distribution shape assumption to actually hold. likelihood_tier = "full": likelihood-ratio, score, gradient, and Wald tests are all available when the model converges, plus parametric-likelihood-bootstrap calibration of the likelihood-ratio test.

Responses of exactly 0 or 1. The beta density is zero at 0 and 1. When at least one recorded \(Y_i\) is exactly 0 or 1, the class replaces every response, the interior ones too, by the Smithson-Verkuilen (2006) squeeze \(Y_i' = \{Y_i (n - 1) + 1/2\} / n\), where \(n\) is the number of subjects, and fits the model to \(Y'\) (values still at 0 or 1 after that are clamped to machine epsilon from the boundary). When every \(Y_i\) lies strictly inside \((0, 1)\), the responses are used unchanged. The same rule is applied each time the class fits the model to recorded responses: the estimate, the Wald and likelihood tests, and the bootstrap and randomization refits (each on the responses that refit uses). It is applied with no warning or message. With many boundary values it can move the estimate far from a fit to the interior responses alone, and even change its sign, because the 0s and 1s become extreme but finite observations of the beta mean. For data with exact 0s or 1s, prefer InferencePropFractionalLogit, whose quasi-likelihood fits 0 and 1 as they are, or InferencePropZeroOneInflatedBetaRegr, which models the boundary values separately.

Known limitation: many covariates relative to \(n\). With a large adjustment set the model-based standard error is anti-conservative. In EDI's comprehensive simulations on a 33-covariate dataset with \(n = 148\) (model_formula = ~ .), the Wald and other model-based intervals covered about 0.79-0.85 at nominal 0.95, while the resampling-based intervals over-covered. No small-sample SE correction is applied; with many covariates relative to \(n\), prefer a smaller adjustment set or a resampling interval.

Estimand. Composes MarginalEstimand (set_estimand()/get_estimand()/get_supported_estimands()). Under the default estimand = "conditional", \(\hat\beta_T\) is the log-odds-ratio above. Under estimand = "marginal_mean_diff", the reported quantity is instead the g-computation marginal mean difference \(\frac{1}{n}\sum_i \{\mathrm{plogis}(\hat\beta_0 + \hat\beta_T + X_i^\top \hat\gamma) - \mathrm{plogis}(\hat\beta_0 + X_i^\top \hat\gamma)\}\) (the precision parameter \(\phi\) does not enter the mean, so it plays no role in this functional). Only "marginal_mean_diff" is supported — a ratio of two mean proportions, both bounded in \([0,1]\), is not the standard estimand for a beta-regression treatment effect the way a rate ratio is for count data. Because there is no latent submodel for this family (unlike e.g. InferencePropZeroOneInflatedBetaRegr's zero/one-inflation mixture), the marginal mean function is exactly the model's own fitted mean; no separate standardization step beyond the g-computation average is needed. Standard errors under the marginal estimand use the delta method against the mean-submodel coefficient covariance (degrees of freedom Inf); testing_type is restricted to "wald" whenever the estimand is non-conditional. The underlying model fit is identical regardless of estimand — switching estimand is a pure post-fit transform, never a refit.

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.

ProcedureRegimeError orderEffective nRegularityBasisReferences
randfinite sampleexactsubjectsregulartheory[Fisher1935], [LehmannRomano2005]
waldasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[Hall1992]
jackknifeasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[ShaoTu1995]
scoreasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[BarndorffNielsenCox1994]
lik_ratioasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[BarndorffNielsenCox1994]
gradientasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[Terrell2002], [Lemonte2016]
lik_ratio_bartlett_approxasymptotic\(O(n_{eff}^{-2})\)subjectsregularassumed default[Lawley1956], [BarndorffNielsenHall1988]
lik_ratio_bartlett_exactasymptotic\(O(n_{eff}^{-2})\)subjectsregularassumed default[Lawley1956], [BarndorffNielsenHall1988]
param_bootasymptotic\(O(n_{eff}^{-2})\)subjectsregularassumed default[Beran1988], [DiCiccioMartinStern2001], [Hall1992]
param_boot_directasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[Hall1992]
bootstrapasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[Hall1992]
bayes_bootasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed default[Rubin1981], [Lo1987]
rand_bootstrapasymptotic\(O(n_{eff}^{-1})\)subjectsregularassumed 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.

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_T not 0.5), for wald, 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, for wald, 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

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 .

Smithson, M., and Verkuilen, J. (2006). "A better lemon squeezer? Maximum-likelihood regression with beta-distributed dependent variables." Psychological Methods, 11(1), 54-71, doi:10.1037/1082-989X.11.1.54 , for the squeeze applied to responses of exactly 0 or 1.

[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.

[Hall1992] Hall, P. (1992). The Bootstrap and Edgeworth Expansion. Springer.

[ShaoTu1995] Shao, J., and Tu, D. (1995). The Jackknife and Bootstrap. Springer.

[BarndorffNielsenCox1994] Barndorff-Nielsen, O. E., and Cox, D. R. (1994). Inference and Asymptotics. Chapman and Hall.

[Terrell2002] Terrell, G. R. (2002). "The gradient statistic." Computing Science and Statistics, 34, 206-215.

[Lemonte2016] Lemonte, A. J. (2016). The Gradient Test: Another Likelihood-Based Test. Academic Press.

[Lawley1956] Lawley, D. N. (1956). "A General Method for Approximating to the Distribution of Likelihood Ratio Criteria." Biometrika, 43(3-4), 295-303.

[BarndorffNielsenHall1988] Barndorff-Nielsen, O. E., and Hall, P. (1988). "On the Level-Error after Bartlett Adjustment of the Likelihood Ratio Statistic." Biometrika, 75(2), 374-378.

[Beran1988] Beran, R. (1988). "Prepivoting Test Statistics: A Bootstrap View of Asymptotic Refinements." Journal of the American Statistical Association, 83(403), 687-697.

[DiCiccioMartinStern2001] DiCiccio, T. J., Martin, M. A., and Stern, S. E. (2001). "Simple and Accurate One-Sided Inference from Signed Roots of Likelihood Ratios." Canadian Journal of Statistics, 29(1), 67-76.

[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

InferencePropFractionalLogit for a quasi-likelihood proportion model that specifies only the conditional mean. Comparable Python API: no direct beta-regression equivalent in statsmodels; see statsmodels GLM for the general exponential-family GLM framework. See also: Beta distribution (Wikipedia).

Super class

Inference -> InferencePropBetaRegr

Methods

+ inherited public methods from Inference


InferencePropBetaRegr$new()

Initialize inference for the beta regression model \(\mathrm{logit}(E[Y_i \mid w_i, x_i]) = \beta_0 + \beta_T w_i + x_i^\top \gamma\), \(Y_i \sim \mathrm{Beta}(\mu_i \phi, (1-\mu_i) \phi)\); see InferencePropBetaRegr for the model form. Does not fit the model; the fit is deferred to the first call to compute_estimate() or a method that requires it.

Usage

InferencePropBetaRegr$new(
  des_obj,
  model_formula = NULL,
  verbose = FALSE,
  smart_cold_start_default = NULL,
  optimization_alg = NULL
)

Arguments

des_obj

A completed Design object with a proportion response.

model_formula

Optional 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.

verbose

Whether to print progress messages.

smart_cold_start_default

Whether to use smart cold start values by default.

optimization_alg

Character scalar specifying the optimization algorithm. Default is dispatched via policy.


InferencePropBetaRegr$compute_estimate()

Fits the beta regression model by maximum likelihood (jointly estimating the mean coefficients and the precision parameter \(\phi\)). Under the default estimand = "conditional", returns the log-odds-ratio estimate \(\hat\beta_T\) on the conditional-mean scale. Under estimand = "marginal_mean_diff" (set via set_estimand()), returns the g-computation marginal mean difference instead — see the "Estimand" paragraph of the class description for the formula. The underlying model fit is identical either way (a pure post-fit transform of the same cached fit, no refit).

Usage

InferencePropBetaRegr$compute_estimate(estimate_only = FALSE)

Arguments

estimate_only

If TRUE, skip standard-error computation and cache only the point estimate; used by randomization and bootstrap resampling paths.


InferencePropBetaRegr$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.

Usage

InferencePropBetaRegr$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

Two-sided miscoverage rate; the returned interval targets 1 - alpha coverage.


InferencePropBetaRegr$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.

Usage

InferencePropBetaRegr$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Null treatment-effect value under the current estimand (conditional log-odds-ratio, or marginal mean difference).


InferencePropBetaRegr$compute_estimate_with_bootstrap_weights()

Refits the 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()) via fast_beta_regression_weighted_cpp, and returns the reweighted estimate \(\hat\beta_T^{(w)}\). Uses the same QR column-dropping hardening as compute_estimate(); a hardened-but-still-unreasonable fit is cached as nonestimable.

Usage

InferencePropBetaRegr$compute_estimate_with_bootstrap_weights(
  subject_or_block_weights,
  estimate_only = FALSE
)

Arguments

subject_or_block_weights

Bootstrap weights at the subject or block level.

estimate_only

If TRUE, skip variance calculations.


InferencePropBetaRegr$clone()

The objects of this class are cloneable with this method.

Usage

InferencePropBetaRegr$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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 = InferencePropBetaRegr$new(seq_des)
inf$compute_estimate()
#> [1] -0.1292731
# }