residuals.joint: Obtain joint model residuals

View source: R/fitted.R

residuals.jointR Documentation

Obtain joint model residuals

Description

returns the Pearson residuals values from a joint object.

Usage

## S3 method for class 'joint'
residuals(
  object,
  what = c("longit", "surv"),
  type = c("response", "pearson"),
  ...
)

Arguments

object

a joint model fit by joint function.

what

character string. Should the "long"itudinal process(es) be extracted, or the "surv"ival ones?

type

character. The residual type for what = "long" residuals only. Choices are on the "response" scale or "pearson" residuals. Cox-Snell residuals are returend if what = "surv".

...

Additional arguments (none used).

Value

a named list of length K of class residuals.joint containing residuals produced by the joint model for each of the k=1,\dots,K responses, along with the fitted values as an attribute.

Author(s)

James Murray (j.murray7@ncl.ac.uk).

See Also

fitted.joint plot.residuals.joint

Examples


# Trivariate fit on PBC data -----------------------------------------
data(PBC)

# Subset data and remove NAs
PBC <- subset(PBC, select = c('id', 'survtime', 'status', 'drug', 'time',
                              'albumin', 'hepatomegaly', 'platelets'))
PBC <- na.omit(PBC) 

# Specify trivariate fit
long.formulas <- list(
  albumin ~ time*drug + (1 + time|id),
  platelets ~ time * drug + (1 + time|id),
  hepatomegaly ~ time * drug + (1|id)
)
surv.formula <- Surv(survtime, status) ~ drug

fit <- joint(long.formulas, surv.formula, PBC, 
             family = list('gaussian', 'poisson', 'binomial'))
R <- residuals(fit, type = 'pearson')
plot(R)
plot(residuals(fit, what = "surv"))


gmvjoint documentation built on Oct. 6, 2024, 1:07 a.m.