Repad is an algorithm that captures and controls for high-dimensional variables in the dynamic discrete choice models. It builds on the idea behind recursive partitioning to discretize the state space and reduce the dimensionality of a high-dimensional control variable set to a lower-dimensional categorical variable using a weighted sum of decision probabilities and state transition probabilities. For more information about the algorithm, please read the first draft of the paper in the following.
https://papers.ssrn.com/sol3/papers.cfm?abstract_id=4640309
This repository contains five modules. The discretization algorithm is implemented in the file "discretizer." The rest of the modules are provided to experiment with the algorithm using two canonical settings:
- An infinite-horizon Rust (1987) bus engine replacement problem.
- A finite-horizon durable good adoption problem similar to Song & Chintagunta (2003). The modules are as follows:
- discretization_generator: This module can generate a random discretization in a high-dimensional state space. It can be used to generate a discretized high-dimensional variable set.
- data_generator: This module provides two classes to generate simulation data:
EngineReplacementDataGeneratorfor infinite-horizon bus engine replacement problem.DurablesAdoptionDataGeneratorfor finite-horizon durable goods adoption problem.
- discretizer: This module is the main algorithm and discretizes a high-dimensional state space to a one-dimensional categorical variable.
- estimator: This module provides two classes to estimate model parameters:
BusEngineNFXPfor infinite-horizon bus engine replacement problem.DurablesAdoptionEstimatefor finite-horizon durable goods adoption problem.
- utility: This module provides some functionalities that are used across all other modules.
To install the required dependencies for this project, follow these steps:
- Clone this repository to your local machine.
git clone https://github.com/ebzgr/RePaD.git
cd RePaD
- (Optional but recommended) Create a virtual environment to isolate the dependencies for this project.
python3 -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
- Install the package and all dependencies:
pip install -e .
This will install RePaD in editable mode, using the full list of dependencies in requirements.txt.
Please refer to the following example files to see how to use the package for each setting:
examples/bus_engine_example.pyexamples/durable_good_example.py
These scripts demonstrate how to generate a random discretization, generate data, recover the partitioning using the data-driven discretization algorithm, and estimate the parameters of the problem.
Please reach out to Ebrahim Barzegary (barzegary@essec.edu) or Hema Yoganarasimhan (hemay@uw.edu) for questions regarding the algorithm or package.
Rust, John. "Optimal replacement of GMC bus engines: An empirical model of Harold Zurcher." Econometrica: Journal of the Econometric Society (1987): 999-1033.
Song, Inseong, and Pradeep K. Chintagunta. "A Micromodel of New Product Adoption with Heterogeneous and Forward-Looking Consumers: Application to the Digital Camera Category." Quantitative Marketing and Economics 1, no. 4 (2003): 371–407.