predict.hurdle: Methods for hurdle Objects

Description Usage Arguments Details Author(s) References See Also Examples

Description

Methods for extracting information from fitted hurdle regression model objects of class "hurdle".

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## 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"), ...)

Arguments

object, x

an object of class "hurdle" as returned by hurdle.

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 newdata. The default is to predict NA.

at

optionally, if type = "prob", a numeric vector at which the probabilities are evaluated. By default 0:max(y) is used where y is the original observed response.

model

character specifying for which component of the model the terms or model matrix should be extracted.

...

currently not used.

Details

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.

Author(s)

Achim Zeileis <Achim.Zeileis@R-project.org>

References

Zeileis, Achim, Christian Kleiber and Simon Jackman 2008. “Regression Models for Count Data in R.” Journal of Statistical Software, 27(8). URL http://www.jstatsoft.org/v27/i08/.

See Also

hurdle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data("bioChemists", package = "pscl")
fm <- hurdle(art ~ ., data = bioChemists)

plot(residuals(fm) ~ fitted(fm))

coef(fm)
coef(fm, model = "zero")

summary(fm)
logLik(fm)

Example output

Classes and Methods for R developed in the
Political Science Computational Laboratory
Department of Political Science
Stanford University
Simon Jackman
hurdle and zeroinfl functions by Achim Zeileis
count_(Intercept)    count_femWomen  count_marMarried        count_kid5 
       0.67113931       -0.22858266        0.09648499       -0.14218756 
        count_phd        count_ment  zero_(Intercept)     zero_femWomen 
      -0.01272637        0.01874548        0.23679601       -0.25115113 
  zero_marMarried         zero_kid5          zero_phd         zero_ment 
       0.32623358       -0.28524872        0.02221940        0.08012135 
(Intercept)    femWomen  marMarried        kid5         phd        ment 
 0.23679601 -0.25115113  0.32623358 -0.28524872  0.02221940  0.08012135 

Call:
hurdle(formula = art ~ ., data = bioChemists)

Pearson residuals:
    Min      1Q  Median      3Q     Max 
-2.4105 -0.8913 -0.2817  0.5530  7.0324 

Count model coefficients (truncated poisson with log link):
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  0.67114    0.12246   5.481 4.24e-08 ***
femWomen    -0.22858    0.06522  -3.505 0.000457 ***
marMarried   0.09649    0.07283   1.325 0.185209    
kid5        -0.14219    0.04845  -2.934 0.003341 ** 
phd         -0.01273    0.03130  -0.407 0.684343    
ment         0.01875    0.00228   8.222  < 2e-16 ***
Zero hurdle model coefficients (binomial with logit link):
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  0.23680    0.29552   0.801   0.4230    
femWomen    -0.25115    0.15911  -1.579   0.1144    
marMarried   0.32623    0.18082   1.804   0.0712 .  
kid5        -0.28525    0.11113  -2.567   0.0103 *  
phd          0.02222    0.07956   0.279   0.7800    
ment         0.08012    0.01302   6.155 7.52e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Number of iterations in BFGS optimization: 12 
Log-likelihood: -1605 on 12 Df
'log Lik.' -1605.312 (df=12)

pscl documentation built on March 26, 2020, 7:36 p.m.