incidental (version 0.1)

incidence_to_df: Export incidence model to data frame

Description

Export the output of fit_incidence to a data frame with an optional addition of a time index.

Usage

incidence_to_df(x, times = NULL, low_quantile = 0.05, high_quantile = 0.95)

Arguments

x

An "incidence_spline_model" output from fit_incidence.

times

An optional vector of time indices.

low_quantile

A scalar that specifies the low quantile value for the output CI.

high_quantile

A scalar that specifies the high quantile value for the output CI.

Value

A data frame with the following entries:

  • Time -- a time index; if `ts` is `NULL` it is the observation number;

  • Reported -- the value of `reported`;

  • Ihat -- MAP incidence curve estimate;

  • Chat -- expected cases given MAP incidence curve estimate;

  • LowCI -- lower pointwise credible interval bands around the incidence curve; and

  • HighCI -- higher pointwise credible interval bands around the incidence curve.

Examples

Run this code
# NOT RUN {
indiana_model <- fit_incidence(
                  reported = spanish_flu$Indiana, 
                  delay_dist = spanish_flu_delay_dist$proportion)
 indiana_df <- incidence_to_df(indiana_model, times = spanish_flu$Date)
# }

Run the code above in your browser using DataLab