surv: Create a Survival Object for INLA

Description Usage Arguments Value Author(s) See Also Examples

Description

Create a survival object, to be used as a response variable in a model formula for the inla function for survival models.

Usage

1
2
3
4
5
6
7
inla.surv(time, event, time2, truncation,subject)
## S3 method for class 'inla.surv'
plot(x, y, ...)
## S3 method for class 'inla.surv'
print(x, ...)
is.inla.surv(object)
as.inla.surv(object, ...)

Arguments

time

For right censored data, this is the follow up time. For interval data, this is the starting time for the interval.

event

The status indicator, 1=observed event, 0=right censored event, 2=left censored event, 3=interval censored event. Although unusual, the event indicator can be omitted, in which case all subjects are assumed to have an event.

time2

Ending time for the interval censured data.

truncation

Left truncation. If missing it is assumed to be 0.

subject

Patient number in multiple event data, not needed otherwise.

object

Any R-object

x

Object to plot or print

y

Object to plot (not in use)

...

Additional argument

Value

An object of class inla.surv. There are methods for print, plot for inla.surv objects.

is.inla.surv returns TRUE if object inherits from class inla.surv, otherwise FALSE.

as.inla.surv returns an object of class inla.surv

Author(s)

Sara Martino and Rupali Akerkar

See Also

inla

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  ## First example
  trt = c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
          0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
          1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
  time = c(17,42,44,48,60,72,74,95,103, 108, 122, 144, 167, 170, 183, 185,
           193, 195, 197, 208, 234, 235, 254, 307, 315, 401, 445, 464, 484,  528, 542, 567,
           577, 580, 795, 855, 1174, 1214, 1232, 1366, 1455, 1585, 1622, 1626, 1736, 1,63, 
           105, 125, 182, 216, 250, 262, 301, 301, 342, 354, 356, 358, 380, 383, 383, 388, 
           394, 408, 460, 489, 499, 523, 524, 535, 562, 569, 675, 676, 748, 778, 786, 797,
           955, 968, 977, 1245, 1271, 1420, 1460, 1516, 1551, 1690, 1694)
  event = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
            1,1,1,1,0,1,0,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
            1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1)
  y = inla.surv(time, event)

  ## Second example
  time = c(182,182,63,68,182,152,182,130,134,145,152,182,98,152,182,88,95,105,130,137,167,182,
           152,182,81,182,71,84,126,134,152,182)
  event = c(1,0,1,1,0,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,1,1,0)
  subject = c(1,2,3,3,3,4,4,5,5,5,5,5,6,6,6,7,7,7,7,7,7,7,8,8,9,9,10,10,10,10,10,10)
  y = inla.surv(time, event, subject=subject)

andrewzm/INLA documentation built on May 10, 2019, 11:12 a.m.