🔬 Fourth lab#
Exercises are prepared by Patrick Kofod Mogensen and Maria Juul Hansen, University of Copenhagen.
🛠 Task 4.1: Replication of Rust (1987)#
⏱ Expected work time 60 minutes
The exercise set contains exercises for solving the Zucher problem with NFXP, and estimating the model using real busdata.
☑️ Look at
ReadMe.txtto get an overview of the code.☑️ Invistigate how the code works, that is ensure you understand:
zurcher.init,zurcher.setup,zurcher.create_grid,zucher.state_transitionandzucher.bellman.☑️ Fill in the missing stuff in the function
zucher.bellmanand run the code☑️ Solve the model. ☑️ In order to solve the model, you should understand:
solve_NFXP.init,solve_NFXP.setup,solve_NFXP.poly,solve_NFXP.saandsolve_NFXP.nk.☑️ Now we have to estimate the model. In order to estimate the model. In order to estimate the model, you should understand
zucher.read_busdata,estimate_NFXP.estimateandestimate_NFXP.ll.☑️ Fill in the missing stuff in the function
estimate_NFXP.ll, and estimate the model to check that your results are correct.☑️ Try using
lineprofilerin python. Information on the profiler can be found here , install withpip install line_profilerif not already installed with Anaconda. This gives you a lot of information about the performance of your code.(a) Now try changing the optimizer options, and turn the use of the non-numerical Hessian off. What happens?
(b) Now also try it with the analytical gradient off, what happens?
☑️ Try estimate the model for different values of \(\beta\).
(a) Why can we not estimate \(\beta\)?
(b) When estimating with different \(\beta\), do the changes in the estimates of c and/or RC make intuitively sense?
(c) Can you think of some data/variation, which could allow us to identify \(\beta\)?
☑️ We use the latest \(EV\) guess to start the
nfxp.solveprocedure even though we change \(\theta\) from one likelihood iteration to another. Why do you think we do that?(a) What if we started with \(EV = 0\) in each iteration? Try that and see what happens with the parameters and the numerical performance.
☑️ Try setting the maximum number of miles (odometer reading) to 900. Now the absorbing state is much higher.
(a) If we adjust the number of grid points as well, so that we have a comparable model (multiply the number of grids by 2), do we get a better fit?
(b) Try to lower the number of grid points to 175 again. How do the parameters change? Are the changes intuitive?
(c) What if you change the max to 225 and half the number of grids (hint: what goes wrong?)?
🛠 Task 4.2: Solve and Estimate using simulated data#
⏱ Expected work time 60 minutes
This task contains contains steps for preparing a Monte Carlo study of the NXFP estimator using simulated data from the Zurcher model.
☑️ Ensure that you understand the code
zurcher.sim_data☑️ Illustrate the likelihood function for different values of \(RC\) and \(c\)
☑️ Estimate the model, do you get the correct estimates?
(a) Try changing the starting values, does the model converges?
☑️ What happen if you change the maximum number of Newton-Kantorovich iterations to 1? Do we get convergence? Do the estimates seem right?
🛠 Task 4.3: Demand function#
⏱ Expected work time 60 minutes
In this task you are running a counterfactual experiment to build up the demand function for the replacement engines.
☑️ Find the equilibrium distribution of mileage
☑️ Find the scale of the cost function
(a) How does the scale relates to the estimates of \(RC\) and \(c\)?
(b) What is the scale estimate? Hint: Use the structural estimates and table III in Rust (1987)
☑️ Find the implied demand function
☑️ Try estimate the demand function for different values of \(\beta\). Does the change in the demand function makes intuitively sense?
☑️ Now introduce five buses (\(M=5\)) instead of one bus, what is the combined demand?
☑️ What are the advantage and disadvantage of using a structural model to estimate the demand?