Skip to contents

Fits a Poisson log-link regression for count responses: \(Y_i \mid w_i, x_i \sim \mathrm{Poisson}(\mu_i)\), \(\log \mu_i = \beta_0 + \beta_T w_i + x_i^\top \gamma\) (fast_poisson_regression_cpp/ fast_poisson_regression_with_var_cpp). \(\hat\beta_T\) is a log-rate-ratio: \(\exp(\hat\beta_T)\) is the estimated rate ratio. likelihood_tier = "full": Wald, score, gradient, and likelihood-ratio tests are all available, plus parametric-likelihood bootstrap calibration of the likelihood-ratio test (simulating new Poisson responses under the null).

Design-conservative testing. Every asymptotic/likelihood test method on this class does not report the raw model-based result directly. Instead, it also computes a design-based jackknife-Wald test (compute_jackknife_wald_two_sided_pval()/ compute_jackknife_wald_confidence_interval(), which do not assume the Poisson mean-variance relationship) and combines the two conservatively: p-values report \(\max\) of the model-based and design-based p-values, and confidence intervals report the union of the model-based and design-based intervals. This guards against the model-based test being anti-conservative when the Poisson equidispersion assumption (\(\mathrm{Var}(Y_i) = E[Y_i]\)) fails — a real risk for count data, which is frequently overdispersed (see InferenceCountNegBin for a model that estimates dispersion directly instead). If either component is unavailable, the available one is used alone; if neither is available, the result is NA. Validity requires the usual correctly-specified linear predictor on the log scale; unlike the raw Poisson likelihood alone, this class's actual reported inference degrades gracefully (rather than becoming anti-conservative) under mean-variance misspecification. This combination applies to the asymptotic likelihood methods and likelihood-ratio bootstrap calibration. The Bartlett-corrected likelihood-ratio test is the exception: "lik_ratio_bartlett_approx" (and compute_lik_ratio_bartlett_approx_confidence_interval() / compute_lik_ratio_bartlett_approx_two_sided_pval() and the best-available compute_lik_ratio_bartlett_*() pair) is the model-only Bartlett-corrected test, so its interval can be narrower than the design-conservative "lik_ratio" one; its design-conservative version is the separate testing type "lik_ratio_bartlett_approx_design_conservative" (the larger of the model-only Bartlett p-value and the design jackknife-Wald p-value, the union of the two intervals). Before EDI 1.0.6, "lik_ratio_bartlett_approx" itself returned the design-conservative result (v1.0.6-TODO-380). Generic estimate-resampling intervals (Bayesian bootstrap, ordinary bootstrap, and the direct parametric-bootstrap estimate interval) retain their standard component definitions and are not unioned with a second jackknife interval; use one of the design-conservative likelihood methods when robustness to Poisson equidispersion failure is required.

Which jackknife. The design-based half uses the automatic deletion unit of InferenceJackknife. On a blocking design whose automatic unit is the whole block (= stratum), such as a DesignSeqOneByOneRandomBlockSize object saved before EDI 1.0.6, that jackknife is NA when there are fewer than 5 blocks, which is the usual case for a design stratified on one or two factors. The class then uses the stratified delete-1 ("JKn") jackknife instead (unit = "observation_within_block"; Wolter 2007, Sec. 4.5): one subject is deleted at a time, and only the spread of the replicates within each stratum enters the variance, because the strata are fixed by the design and treatment is randomized within them. This is the estimator DesignFixedBlocking uses automatically. Without it the class would report the raw Poisson test alone, which is anti-conservative under overdispersion: with ~ 1 on a 4-stratum design it rejected a true null 17-19% of the time at a nominal 5% in a simulation, against about 3-5% with the fallback. On DesignSeqOneByOneSPBR and current DesignSeqOneByOneRandomBlockSize objects the automatic unit is the permuted block, or this same within-stratum jackknife when any stratum has fewer than 10 permuted blocks (v1.0.6-TODO-270), so no fallback is needed there.

