ranef.joint: Extract random effects from a 'joint' object.

View source: R/rfixef.R

ranef.jointR Documentation

Extract random effects from a joint object.

Description

Return the random effects \hat{\boldsymbol{b}} which maximises the complete data log-likelihood at the MLEs \hat{\Omega}.

Usage

## S3 method for class 'joint'
ranef(object, Var = FALSE, ...)

Arguments

object

a joint model fit by the joint function.

Var

logical, should the estimated variance of the random effects at \hat{\Omega} be returned? Defaults to Var=FALSE.

...

additional arguments (none used).

Value

A matrix containing required random effects effects. If Var=TRUE, instead a list is returned with first element the matrix of random effects and second a matrix of the variances \hat{\Sigma}. Note that these are posterior modes of the random effects. Conditional distribution can be found by cond.ranefs.

Author(s)

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

See Also

fixef.joint cond.ranefs

Examples


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

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

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

fit <- joint(long.formulas, surv.formula, PBC, family = list('gaussian'))
b <- ranef(fit, FALSE)


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