Skip to contents

This function takes in the two input data sources, the CmdStan fit object, and the 3 relevant mappings from stan indices to the real data, in order to generate a dataframe containing the posterior draws of the counts (e.g. hospital admissions), the wastewater concentration values, the "global" R(t), and the "local" R(t) estimates + the critical metadata in the data. This funtion has a default method that takes the two sets of input data, the last of stan arguments, and the CmdStan fitting object, as well as an S3 method for objects of class 'wwinference_fit'

This method overloads the generic get_draws function specifically for objects of type 'wwinference_fit'.

Usage

get_draws(x, ..., what = "all")

get_draws_df(x, ...)

# S3 method for class 'wwinference_fit'
get_draws(x, ..., what = "all")

# Default S3 method
get_draws(x, ..., what = "all")

# S3 method for class 'data.frame'
get_draws(x, count_data, stan_data_list, fit_obj, ..., what = "all")

# S3 method for class 'wwinference_fit_draws'
plot(x, y = NULL, what, ...)

Arguments

x

An object of class get_draws.

...

additional arguments

what

Character vector. Specifies the variables to extract from the draws. It could be any from "all" "predicted_counts", "predicted_ww", "global_rt", or "subpop_rt". When what = "all" (the default), the function will extract all four variables.

count_data

A dataframe of the preprocessed daily count data (e.g. hospital admissions) from the "global" population

stan_data_list

A list containing all the data passed to stan for fitting the model

fit_obj

a CmdStan object that is the output of fitting the model to x and count_data

y

Ignored in the the case of plot.

Value

A tibble containing the full set of posterior draws of the estimated, nowcasted, and forecasted: counts, site-level wastewater concentrations, "global"(e.g. state) R(t) estimate, and the "local" (site + the one auxiliary subpopulation) R(t) estimates. In the instance where there are observations, the data will be joined to each draw of the predicted observation to facilitate plotting.

Details

The function get_draws_df() has been deprecated in favor of get_draws().

The plot method for wwinference_fit_draws is a wrapper of get_plot_forecasted_counts, get_plot_ww_conc, get_plot_global_rt, and get_plot_subpop_rt. Depending on the value of what, the function will call the appropriate method.