Skip to main content

models.Hurdle

A hurdle model, as R’s pscl::hurdle: a binary part for

Usage

Source

models.Hurdle()

P(Y > 0) = h(z' gamma) and a zero-truncated Poisson or negative binomial with mean exp(x' beta + offset) for the positive counts, each fitted by maximum likelihood.

Parameters

count: str

"poisson" (the default) or "negative_binomial".

zero_link: str
"logit" (the default), "probit" or "cloglog".

Examples

>>> from prospicio.models import Design, Hurdle
>>> x = [i % 4 / 3 for i in range(200)]
>>> y = [0.0 if i % 3 == 0 else float(1 + i * 7 % 5) for i in range(200)]
>>> d = Design([[1.0] * 200, x], ["(Intercept)", "x"])
>>> fit = Hurdle().fit(d, y)
>>> round(sum(fit.prob_zero(d)), 6) == sum(v == 0 for v in y)

True

Methods

Name Description
fit() Fits as ZeroInflated.fit.

fit()

Fits as ZeroInflated.fit.

Usage

Source

fit(count, y, zero=None)
Returns
TwoPartFit