## models.ZeroInflated


A zero-inflated Poisson or negative binomial model, as R's


Usage

``` python
models.ZeroInflated()
```


`pscl::zeroinfl`: a zero is structural with probability `pi = h(z' gamma)`, otherwise the count is Poisson or negative binomial with mean `exp(x' beta + offset)`. Fitted by joint maximum likelihood; standard errors from the observed information.


## Parameters


`count: str`  
`"poisson"` (the default) or `"negative_binomial"` ([theta](models.TwoPartFit.md#prospicio.models.TwoPartFit.theta) estimated).

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


## Examples

``` python
>>> from prospicio.models import Design, ZeroInflated
>>> x = [i % 4 / 3 for i in range(200)]
>>> y = [0.0 if i % 3 == 0 else float(i * 7 % 5) for i in range(200)]
>>> d = Design([[1.0] * 200, x], ["(Intercept)", "x"])
>>> fit = ZeroInflated().fit(d, y)
>>> abs(sum(fit.predict(d)) - sum(y)) < 0.1
```

True


## Methods

| Name | Description |
|----|----|
| [fit()](#fit) | Fits the count part on [count](models.TwoPartFit.md#prospicio.models.TwoPartFit.count) (its offset and prior weights |

------------------------------------------------------------------------


#### fit()


Fits the count part on [count](models.TwoPartFit.md#prospicio.models.TwoPartFit.count) (its offset and prior weights


Usage

``` python
fit(count, y, zero=None)
```


apply) and the zero part on `zero` (its offset applies). Without `zero` both parts use [count](models.TwoPartFit.md#prospicio.models.TwoPartFit.count)'s columns, the offset on the count part only.


##### Returns


`TwoPartFit`
