An R package for simulating choices from experimental economics instruments. Generate synthetic data from discrete choice models to test and validate estimation techniques.
devtools::install_github("bamonroe/rcgen")Depends on rcest.
- Instrument management: Define, store, and retrieve experimental instruments with
set_inst()/get_inst() - Choice generation: Simulate choices from any likelihood function compatible with
rcestviagen_choice() - QSR tasks: Built-in generators for Quadratic Scoring Rule instruments (
qsr_task,sqsr_task), as used in token allocation belief elicitation tasks - Covariate support: Generate heterogeneous choices with covariate-dependent parameters
library(rcgen)
library(rcest)
# Create a QSR instrument with 10 tokens
tname <- qsr_task(tokens = 10, apar = c(5, 10), bpar = c(3, 6), prob1 = c(0.5, 0.25))
# Generate an instrument for 100 subjects with given parameters
inst <- gen_inst(tname, pmat = param_matrix, n = 100)
# Simulate choices
inst <- gen_choice(inst, lfun = my_likelihood, ftypes = list(ufun = "crra", pfun = "eut"))MIT