🔬 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.

  1. ☑️ Look at ReadMe.txt to get an overview of the code.

  2. ☑️ Invistigate how the code works, that is ensure you understand:
    zurcher.init, zurcher.setup, zurcher.create_grid, zucher.state_transition and zucher.bellman.

  3. ☑️ Fill in the missing stuff in the function zucher.bellman and run the code

  4. ☑️ Solve the model. ☑️ In order to solve the model, you should understand:
    solve_NFXP.init, solve_NFXP.setup, solve_NFXP.poly, solve_NFXP.sa and solve_NFXP.nk.

  5. ☑️ 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.estimate and estimate_NFXP.ll.

  6. ☑️ Fill in the missing stuff in the function estimate_NFXP.ll, and estimate the model to check that your results are correct.

  7. ☑️ Try using lineprofiler in python. Information on the profiler can be found here , install with pip install line_profiler if 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?

  8. ☑️ 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\)?

  9. ☑️ We use the latest \(EV\) guess to start the nfxp.solve procedure 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.

  10. ☑️ 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.

  1. ☑️ Ensure that you understand the code zurcher.sim_data

  2. ☑️ Illustrate the likelihood function for different values of \(RC\) and \(c\)

  3. ☑️ Estimate the model, do you get the correct estimates?

    • (a) Try changing the starting values, does the model converges?

  4. ☑️ 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.

  1. ☑️ Find the equilibrium distribution of mileage

  2. ☑️ 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)

  3. ☑️ Find the implied demand function

  4. ☑️ Try estimate the demand function for different values of \(\beta\). Does the change in the demand function makes intuitively sense?

  5. ☑️ Now introduce five buses (\(M=5\)) instead of one bus, what is the combined demand?

  6. ☑️ What are the advantage and disadvantage of using a structural model to estimate the demand?