formula.jointmeta1: Extract formulae from joint model fit

Description Usage Arguments Value See Also Examples

View source: R/formula.jointmeta1.R

Description

Extract the formula of various parts of the joint model fit

Usage

1
2
## S3 method for class 'jointmeta1'
formula(x, type = c("Longitudinal", "Survival", "Rand_ind", "Rand_stud"), ...)

Arguments

x

A jointmeta1 object, the result of applying the jointmeta1 function to joint longitudinal and survival data.

type

A character string indicating what part of the joint model the formula should be returned for. Specifying 'Longitudinal' will result in the function returning the formula for the fixed effect portion of the longitudinal sub-model, 'Survival' will result in the formula for the fixed effect portion of the survival sub-model being returned. To return the formula for the individual level random effect, specify type = 'Rand_ind', or to return the formula for the study level random effects (if included in the joint model), specify type = 'Rand_stud'.

...

additional arguments; currently none are used.

Value

This function returns a formula for the specified portion of the joint model fitted in the supplied jointmeta1 object.

See Also

jointmeta1, jointmeta1.object

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
26
27
28
29
30
31
   #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)

    #return the formula for the longitudinal fixed effects
    formula(onestagefit, type = 'Longitudinal')

    #return the formula for the time-to-event fixed effects
    formula(onestagefit, type = 'Survival')

    #return the formula for the individual level random effects
    formula(onestagefit, type = 'Rand_ind')

    #return the formula for the study level random effects
    formula(onestagefit, type = 'Rand_stud')

joineRmeta documentation built on Jan. 24, 2020, 5:10 p.m.