covidestim returns a base configuration of the model with the default set of priors, and no input data. This configuration, after adding input data (see input_cases, input_deaths, priors_*), represents a valid model configuration that can be passed to run.covidestim (for NUTS) or runOptimizer.covidestim (for BFGS).

covidestim(
  ndays,
  ndays_before = 28,
  pop_size = 1e+12,
  chains = 3,
  iter = 2000,
  thin = 1,
  seed = 42,
  adapt_delta = 0.98,
  max_treedepth = 14,
  window.length = 7,
  region
)

Arguments

ndays

A positive integer. The number of days of input data being modeled. This should always be set to the number of days in your input data.

ndays_before

A positive integer. How many days before the first day of model data should be modeled? A higher number will produce estimates that go farther back in time, however, those estimates will contain more and more uncertainty.

pop_size

A positive integer What is the population in the geography being modelled? This sets the max susceptible population and becomes important as the population ever infected approaches the population size.

chains

The number of chains to use during NUTS sampling, as passed to sampling.

iter

The number of iterations to run during NUTS sampling, as passed to sampling.

thin

A positive integer to specify period for saving samples, as passed to sampling. Modify this only if you intend to inspect raw iterations data returned by sampling.

seed

A number. The random number generator seed for use in NUTS sampling or in BFGS.

region

A string. The FIPS code (for U.S. counties) or state name (e.g. New York) being modeled. Required.

Value

An S3 object of type covidestim. This can be passed to run.covidestim or runOptimizer.covidestim to execute the model, as long as input data has been added (using the addition operator, see example). This object can also be saved to disk using saveRDS to enable reproducibility across platforms or sessions. However, note that Stan runs are only reproducible under very specific conditions due to Stan's multi-language architecture. The print method is overloaded to return to the user a summary of the configuration, including prior values and the presence or absence of input data.

Examples

# Note that this configuration is improper as it uses New York City
# case/death data, but uses Manhattan's FIPS code and population size.
# (for demonstration purposes only!)
covidestim(ndays = 120, seed = 42, region = '36061', pop_size = 1.63e6) +
  input_cases(example_nyc_data('cases')) +
  input_deaths(example_nyc_data('deaths'))
#> Covidestim Configuration:
#> 
#> Seed:	42
#> Chains:	3
#> Iterations:	2000
#> Warmup runs:	1333
#> Priors: Valid
#> ndays:	120
#> 
#> Priors:
#> 
#> 	log_new_inf_0_mu	0
#> 	log_new_inf_0_sd	10
#> 	logRt_mu	0
#> 	logRt_sd	3
#> 	inf_imported_mu	0
#> 	inf_imported_sd	0.6265664160401
#> 	deriv1_spl_par_sd	0.5
#> 	deriv2_spl_par_sd	0.1
#> 	p_sym_if_inf	[alpha]	5.143
#> 	p_sym_if_inf	[beta]	3.536
#> 	p_sev_if_sym	[alpha]	1.8854
#> 	p_sev_if_sym	[beta]	20.002
#> 	p_die_if_sev	[alpha]	28.239
#> 	p_die_if_sev	[beta]	162.3
#> 	p_die_if_inf	[alpha]	15.915
#> 	p_die_if_inf	[beta]	3167.1
#> 	ifr_decl_OR	[alpha]	12.031
#> 	ifr_decl_OR	[beta]	8.999
#> 	inf_prg_delay	[shape]	3.413
#> 	inf_prg_delay	[rate]	0.6051
#> 	sym_prg_delay	[shape]	1.624
#> 	sym_prg_delay	[rate]	0.2175
#> 	sev_prg_delay	[shape]	2.061
#> 	sev_prg_delay	[rate]	0.2277
#> 	serial_i	[shape]	129.1
#> 	serial_i	[rate]	22.25
#> 	rr_diag	[alpha]sy_vs_sym_a	2
#> 	rr_diag	[alpha]sy_vs_sym	[beta]	18
#> 	rr_diag_sym_vs_sev	[alpha]	2
#> 	rr_diag_sym_vs_sev	[beta]	2
#> 	p_diag_if_sev	[alpha]	20
#> 	p_diag_if_sev	[beta]	5
#> 
#> Inputs:
#> 
#> 	[ 120]	Cases
#> 	[ 120]	Deaths
#> 	[ x ]	Vaccines