
Compute Daily Incident Cases from Cumulative Simulation Output
Source:R/abc_stochastic_model.R
get_daily_cases.RdThis function takes a data frame or matrix containing irregularly spaced simulation
time points and cumulative case counts (C), and returns the number of new cases
per day using linear interpolation.
Value
A tibble() with two columns:
- day
Integer day values from the floor of the minimum time to the ceiling of the maximum time
- daily_incidence
Number of new cases per day, computed as the difference in interpolated cumulative cases
Details
Since simulation outputs may record cumulative cases at non-integer time points, this function performs linear interpolation to estimate cumulative cases at each whole-number day. It then computes the number of incident cases as the first difference of the interpolated values. The first day is assigned 0 new cases by default.