predict.zerotrunc | R Documentation |
Methods for extracting information from fitted zero-truncated
count regression model objects of class "zerotrunc"
.
## S3 method for class 'zerotrunc'
predict(object, newdata,
type = c("response", "prob", "count", "zero"), na.action = na.pass, ...)
## S3 method for class 'zerotrunc'
residuals(object, type = c("deviance", "pearson", "response"), ...)
object |
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 |
... |
currently not used. |
A set of standard extractor functions for fitted model objects is available for
objects of class "zerotrunc"
, 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.zerotrunc"
containing the relevant summary statistics which can subsequently be printed
using the associated print
method.
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 truncation) and the predicted probability for observing
a non-zero count (in the un-truncated model). The residuals
method can compute raw residuals (observed - fitted), Pearson residuals
(raw residuals scaled by square root of variance function), and deviance
residuals (contributions to the centered log-likelihood).
A logLik
method is provided, hence AIC
can be called to compute information criteria.
zerotrunc
data("CrabSatellites", package = "countreg")
fm <- zerotrunc(satellites ~ width + color, data = CrabSatellites, subset = satellites > 0)
plot(residuals(fm, type = "deviance") ~ fitted(fm))
plot(residuals(fm, type = "pearson") ~ fitted(fm))
coef(fm)
summary(fm)
logLik(fm)
AIC(fm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.