# Zurcher.jl

• This is a teaching-oriented package for the Bus Engine Replacement Model after Rust (1987) used for my Computational Econ Course
• We implement both naive nfxp and mpec estimation. It is naive nfxp because it uses standard VFI instead of the much more performant polyalgorithm developed by Rust in his paper. For a thorough benchmarking exercise I refer to
1. ECTA Comment by Fedor Iskhakov, Jinhyuk Lee, John Rust, Bertel Schjerning, Kyoungwon Seo
2. Matlab implementation which includes the polyalgorithm and analytic derivatives for likelihood function distributed as part of the DSE2019 summer school. Several parts of my code have been copied and modified from that code base.

### What is the point of this package?

• The main point is to demonstrate the relative easiness with which we can tackle an MPEC problem with the JuMP.jl package.
• JuMP is like AMPL, but for free and embedded in a proper programming language.
• For a similar, even more impressive demonstration of this please visit https://github.com/UBCECON567/BLPDemand.jl
Zurcher.HaroldType

Harold Zurcher DataType

• This type represents an instance of Harold Zurcher, the decision maker in Rust (1987)
• The default constructor builds Harold for the values in table X of the paper.
source
Zurcher.bellmanMethod
bellman(h::Harold, ev0::Vector)

Bellman Operator T(EV). Notice the centering of the log sum function by M.

source
Zurcher.ccpMethod
ccp(h::Harold, ev0::Vector)

Conditional Choice Probability function returning the proability of replacing the engine at a given mileage state x.

source
Zurcher.loglikelihoodMethod

log likelihood function

$$$l_n(\theta,EV_\theta) = \log \mathcal{L}_n(\theta,EV_\theta) = \sum_{i=1}^{162}\sum_{t=2}^{T_i} \left( \log P(d_{i,t}|x_{i,t}) + \log \pi(x_{i,t}|x_{i,t-1},d_{i,t-1}) \right)$$$
source
Zurcher.make_transMethod
make_trans(θ, n)

Build a transition matrix of mileage states for n mileage bins and a vector θ of probabilities to move to each possible bin (or to stay in the same bin).

source
Zurcher.mpecMethod
mpec(; β = 0.9, is_silent = false, doθ = false,n = 175, θ = [0.107, 0.5152 ,0.3622, 0.0143,0.0009])

MPEC estimation. Can choose to do partial MLE (don't estimate the θs for mileage transition).

source
Zurcher.nested_likelihoodMethod
nested_likelihood(x::Vector{Float64}, h::Harold, d::DataFrame)

Outer loop of NFXP proceedure. takes candidate vector x of parameters, solves model, and evaluates the log likelihood.

source
Zurcher.nfxpMethod
nfxp(; β = 0.9, is_silent = false, doθ = false,n = 175, θ = [0.107, 0.5152 ,0.3622, 0.0143,0.0009])

Nested Fixed Point estimation. Can choose to do partial MLE (don't estimate the θs for mileage transition).

source

end