Description Usage Arguments Details Author(s) Examples

View source: R/user_utilities.R

Samples fitted survival function

1 | ```
sampleSurv(fit, newdata = NULL, p = NULL, q = NULL, samples = 100)
``` |

`fit` |
Either an ic_bayes or ic_par fit |

`newdata` |
A data.frame with a single row of covariates |

`p` |
A set of survival probabilities to sample corresponding time for |

`q` |
A set of times to sample corresponding cumulative probability for |

`samples` |
Number of samples to draw |

For Bayesian models, draws samples from the survival distribution with a given set of covariates.
Does this by first drawing a set of parameters (both regression and baseline) from `fit$samples`

and then computing the quantiles of
the distribution (if `p`

is provided) or the CDF at `q`

.

If a `ic_par`

model is provided, the procedure is the same, but the sampled parameters are drawn using
the normal approximation.

Not compatible with `ic_np`

or `ic_sp`

objects.

Clifford Anderson-Bergman

1 2 3 4 5 6 7 8 9 10 11 12 13 | ```
data("IR_diabetes")
fit <- ic_par(cbind(left, right) ~ gender, data = IR_diabetes)
newdata <- data.frame(gender = "male")
time_samps <- sampleSurv(fit, newdata,
p = c(0.5, .9),
samples = 100)
# 100 samples of the median and 90th percentile for males
prob_samps <- sampleSurv(fit, newdata,
q = c(10, 20),
samples = 100)
# 100 samples of the cumulative probability at t = 10 and 20 for males
``` |

icenReg documentation built on Oct. 16, 2018, 1:04 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.