This package implements Julia code for the basic model in "Dynamic Discrete Choice Models: Methods, Matlab Code, and Exercises" of Abbring and Klein (2020). Detailed explanations of the model and the Matlab code are available here: https://ddc.abbring.org/dynamicDiscreteChoice.m.html
The goal is to set up the basic model and offer a package structure that easily extends to more complex DDC problems. Most functions are explained through docstrings (e.g. type ?estimate_model to see the documentation). Steps in individual functions are explained in the respective source files.
The package implements the type DDCbasic; a structure for the basic model containing the parameters and simulation/estimation options. To check which functions and types the package exports, check the file src/DDCModelsExample.jl.
Various functions implement multi-threading for faster execution times. To use e.g. 8 threads, start Julia with julia --threads 8. In VScode, the number of threads can be set in the Julia extension settings. Note that for a running Julia instance, the number of threads cannot be changed.
To see how to use the package, check the file test/runtests.jl, which sets up unit tests based on Julia's Test framework. Specifically, it:
- constructs a
DDCbasicmodel - simulates data from this model
- estimates the transition matrix
- estimates parameters
- calculates standard errors of the parameter estimates.
Note, the package was tested and should be run with Julia version 1.6. or newer.
- Download and extract the package from Github (e.g. through
git clone) - In Julia, navigate to the package folder (or open the folder in VSCode)
- Activate environment:
using Pkg; Pkg.activate(".") - Install dependencies:
Pkg.instantiate() - Test to verify it runs correctly:
Pkg.test("DDCModelsExample") - Load the package with
using DDCModelsExample
- types.jl: Contains all type definitions
- support.jl: Defines support functions that are useful for (potentially) various differing models
- models/DDCbasic.jl: Functions specific to the
DDCbasicmodel (e.g. flowpayoffs, loglikelihood etc.) - test/runtests.jl: Implement unit tests
- test/speedtest.jl: Setup for running speed tests