residuals.coxme | R Documentation |
Calculates score, dfbeta, or dfbetas residuals for a mixed-effects proportional hazards model. Only fixed-effect components are calculated; see Details.
## S3 method for class 'coxme'
residuals(
object,
data,
type = c("score", "dfbeta", "dfbetas"),
weighted = (type %in% c("dfbeta", "dfbetas")),
include_re = FALSE,
...
)
object |
an object inheriting from class |
data |
the data used to generate |
type |
character string indicating the type of residual desired. Possible values are "score", "dfbeta"', "dfbetas". |
weighted |
if TRUE and the model was fit with case weights, then the weighted residuals are returned. |
include_re |
logical flag indicating if residuals for random effects should be returned. This flag is currently ignored; see Details. |
... |
other unused arguments. |
An observation's contribution to the score vector includes values for every fixed and random effect in the fitted model. In many cases, the number of random effects will be large, and most residuals will be zero. Until efficient sparse computation is implemented, it is too expensive computationally and on memory to calculate the random effect residual terms, so they are excluded. This is likely to change, and the parameter include_re
is include for future expansion.
A matrix of residuals. The score residuals are each observation's contribution to the score vector. Two transformations of this are often more useful: dfbeta is the approximate change in the coefficient vector if that observation were dropped, and dfbetas is the approximate change in the coefficients, scaled by the standard error for the coefficients.
fit1 <- coxme::coxme(survival::Surv(stat_time, stat) ~ X1 + X2 + X3 + (1 | group_id),
data = samp_srcs)
dfbeta_res <- resid(fit1, data = samp_srcs, type = "dfbeta")
head(dfbeta_res)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.