This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Plots | |
using StatsPlots, Turing | |
using Distributions, LinearAlgebra, Random, FillArrays | |
Random.seed!(12334455) | |
# ------------------------------------------------------- | |
# Models/functions for OLS and IV | |
# Only implemented with a single RHS variable -- easy | |
# to extend to multiple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Basic implementation of Bayesian Logit and BLP | |
# In both cases, we model the observed market shares as coming from | |
# a logit model with measurement error. | |
using Plots | |
using StatsPlots | |
using DataFrames | |
using Turing, FillArrays | |
using LinearAlgebra, DynamicHMC |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file contains a basic implementation of the FKRB estimator for the random coefficients logit model in Julia. | |
# In particular, it implements a constrained elastic net version of the estimator with aggregate data. | |
# -- Fox, Kim, Ryan, and Bajari (2011) https://onlinelibrary.wiley.com/doi/abs/10.3982/QE49 | |
# Written by James Brand, 2023 | |
# The main components of the code include: | |
# - The `logexpratio` function, which calculates market shares for a given parameter vector. | |
# - The `FKRBProblem` struct, which represents the FKRB problem and stores relevant data and results. | |
# - The `define_problem` function, which defines the FKRB problem based on input data and variables. |