sim_prevalence {rprev} | R Documentation |
Estimate prevalence using Monte Carlo simulation.
Description
Estimates prevalent cases at a specific index date by use of Monte Carlo simulation. Simulated cases are marked with age and sex to enable agreement with population survival data where a cure model is used, and calculation of the posterior distributions of each.
Usage
sim_prevalence(
data,
index,
starting_date,
inc_model,
surv_model,
age_column = "age",
N_boot = 1000,
age_dead = 100
)
Arguments
data |
A data frame with the corresponding column names provided in
|
index |
The date at which to estimate point prevalence as a string in the format YYYY-MM-DD. |
starting_date |
The initial date to start simulating prevalence from as a |
inc_model |
An object that has a |
surv_model |
An object that has a |
age_column |
A string providing the name of the column that holds patient age. If provided
then patients alive at |
N_boot |
Number of bootstrapped calculations to perform. |
age_dead |
The age at which patients are set to be dead if they are still alive, to prevent
'immortal' patients. Used in conjunction with |
Value
A list with the following attributes:
results |
A data.table containing the simulated incident populations from each simulation along with their covariates and survival status at the index. |
full_surv_model |
The survival model built on the full registry data set. |
full_inc_model |
The incidence model built on the full registry data set. |
surv_models |
A list containing survival models built on each bootstrap sample. |
inc_models |
A list containing incidence models built on each bootstrap sample. |