Other outcomes
Restricted methods for censored, multicategory and two-part count outcomes.
fit_tobit(y, exposures, covariates=None, *, left=0.0, right=None, q=4, breaks=None, alpha=0.05)
Fit Gaussian Tobit and sum exposure effects on the latent mean scale.
The supplied outcome must already be clipped to any censoring limits. Inputs are complete numeric arrays. This subset has no weights, clusters, formula, alternative latent distribution or observed-mean g-computation.
fit_multinomial(y, exposures, covariates=None, *, levels, q=4, breaks=None, alpha=0.05)
Fit additive multinomial logit and sum exposures by outcome category.
levels must name every category in order; the first is the reference.
This subset uses complete rows and has no weights, clusters, formula,
nonlinear terms or marginal standardization.
fit_multinomial_bootstrap(y, exposures, covariates=None, *, levels, q=4, breaks=None, alpha=0.05, B=200, seed=None)
Fit a degree-one marginal multinomial model after joint interventions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
| Raises: |
|
|---|
Notes
The fitted conditional model gives category probabilities at every joint score. One outcome is drawn per row and score, then a multinomial logit with an intercept and joint score is fitted to the simulated outcomes. Each bootstrap sample refits both stages on sampled rows. Cutpoints remain fixed. A failed sample is not replaced. This follows the R qgcomp 2.19.6 stage structure but uses a separate Python random stream and optimizer. Normal intervals use the bootstrap standard deviation; they do not include a separate correction for finite simulation size. R is not needed at runtime.
fit_zero_inflated_poisson(y, exposures, covariates=None, *, zero_covariates='same', exposure_component='both', q=4, breaks=None, alpha=0.05)
Fit an additive ZIP model with the same exposures in both components.
Omitted zero_covariates reuses covariates in both components.
Pass a separate numeric matrix or explicit None to change the zero
component. exposure_component is "both", "count", or
"zero"; an omitted component effect is returned as None. This subset requires
complete numeric data and has no weights, clusters, formulas, offsets or
negative-binomial component.
fit_zero_inflated_poisson_bootstrap(y, exposures, covariates=None, *, q=4, breaks=None, alpha=0.05, B=200, MCsize=10000, seed=None)
Fit a degree-one marginal zero-inflated Poisson model.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Notes
Under each joint score, adjustment rows are sampled with replacement. A Poisson draw is multiplied by a nonstructural-zero Bernoulli draw. A zero-inflated Poisson model with intercept and joint score in both components is fitted to the simulated counts. Both stages are refitted for every row-bootstrap sample, holding exposure cutpoints fixed. This follows R's default component-simulation stage; Python random draws and optimizer paths differ. No R runtime is needed. A failed sample reports its one-based position and is not replaced. Finite simulation size adds noise that the bootstrap interval does not separately remove.
fit_zero_inflated_negative_binomial(y, exposures, covariates=None, *, zero_covariates='same', exposure_component='both', q=4, breaks=None, alpha=0.05)
Fit an NB2 count process plus separate structural-zero logit.
Inputs are complete numeric arrays of independent rows. The count size
is estimated jointly with both regression components. The full exposure
set enters either or both components; absent effects are returned as
None. Omitted zero adjustment reuses count adjustment.
fit_zero_inflated_negative_binomial_bootstrap(y, exposures, covariates=None, *, q=4, breaks=None, alpha=0.05, B=200, MCsize=10000, seed=None)
Fit degree-one marginal NB2 count and structural-zero slopes.
Sample adjustment profiles under each joint exposure score. Draw a structural-zero indicator and an NB2 count using the fitted size. Fit a marginal NB2 mixture, then repeat both stages on independent-row resamples with the original exposure cuts. Failed replicates are named. The Python and R random streams differ. A finite MCsize adds simulation noise that the row-bootstrap interval does not separately remove.
fit_hurdle_poisson(y, exposures, covariates=None, *, zero_covariates='same', exposure_component='both', q=4, breaks=None, alpha=0.05)
Fit truncated-positive Poisson counts and a separate nonzero logit.
Omitted zero_covariates reuses covariates in both components.
Pass a separate numeric matrix or explicit None to change the
nonzero component. exposure_component is "both", "count",
or "zero"; an omitted component effect is returned as None. This subset
has no weights, clusters, formulas, offsets or negative-binomial option.
fit_hurdle_poisson_bootstrap(y, exposures, covariates=None, *, q=4, breaks=None, alpha=0.05, B=200, MCsize=10000, seed=None)
Fit a degree-one marginal Poisson hurdle model.
Complete numeric additive inputs are required. Each joint intervention samples adjustment profiles, then simulates nonzero status and a positive zero-truncated Poisson count. A marginal hurdle model is fitted to those outcomes. Independent rows are resampled with the original exposure cuts fixed. Failed replicates are reported by position, not silently replaced.
R qgcomp 2.19.6 calls its hurdle bootstrap experimental and defaults to sampling from a finite fitted category-probability matrix. This Python subset samples from the full zero-truncated Poisson support instead; finite Monte Carlo draws and optimizers also differ. No R runtime is used.
fit_hurdle_negative_binomial(y, exposures, covariates=None, *, zero_covariates='same', exposure_component='both', q=4, breaks=None, alpha=0.05)
Fit zero-truncated NB2 counts and a separate nonzero logit.
The count size theta is estimated jointly with its regression terms;
variance before truncation is mu + mu**2/theta. All exposure scores
enter the selected count, nonzero, or both components. None in
zero_covariates removes nonzero adjustment; omission reuses count
adjustment. Inputs must be complete numeric arrays with independent rows.
fit_hurdle_negative_binomial_bootstrap(y, exposures, covariates=None, *, q=4, breaks=None, alpha=0.05, B=200, MCsize=10000, seed=None)
Fit degree-one marginal positive-count and nonzero slopes.
Simulate nonzero status and a positive NB2 count under each joint score, fit a marginal hurdle model, then refit both stages and dispersion on fixed-cut independent-row resamples. Failed replicates are named.
R qgcomp 2.19.6 calls this bootstrap experimental. Its default component sampler applies a nonzero gate to an untruncated NB draw, so it can return a zero after the gate. Python samples from the positive truncated NB distribution to preserve the hurdle model. The random streams and optimizer paths also differ; no end-to-end R equality is claimed. Finite MCsize adds simulation noise.