predict.hurdle | R Documentation |
Methods for extracting information from fitted hurdle
regression model objects of class "hurdle"
.
## S3 method for class 'hurdle'
predict(object, newdata,
type = c("response", "prob", "count", "zero"), na.action = na.pass,
at = NULL, ...)
## S3 method for class 'hurdle'
residuals(object, type = c("pearson", "response"), ...)
## S3 method for class 'hurdle'
coef(object, model = c("full", "count", "zero"), ...)
## S3 method for class 'hurdle'
vcov(object, model = c("full", "count", "zero"), ...)
## S3 method for class 'hurdle'
terms(x, model = c("count", "zero"), ...)
## S3 method for class 'hurdle'
model.matrix(object, model = c("count", "zero"), ...)
object , x |
an object of class |
newdata |
optionally, a data frame in which to look for variables with which to predict. If omitted, the original observations are used. |
type |
character specifying the type of predictions or residuals, respectively. For details see below. |
na.action |
function determining what should be done with missing values
in |
at |
optionally, if |
model |
character specifying for which component of the model the terms or model matrix should be extracted. |
... |
currently not used. |
A set of standard extractor functions for fitted model objects is available for
objects of class "hurdle"
, including methods to the generic functions
print
and summary
which print the estimated
coefficients along with some further information. The summary
in particular
supplies partial Wald tests based on the coefficients and the covariance matrix
(estimated from the Hessian in the numerical optimization of the log-likelihood).
As usual, the summary
method returns an object of class "summary.hurdle"
containing the relevant summary statistics which can subsequently be printed
using the associated print
method.
The methods for coef
and vcov
by default
return a single vector of coefficients and their associated covariance matrix,
respectively, i.e., all coefficients are concatenated. By setting the model
argument, the estimates for the corresponding model component can be extracted.
Both the fitted
and predict
methods can
compute fitted responses. The latter additionally provides the predicted density
(i.e., probabilities for the observed counts), the predicted mean from the count
component (without zero hurdle) and the predicted ratio of probabilities for
observing a non-zero count. The latter is the ratio of probabilities for a non-zero
implied by the zero hurdle component and a non-zero count in the non-truncated
count distribution. See also Appendix C in Zeileis et al. (2008).
The residuals
method can compute raw residuals
(observed - fitted) and Pearson residuals (raw residuals scaled by
square root of variance function).
The terms
and model.matrix
extractors can
be used to extract the relevant information for either component of the model.
A logLik
method is provided, hence AIC
can be called to compute information criteria.
Achim Zeileis <Achim.Zeileis@R-project.org>
Zeileis, Achim, Christian Kleiber and Simon Jackman 2008. “Regression Models for Count Data in R.” Journal of Statistical Software, 27(8). URL https://www.jstatsoft.org/v27/i08/.
hurdle
data("bioChemists", package = "pscl")
fm <- hurdle(art ~ ., data = bioChemists)
plot(residuals(fm) ~ fitted(fm))
coef(fm)
coef(fm, model = "zero")
summary(fm)
logLik(fm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.