Estimand. Composes MarginalEstimand (set_estimand()/get_estimand()/get_supported_estimands()). Under the default estimand = "conditional", \(\hat\beta_T\) is the log-rate-ratio above. Under estimand = "marginal_mean_diff", the reported quantity is instead the g-computation marginal rate difference \(\frac{1}{n}\sum_i \{\exp(\hat\beta_0 + \hat\beta_T + X_i^\top \hat\gamma) - \exp(\hat\beta_0 + X_i^\top \hat\gamma)\}\). Under estimand = "marginal_ratio", the log of the corresponding marginal rate ratio — which is numerically identical to the conditional \(\hat\beta_T\) for this family: because the log link is linear in \(w_i\) with no treatment-by-covariate interaction term, every subject's treated-vs-control mean ratio is \(\exp(\hat\beta_0 + \hat\beta_T + X_i^\top\hat\gamma) / \exp(\hat\beta_0 + X_i^\top\hat\gamma) = \exp(\hat\beta_T)\) exactly, so averaging over subjects before or after taking the ratio makes no difference. "marginal_ratio" is provided for estimand-API consistency with the other model families, not because it differs numerically from "conditional" here; "marginal_mean_diff" is the estimand where g-computation actually changes the reported number for a Poisson GLM, since a difference (unlike a ratio) does not collapse under a nonlinear (log) mean function. Because there is no latent submodel for this family (unlike e.g. InferenceCountZeroInflatedPoisson's excess-zero 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 a marginal estimand use the delta method against the model's coefficient covariance (degrees of freedom Inf), including in the design-conservative union/max combination above (the design-based jackknife-Wald component also refits under the active estimand); 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.

Subsampling and m-out-of-n

(v1.0.6-TODO-230.) At the default size \(b = m = \lfloor n^{0.7} \rfloor\) a draw can be degenerate: a treatment arm whose counts are all zero. Its log rate ratio then sits where the fitter stopped (about \(\pm 20\)), not in the sampling law the pivot estimates, so the draw is NaN in approximate_subsampling_distribution_beta_hat_T() and approximate_m_out_of_n_bootstrap_distribution_beta_hat_T() (also with debug = TRUE) and is not used. If fewer than min_fraction_usable_samples (default 0.8, user-settable since v1.0.6-TODO-269) of the B draws are usable (degenerate and failed draws both count against it), the subsampling / m-out-of-n p-value or interval is NA with reason "subsampling_too_few_usable_draws_fraction" or "m_out_of_n_too_few_usable_draws_fraction" and one edi_procedure_na_warning. The p-value is symmetric: the share of usable pivot draws \(\sqrt{b}(\hat\theta^* - \hat\theta)\) (subsampling also divides by \(\sqrt{1 - b/n}\)) at least as large in absolute value as \(\sqrt{n}(\hat\theta - \delta)\), floored at \(1/B\), rather than the equal-tailed \(2\min\{\cdot\}\), because at small \(b\) the law of a log ratio is skewed toward the observed effect and the equal-tailed rule doubles the heavy tail. The interval is the basic (equal-tailed) one. Null size at \(n = 80\) (200 data sets, B = 199, nominal 0.05, before and after): Wald 0.020; subsampling 0.010 to 0.005, m-out-of-n 0.000 to 0.010; 0.5% of data sets are NA by the 80% rule. The ordinary bootstrap is the better resampling method for this estimand.

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

Cameron, A. C., and Trivedi, P. K. (2013). Regression Analysis of Count Data (2nd ed.). Cambridge University Press, for the Poisson regression model and its maximum-likelihood theory.

Wolter, K. M. (2007). Introduction to Variance Estimation, 2nd ed. Springer, New York, ch. 4 "The Jackknife Method", Sec. 4.5 (stratified sampling), doi:10.1007/978-0-387-35099-8 , for the stratified delete-1 jackknife used on blocking designs.

