Methods for extracting information from fitted penalized zero-inflated
regression model objects of class "zipath"
.
# S3 method for zipath
predict(object, newdata, which = 1:object$nlambda,
type = c("response", "prob", "count", "zero", "nonzero"), na.action = na.pass,
at = NULL, ...)
# S3 method for zipath
residuals(object, type = c("pearson", "response"), ...)# S3 method for zipath
coef(object, which=1:object$nlambda, model = c("full", "count", "zero"), ...)
# S3 method for zipath
terms(x, model = c("count", "zero"), ...)
# S3 method for zipath
model.matrix(object, model = c("count", "zero"), ...)
an object of class "zipath"
as returned by
zipath
.
optionally, a data frame in which to look for variables with which to predict. If omitted, the original observations are used.
Indices of the penalty parameters lambda
at which
predictions are required. By default, all indices are returned.
character specifying the type of predictions or residuals, respectively. For details see below.
function determining what should be done with missing values
in newdata
. The default is to predict NA
.
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.
character specifying for which component of the model the terms or model matrix should be extracted.
currently not used.
Zhu Wang <zwang145@uthsc.edu>
Re-uses the design of function zeroinfl in package pscl (see reference). A set of standard extractor functions for fitted model objects is available for
objects of class "zipath"
, including methods to the generic functions
print
and summary
which print the estimated
coefficients along with some further information.
As usual, the summary
method returns an object of class "summary.zipath"
containing the relevant summary statistics which can subsequently be printed
using the associated print
method.
The methods for coef
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 components 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 inflation) and the predicted probability for the zero
component. The residuals
method can compute
raw residuals (observed - fitted) and Pearson residuals (raw residuals scaled by
square root of variance function).
Zhu Wang, Shuangge Ma, Michael Zappitelli, Chirag Parikh, Ching-Yun Wang and Prasad Devarajan (2014) Penalized Count Data Regression with Application to Hospital Stay after Pediatric Cardiac Surgery, Statistical Methods in Medical Research. 2014 Apr 17. [Epub ahead of print]
Zhu Wang, Shuangge Ma, Ching-Yun Wang, Michael Zappitelli, Prasad Devarajan and Chirag R. Parikh (2014) EM for Regularized Zero Inflated Regression Models with Applications to Postoperative Morbidity after Cardiac Surgery in Children, Statistics in Medicine. 33(29):5192-208.
Zhu Wang, Shuangge Ma and Ching-Yun Wang (2015) Variable selection for zero-inflated and overdispersed data with application to health care demand in Germany, Biometrical Journal. 57(5):867-84.
zipath
if (FALSE) {
data("bioChemists", package = "pscl")
fm_zip <- zipath(art ~ . | ., data = bioChemists, nlambda=10)
plot(residuals(fm_zip) ~ fitted(fm_zip))
coef(fm_zip, model = "count")
coef(fm_zip, model = "zero")
summary(fm_zip)
logLik(fm_zip)
}
Run the code above in your browser using DataLab