SurvToInla: Convert Surv objects to survival responses for INLA

Description Usage Arguments Value Author(s) See Also Examples

Description

INLA requires a data frame for survival models

Usage

1

Arguments

x

A Surv object

Value

A data frame with the following columns

event

0 (right censored), 1 (observed event), 2 (left censored), or 3 (interval censored)

time

When event=1, this is the time of the event

truncation

The likelihood should condition on the event time being after the truncation time, set to 0 when there is no truncation time.

lower

For right censored or interval censored data, the lower bound for the event time

upper

For left censored or interval censored data, the upper bound for the event time

Author(s)

Patrick Brown

See Also

Surv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if(require(survival)) {
# right censored
x = Surv(runif(4, 0, 10),  c(0,1,1,0) )
x
SurvToInla(x)

# left censored
x = Surv(runif(4, 0, 10),  c(0,1,1,0), type="left" )
x
SurvToInla(x)


# interval censored data
x = Surv(runif(4, 0, 5), runif(4,5,10),   c(0,1,2,3), type="interval" )
x
SurvToInla(x)

# left truncated, right censored data
x = Surv(runif(4, 0, 5), runif(4,5,10),   c(0,1,1,0))
x
SurvToInla(x)

}

inlaDevel documentation built on May 2, 2019, 5:55 p.m.