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 form.

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 Date object. Typically the index date - (Nyears * 365.25). Allows for non-whole year prevalence estimations.

inc_model

An object that has a draw_incident_population method. See the vignette for further guidance.

surv_model

An object that has a predict_survival_probability method. See the vignette for further guidance.

age_column

A string providing the name of the column that holds patient age. If provided then patients alive at age_dead are set to die. This helps combat 'immortal' patients.

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 age_column.

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.


[Package rprev version 1.0.5 Index]