posterior_predictive_checks: Run forward simulations

Description Usage Arguments Value

View source: R/posterior_predictive_checks.R

Description

Run forward simulations

Usage

1
posterior_predictive_checks(data, chains, n_iter, seed = 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.

chains

a list with the output from run_mcmc(). The list contains two dataframes. The first dataframe contains the chains of the parameter values, with iterations stored as specified in the configuration of run_mcmc(). The second dataframe contains the chains of the statuses, with iterations stored as specified in the configuration of run_mcmc().

n_iter

the number of forward simulations.

seed

set a seed for reproducibility of the simulations.

Value

The function returns a list with three elements:

positive_tests

the number of positive tests in each simulation.

negative_tests

the number of negative tests in each simulation.

parameter_samples

the random samples from the chains that were used for the simulations.


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