Description Usage Arguments Value Author(s) See Also Examples
INLA requires a data frame for survival models
1 | SurvToInla(x)
|
x |
A |
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 |
Patrick Brown
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.