Simulate registration date for death event
Source:R/1_simulate_data_mortality.R
simulate_registration.Rd
Simulate registration date for daily death event, with a prespecified reporting delay pattern.
For now the reporting delay follows a negative binomial distribution.
Arguments
- death_data
A simulated data object from
simulate_daily_death_event()
.- r, p
Parameters for negative binomial distribution. Used jointly to control the mean and variance of the registration delay in terms of days. See detail.
By default,
r = 10, p = 0.5
.
Value
A data.table containing
- id
Pseudo ID for death events.
- date
Date of the death event when it took place (DOE).
- delay_days
Delay in days.
- date_reg
Date of registration (DOR).
Details
The input data should contain daily individual level death event with date of event. The number of days for registration (or reporting) delay is then simulated based on the negative binomial distribution with parameters (r, p).
This choice is made by investigating the delay pattern in the real data, which is often right skewed and has a long tail. NB model is preferable compared to Poisson model for its flexibility in capturing the over-dispersion.
This parametrisation is consistent with stats::rnbinom(n, size = r, prob = p)
.
The expected days of delay is then r(1-p)/p. The variance is r(1-p)/p^2.
Plausible values are r = 10
and 0.5 <= p <= 0.9
, as it is common to
to observe an average delay between 1 to 10 days. However users should adjust
the parameters to examine different delay patterns.
Future implementations
It is possible to include heavy-tailed distributions.
It might be realistic to adjust the delay with varying temporal effect (e.g. weekend).
Examples
start_date <- '2018-01-01'
end_date <- '2019-12-31'
# simulate death data using the poisson model, with mean daily death 25
death_event <- simulate_daily_death_event(
start_date = start_date,
end_date = end_date,
model = 'poisson',
param_list = list(lambda = 25))
# simulate delay, with expected delay of 10 days (default)
death_event_register <- simulate_registration(death_data = death_event)
# different parameters
death_event_register <- simulate_registration(death_data = death_event, r = 10, p = 0.7)