Learn R Programming

fastglm (version 0.1.4)

predict.fastglm_hurdle: Predictions and inference for two-component models

Description

The response prediction averages over both components. For hurdle models, `count` is the conditional mean among positive counts and `zero` is the probability of observing zero. For zero-inflated models, `count` is the mean of the untruncated count distribution. Prediction standard errors use the delta method and include uncertainty in theta when it is estimated.

Usage

# S3 method for fastglm_hurdle
predict(
  object,
  newdata = NULL,
  type = c("response", "count", "zero", "prob", "link"),
  se.fit = FALSE,
  at = 0:10,
  sink = NULL,
  ...
)

# S3 method for fastglm_zi predict( object, newdata = NULL, type = c("response", "count", "zero", "prob", "link"), se.fit = FALSE, at = 0:10, sink = NULL, ... )

Value

Predicted values, or a `fastglm_prediction` list with `fit` and `se.fit`; see fastglm-prediction-methods for printing and table extraction.

Arguments

object

a hurdle, zero-inflated, or two-part fit.

newdata

optional data frame or list of design matrices named `count` and `zero`, optionally with `offset=list(count=...,zero=...)`. With a streaming model, omitting it rereads the fitted source.

type

prediction scale: marginal response, count-component mean, zero probability, probability masses, or component linear predictors.

se.fit

return delta-method standard errors.

at

nonnegative integer counts for `type = "prob"`.

sink

optional function of `(value, chunk_index)` for a streaming fit. It receives each block of predictions so that results can be written or summarized without retaining predictions for all observations in memory.

...

additional arguments.