[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

Comparable Python API: statsmodels discrete models (Poisson). See also: Poisson regression (Wikipedia).

Super class

Inference -> InferenceCountPoisson

Methods

+ inherited public methods from Inference


InferenceCountPoisson$new()

Initialize inference for the Poisson regression model \(Y_i \mid w_i, x_i \sim \mathrm{Poisson}(\mu_i)\), \(\log \mu_i = \beta_0 + \beta_T w_i + x_i^\top \gamma\); see InferenceCountPoisson for the model form and the design-conservative testing mechanism. Does not fit the model; the fit is deferred to the first call to compute_estimate() or a method that requires it.

Usage

InferenceCountPoisson$new(
  des_obj,
  model_formula = NULL,
  verbose = FALSE,
  smart_cold_start_default = NULL,
  harden = TRUE
)

Arguments

des_obj

A completed Design object with a count 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.

harden

Whether to apply robustness measures.


InferenceCountPoisson$compute_estimate()

Fits the Poisson regression model by maximum likelihood. Under the default estimand = "conditional", returns \(\hat\beta_T\), the treatment log-rate-ratio. Under estimand = "marginal_mean_diff"/"marginal_ratio" (set via set_estimand()), returns the g-computation marginal rate difference/log-rate-ratio 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

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


InferenceCountPoisson$compute_asymp_confidence_interval()

Design-conservative confidence interval for \(\beta_T\) using whichever test type is configured (private$testing_type: "wald", "score", "gradient", "lik_ratio", or "lik_ratio_bartlett_approx_design_conservative"; the model-only "lik_ratio_bartlett_approx" is not combined); see InferenceCountPoisson for the union-with-jackknife-Wald combination rule.

Usage

InferenceCountPoisson$compute_asymp_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceCountPoisson$compute_asymp_two_sided_pval()

Design-conservative two-sided p-value for \(H_0: \beta_T = \code{delta}\) using whichever test type is configured (private$testing_type); see InferenceCountPoisson for the max-with-jackknife-Wald combination rule.

Usage

InferenceCountPoisson$compute_asymp_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect. Default 0.


InferenceCountPoisson$compute_wald_confidence_interval()

Wald confidence interval for \(\beta_T\) using the fitted Poisson model's Fisher-information-based standard error, unioned with the design-based jackknife-Wald interval; see InferenceCountPoisson for the combination rule and InferenceAsymp for the underlying Wald contract.

Usage

InferenceCountPoisson$compute_wald_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceCountPoisson$compute_wald_two_sided_pval()

Wald test of \(H_0: \beta_T = \code{delta}\) using the fitted Poisson model's Fisher-information-based standard error, taking the max with the design-based jackknife-Wald p-value; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_wald_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect. Default 0.


InferenceCountPoisson$compute_score_confidence_interval()

Score-test confidence interval for \(\beta_T\) (inverting the Poisson score test at each candidate null, no full re-fit needed at the observed information), unioned with the design-based jackknife-Wald interval; see InferenceCountPoisson for the combination rule. The score test uses the configured information preference ("fisher" by default, identical to the observed information for the canonical log link); Wald inference always uses the observed information.

Usage

InferenceCountPoisson$compute_score_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceCountPoisson$compute_score_two_sided_pval()

Score test of \(H_0: \beta_T = \code{delta}\), taking the max with the design-based jackknife-Wald p-value; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_score_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect. Default 0.


InferenceCountPoisson$compute_lik_ratio_confidence_interval()

Likelihood-ratio-test confidence interval for \(\beta_T\) (test inversion, requiring a null refit at each candidate value), unioned with the design-based jackknife-Wald interval; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_lik_ratio_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceCountPoisson$compute_lik_ratio_two_sided_pval()

Likelihood-ratio test of \(H_0: \beta_T = \code{delta}\), taking the max with the design-based jackknife-Wald p-value; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_lik_ratio_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect. Default 0.


InferenceCountPoisson$compute_lik_ratio_bartlett_approx_confidence_interval()

Approximate (Monte-Carlo) Bartlett-corrected likelihood-ratio confidence interval: the model-only test, not unioned with the design-based jackknife-Wald interval (v1.0.6-TODO-380; it was unioned before EDI 1.0.6). For the union use set_testing_type("lik_ratio_bartlett_approx_design_conservative") and compute_asymp_confidence_interval().

Usage

InferenceCountPoisson$compute_lik_ratio_bartlett_approx_confidence_interval(
  alpha = 0.05,
  B = 99
)

Arguments

alpha

Significance level. Default 0.05.

B

Number of Monte-Carlo replicates used for the Bartlett factor.


InferenceCountPoisson$compute_lik_ratio_bartlett_approx_two_sided_pval()

Approximate (Monte-Carlo) Bartlett-corrected likelihood-ratio p-value: the model-only test, not combined with the design-based jackknife-Wald p-value (v1.0.6-TODO-380). For the larger of the two use set_testing_type("lik_ratio_bartlett_approx_design_conservative") and compute_asymp_two_sided_pval().

Usage

InferenceCountPoisson$compute_lik_ratio_bartlett_approx_two_sided_pval(
  delta = 0,
  B = 99
)

Arguments

delta

Null treatment effect. Default 0.

B

Number of Monte-Carlo replicates used for the Bartlett factor.


InferenceCountPoisson$compute_lik_ratio_bartlett_confidence_interval()

Best-available Bartlett-corrected likelihood-ratio confidence interval (the approximate correction for this class): model-only, like compute_lik_ratio_bartlett_approx_confidence_interval() (v1.0.6-TODO-380).

Usage

InferenceCountPoisson$compute_lik_ratio_bartlett_confidence_interval(
  alpha = 0.05,
  B = 99
)

Arguments

alpha

Significance level. Default 0.05.

B

Number of Monte-Carlo replicates when the approximate correction is used.


InferenceCountPoisson$compute_lik_ratio_bartlett_two_sided_pval()

Best-available Bartlett-corrected likelihood-ratio p-value: model-only, like compute_lik_ratio_bartlett_approx_two_sided_pval() (v1.0.6-TODO-380).

Usage

InferenceCountPoisson$compute_lik_ratio_bartlett_two_sided_pval(
  delta = 0,
  B = 99
)

Arguments

delta

Null treatment effect. Default 0.

B

Number of Monte-Carlo replicates when the approximate correction is used.


InferenceCountPoisson$compute_gradient_confidence_interval()

Gradient-test confidence interval for \(\beta_T\) (a score-test variant using the observed rather than expected information), unioned with the design-based jackknife-Wald interval; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_gradient_confidence_interval(alpha = 0.05)

Arguments

alpha

Significance level. Default 0.05.


InferenceCountPoisson$compute_gradient_two_sided_pval()

Gradient test of \(H_0: \beta_T = \code{delta}\), taking the max with the design-based jackknife-Wald p-value; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_gradient_two_sided_pval(delta = 0)

Arguments

delta

Null treatment effect. Default 0.


InferenceCountPoisson$compute_lik_ratio_bootstrap_two_sided_pval()

Parametric-likelihood-bootstrap-calibrated likelihood-ratio test of \(H_0: \beta_T = \code{delta}\) (simulating new Poisson responses from the null-constrained fit to calibrate the LR statistic's null distribution), taking the max with the design-based jackknife-Wald p-value; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_lik_ratio_bootstrap_two_sided_pval(
  delta = 0,
  B = 199,
  show_progress = FALSE,
  min_number_usable_samples = 5L,
  max_attempts_per_replicate = 2L
)

Arguments

delta

Null treatment effect. Default 0.

B

Number of bootstrap replicates. Default 199. The smallest attainable bootstrap p-value is \(2 / (B + 1)\).

show_progress

Whether to show progress.

min_number_usable_samples

Minimum usable bootstrap samples.

max_attempts_per_replicate

Maximum attempts per replicate.


InferenceCountPoisson$compute_lik_ratio_bootstrap_confidence_interval()

Parametric-likelihood-bootstrap-calibrated likelihood-ratio confidence interval for \(\beta_T\) (test inversion using the bootstrap-calibrated null distribution), unioned with the design-based jackknife-Wald interval; see InferenceCountPoisson for the combination rule.

Usage

InferenceCountPoisson$compute_lik_ratio_bootstrap_confidence_interval(
  alpha = 0.05,
  B = 199,
  show_progress = FALSE,
  min_number_usable_samples = 5L,
  max_attempts_per_replicate = 2L,
  root_tolerance = NULL,
  max_root_iterations = 8L
)

Arguments

alpha

Significance level. Default 0.05.

B

Number of bootstrap replicates. Default 199. The smallest attainable bootstrap p-value is \(2 / (B + 1)\), so B must be at least \(2/\alpha - 1\) (39 for alpha = 0.05); smaller values error.

show_progress

Whether to show progress.

min_number_usable_samples

Minimum usable bootstrap samples.

max_attempts_per_replicate

Maximum attempts per replicate.

root_tolerance

Root tolerance.

max_root_iterations

Maximum root iterations.


InferenceCountPoisson$compute_estimate_with_bootstrap_weights()

Refits the Poisson 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_poisson_regression_weighted_cpp, and returns the reweighted log-rate-ratio estimate \(\hat\beta_T^{(w)}\). Uses the same QR column-dropping hardening as the unweighted fit; a hardened fit with a non-finite treatment coefficient is cached as nonestimable and returns NA. The weighted refit always targets the conditional treatment coefficient, whatever the active estimand (it is not estimand-aware).

Usage

InferenceCountPoisson$compute_estimate_with_bootstrap_weights(
  subject_or_block_weights,
  estimate_only = FALSE
)

Arguments

subject_or_block_weights

Row weights for the bootstrap sample.

estimate_only

If TRUE, skip variance calculations.


InferenceCountPoisson$clone()

The objects of this class are cloneable with this method.

Usage

InferenceCountPoisson$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

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 = InferenceCountPoisson$new(seq_des)
inf$compute_estimate()
#> [1] -0.2874314
# }
# \donttest{
inf$set_seed(1)
inf$compute_lik_ratio_bootstrap_two_sided_pval(delta = 0, B = 9, show_progress = FALSE)
#> [1] 0.8
# }