View source: R/residuals_liferegr.R
residuals_liferegr | R Documentation |
Obtains the response, deviance, dfbeta, and likelihood displacement residuals for a parametric regression model for failure time data.
residuals_liferegr(
object,
type = c("response", "deviance", "dfbeta", "dfbetas", "working", "ldcase", "ldresp",
"ldshape", "matrix"),
collapse = FALSE,
weighted = (type %in% c("dfbeta", "dfbetas"))
)
object |
The output from the |
type |
The type of residuals desired, with options including
|
collapse |
Whether to collapse the residuals by |
weighted |
Whether to compute weighted residuals. |
The algorithms follow the residuals.survreg
function in the
survival
package.
Either a vector or a matrix of residuals, depending on the specified type:
response
residuals are on the scale of the original data.
working
residuals are on the scale of the linear predictor.
deviance
residuals are on the log-likelihood scale.
dfbeta
residuals are returned as a matrix, where the
i
-th row represents the approximate change in the model
coefficients resulting from the inclusion of subject i
.
dfbetas
residuals are similar to dfbeta
residuals, but
each column is scaled by the standard deviation of the
corresponding coefficient.
matrix
residuals are a matrix of derivatives of the
log-likelihood function. Let L
be the log-likelihood, p
be
the linear predictor (X\beta
), and s
be log(\sigma)
.
Then the resulting matrix contains six columns: L
,
\partial L/\partial p
, \partial^2 L/\partial p^2
,
\partial L/\partial s
, \partial^2 L/\partial s^2
, and
\partial L^2/\partial p\partial s
.
ldcase
residulas are likelihood displacement for case weight
perturbation.
ldresp
residuals are likelihood displacement for response value
perturbation.
ldshape
residuals are likelihood displacement related to the
shape parameter.
Kaifeng Lu, kaifenglu@gmail.com
Escobar, L. A. and Meeker, W. Q. Assessing influence in regression analysis with censored data. Biometrics 1992; 48:507-528.
library(dplyr)
fit1 <- liferegr(
data = tobin %>% mutate(time = ifelse(durable>0, durable, NA)),
time = "time", time2 = "durable",
covariates = c("age", "quant"), dist = "normal")
resid <- residuals_liferegr(fit1, type = "response")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.