
Hurdle Negative Binomial Regression Inference for Count Responses
Source:R/inference_count_hurdle.R
InferenceCountHurdleNegBin.RdFits a hurdle negative binomial regression for count responses: a binary
hurdle submodel \(P(Y_i > 0) = \mathrm{logit}^{-1}(X_i^{h\top}
\gamma^h)\) (fit jointly with the count submodel) crossed with a
zero-truncated negative-binomial count submodel for \(Y_i \mid Y_i > 0\):
\(\log E[Y_i \mid Y_i > 0, w_i, x_i] = \beta_0 + \beta_T w_i + x_i^\top
\gamma\), \(\mathrm{Var}(Y_i \mid Y_i > 0) = \mu_i + \mu_i^2 / \theta\)
(fast_hurdle_negbin_cpp/
fast_hurdle_negbin_with_var_cpp). The hurdle and count
submodels may use different covariate formulas
(model_formula/model_formula_hurdle). The reported treatment
effect is the coefficient from the conditional
(truncated, \(Y > 0\)) count component, on the log-rate scale,
conditional on clearing the hurdle: it is not the effect on the
unconditional mean \(E[Y]\), which also depends on how treatment shifts
the hurdle-crossing probability. A marginal (unconditional-mean) estimand
is not yet implemented for this class (see
marginal_estimand_report.md). likelihood_tier = "full":
Wald, gradient, and (bootstrap-calibrated) likelihood-ratio tests are
available for the count submodel's treatment coefficient; a plain score
test is not exposed. Jackknife inference is not supported:
delete-one refits of this two-part model with a jointly-estimated
dispersion parameter are numerically unstable, so
compute_jackknife_estimate() and related methods report explicit
non-estimability rather than attempting delete-one refits.
References
Mullahy, J. (1986). "Specification and Testing of Some Modified Count Data Models." Journal of Econometrics, 33(3), 341-365, doi:10.1016/0304-4076(86)90002-3 , for the hurdle count-model framework.
See also
InferenceCountNegBin for
the single-part negative binomial model this class's count submodel
generalizes to two parts.
Super class
Inference -> InferenceCountHurdleNegBin
Methods
Public methods
InferenceCountHurdleNegBin$compute_asymp_confidence_interval()InferenceCountHurdleNegBin$compute_gradient_two_sided_pval()InferenceCountHurdleNegBin$compute_gradient_confidence_interval()InferenceCountHurdleNegBin$compute_estimate_with_bootstrap_weights()InferenceCountHurdleNegBin$compute_jackknife_bias_estimate()InferenceCountHurdleNegBin$compute_jackknife_wald_two_sided_pval()InferenceCountHurdleNegBin$compute_jackknife_wald_confidence_interval()
+ inherited public methods from Inference
Inference$capabilities()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_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()
InferenceCountHurdleNegBin$new()
Initialize inference for the two-part hurdle negative
binomial model (binary hurdle submodel plus zero-truncated
negative-binomial count submodel); see
InferenceCountHurdleNegBin
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
InferenceCountHurdleNegBin$new(
des_obj,
model_formula = NULL,
model_formula_hurdle = NULL,
verbose = FALSE,
smart_cold_start_default = NULL
)Arguments
des_objA completed
Designobject.model_formulaOptional formula for covariate adjustment.
model_formula_hurdleFormula for the hurdle submodel. If
NULL(default), it uses the same formula asmodel_formula.verboseA flag indicating whether messages should be displayed.
smart_cold_start_defaultWhether to use smart cold start values.
InferenceCountHurdleNegBin$compute_asymp_confidence_interval()
Compute the hurdle negative-binomial asymptotic confidence
interval for the treatment coefficient, using the shared count-likelihood
semantics documented in
InferenceCountLikelihood.
InferenceCountHurdleNegBin$compute_asymp_two_sided_pval()
Compute the hurdle negative-binomial asymptotic two-sided
p-value for the treatment coefficient, falling back through the shared
count-likelihood machinery when needed; see
InferenceCountLikelihood.
InferenceCountHurdleNegBin$compute_gradient_two_sided_pval()
Gradient test of \(H_0: \beta_T = \code{delta}\) on the
truncated count submodel's treatment coefficient (a score-test variant
using the observed rather than expected information); see
InferenceCountLikelihood
for the shared likelihood-test dispatch.
InferenceCountHurdleNegBin$compute_gradient_confidence_interval()
Compute a hurdle negative-binomial likelihood-based confidence
interval by inverting the configured likelihood test. See
InferenceCountLikelihood
for related score, likelihood-ratio, and gradient methods.
InferenceCountHurdleNegBin$compute_estimate_with_bootstrap_weights()
Refits the hurdle negative-binomial model with subject/
block-level weights (Bayesian-bootstrap or nonparametric-bootstrap draw
weights, expanded to row level via
private$expand_subject_or_block_weights_to_row_weights()) via
glmmTMB's glmmTMB(family = truncated_nbinom2()) (not the
package's internal C++ solver, which has no weighted variant for this
model), and returns the reweighted conditional-count log-rate-ratio
estimate \(\hat\beta_T^{(w)}\). Requires the glmmTMB package;
errors if unavailable. No standard error is computed
(s_beta_hat_T is always NA). A fit that fails, or whose
fitted treatment coefficient is missing or non-finite, is cached as
nonestimable and returns NA.
InferenceCountHurdleNegBin$compute_jackknife_estimate()
Hurdle negative-binomial delete-one refits are unstable for jackknife inference; report explicit non-estimability.
InferenceCountHurdleNegBin$compute_jackknife_bias_estimate()
Report that the jackknife bias estimate is unavailable for
hurdle negative-binomial fits because delete-one refits are unstable; see
InferenceJackknife for the shared
jackknife contract.
InferenceCountHurdleNegBin$compute_jackknife_std_error()
Report that the jackknife standard error is unavailable for
hurdle negative-binomial fits because delete-one refits are unstable; see
InferenceJackknife for the shared
jackknife contract.
InferenceCountHurdleNegBin$compute_jackknife_wald_two_sided_pval()
Reports that jackknife-Wald p-values are unavailable here; see
InferenceJackknife.
InferenceCountHurdleNegBin$compute_jackknife_wald_confidence_interval()
Reports that jackknife-Wald intervals are unavailable here; see
InferenceJackknife.
Examples
# \donttest{
seq_des = DesignSeqOneByOneBernoulli$new(n = 10, response_type = 'count')
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(rpois(10, 2))
inf = InferenceCountHurdleNegBin$new(seq_des, model_formula = ~ x1)
inf$compute_estimate()
#> [1] 1.850173
# }