Skip to content

bamonroe/rcgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rcgen

An R package for simulating choices from experimental economics instruments. Generate synthetic data from discrete choice models to test and validate estimation techniques.

Installation

devtools::install_github("bamonroe/rcgen")

Depends on rcest.

Features

  • Instrument management: Define, store, and retrieve experimental instruments with set_inst() / get_inst()
  • Choice generation: Simulate choices from any likelihood function compatible with rcest via gen_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

Usage

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"))

License

MIT

About

Simulate choices from experimental economics instruments for R

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages