ranef.jointmeta1: Function to extract estimated random effects

Description Usage Arguments Value See Also Examples

View source: R/ranef.jointmeta1.R

Description

This function extracts the estimated values of the random effects from a supplied jointmeta1 fit.

Usage

1
2
## S3 method for class 'jointmeta1'
ranef(object, type = c("individual", "study"), ...)

Arguments

object

a jointmeta1 object (the result of fitting a model using jointmeta1, see jointmeta1.object)

type

the type of random effects to return. Set type = 'individual' to return the estimates of the individual level random effects. Set type = 'study' to return the estimates of the level random effects if included in the model.

...

additional arguments; currently none are used.

Value

If type = 'individual' then a list of matrices containing the individual level random effects is returned. This list is of length equal to the number of studies in the dataset. Each matrix has number of rows equal to the number of individuals in the corresponding study, and number of columns equal to the number of individual level random effects.

If type = 'study' then if study level random effects are present in the supplied model fit, a matrix of the estimated study level random effects is returned, with number of rows equal to the number of studies in the dataset, and number of columns equal to the number of study level random effects. If study level random effects are requested but are not present in the supplied model fit, an error message is returned.

See Also

jointmeta1, jointmeta1.object, fixef

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
   #change example data to jointdata object
   jointdat2<-tojointdata(longitudinal = simdat2$longitudinal,
   survival = simdat2$survival, id = 'id',longoutcome = 'Y',
   timevarying = c('time','ltime'),
   survtime = 'survtime', cens = 'cens',time = 'time')

   #set variables to factors
   jointdat2$baseline$study <- as.factor(jointdat2$baseline$study)
   jointdat2$baseline$treat <- as.factor(jointdat2$baseline$treat)

   #fit multi-study joint model
   #note: for demonstration purposes only - max.it restricted to 5
   #model would need more iterations to truely converge
   onestagefit<-jointmeta1(data = jointdat2, long.formula = Y ~ 1 + time +
                           + treat + study, long.rand.ind = c('int', 'time'),
                           long.rand.stud = c('treat'),
                           sharingstrct = 'randprop',
                           surv.formula = Surv(survtime, cens) ~ treat,
                           study.name = 'study', strat = TRUE, max.it=5)

    #extract the individual level random effects covariance matrix
    ranef(onestagefit, type = 'individual')

    #extract the study level random effects covariance matrix
    ranef(onestagefit, type = 'study')

mesudell/joineRmeta documentation built on Jan. 24, 2020, 6:06 p.m.