run_mcmc: Run data augmented MCMC

Description Usage Arguments Value Examples

View source: R/run_mcmc.R

Description

Run data augmented MCMC

Usage

1
run_mcmc(data = NULL, priors = NULL, configuration = NULL)

Arguments

data

a list containing 4 elements:

patients

a dataframe with three columns. Each row corresponds to a patient, the columns are admission, first_positive_test and discharge. Entries are in days. If there is no positive test for a patient, first_positive_test equals 20000.

test_results_positive

a matrix. Each row corresponds to a patient. Entries correspond to the day of a positive test.

test_results_negative

a matrix. Each row corresponds to a patient. Entries correspond to the day of a negative test.

antibiotics

a matrix. Each row corresponds to a patient. Entries correspond to the day when an antibiotic was administered.

priors

a list containing two lists, functions and params, defining the functions and parameters used as priors. If no input is supplied, default priors are used. Default priors are described in the documentation of generate_priors(). Custom priors can be generated using generate_priors().

configuration

a list of settings. If no input is supplied, default settings are used. Default settings are described in the documentation of generate_configuration(). Custom settings can be generated using generate_configuration().

Value

The function returns a list of two dataframes. The first dataframe contains the chains of the parameter values, with iterations stored as specified in the configuration. The second dataframe contains the chains of the statuses, with iterations stored as specified in the configuration.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
#run example dataset with default priors and default settings.
run_mcmc()

#run example dataset with custom priors and custom settings.
my_priors <- generate_priors(f_beta = dnorm, p_beta = c(0.02,0.001))
my_configuration <- generate_configuration(n_iter = 300, n_burnin = 100)
run_mcmc(data = patient_data_simulated, priors = my_priors,
configuration = my_configuration)

## End(Not run)

mirjamlaager/mrsamcmc documentation built on May 20, 2020, 11:13 a.m.