View source: R/benchmark_sampler.R
benchmark_sampler | R Documentation |
Benchmarks draws from a posterior distribution using a rejection sampling approach. Takes in a matrix of posterior draws, and national-level benchmark data.
benchmark_sampler(
posterior_samps,
nregion = NA,
ntime = 1,
natl,
natl_sd,
pop_weights = NA
)
posterior_samps |
a matrix containing posterior draws at the area-level. Rows should be arranged in order arrange(region, time), with each column containing an independent draw from the posterior. |
nregion |
the number of regions you have estimates for. Defaults to the number of rows
in |
ntime |
the number of time points you have estimates for. Defaults to 1. |
natl |
a vector of national level estimates, arranged in order of time if you have multiple time points in your data. |
natl_sd |
a vector of standard deviations for national level estimates, arranged in order of time if you have multiple time points in your data. |
pop_weights |
a vector of population weights for use in the benchmarking constraint. Must sum to one at each time point, and be in order arrange(region, time) |
A list containing:
fitted_list: a list of matrices of benchmarked posterior samples of fitted values in order arrange(time). Each matrix will have rows arranged in order arrange(region).
natl_list: a list of vectors containing aggregated national-level samples that were accepted, in order arrange(time)
prop_accepted: the proportion of samples accepted during sampling.
Taylor Okonek
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.