Week 9 – Numerical Approximation & Simulation

Learning Outcomes

By the end of this week, students will be able to:

  1. Implement numerical differentiation and integration in MATLAB.
  2. Understand and use MATLAB’s random number generation functions.
  3. Apply Monte Carlo simulation techniques to economic problems.
  4. Simulate sampling distributions of estimators.
  5. Interpret simulation results in the context of econometric inference.

Suggested Readings

In-Class Activities

  • Numerical differentiation: Forward, backward, and central differences for a Cobb–Douglas production function.
  • Numerical integration: Trapezoidal and Simpson’s rule to compute present value of a stream of income.
  • Random number generation: Draw samples from uniform and normal distributions; set seeds for reproducibility.
  • Monte Carlo simulation:
    • Generate repeated samples from a simple regression model ( y = \beta_0 + \beta_1 x + u ).
    • Estimate OLS coefficients in each sample.
    • Plot the sampling distribution of ( \hat{\beta}_1 ) and compare to the theoretical distribution.

Homework / Practice

  • Write a function montecarlo_ols that:
    • Takes sample size n, number of replications R, and true parameters as inputs.
    • Returns the simulated sampling distribution of the slope coefficient.
  • Use the function to investigate how increasing n changes the sampling distribution’s variance.
  • Numerically integrate a CRRA utility function over a given consumption range and compare results from trapezoidal and Simpson’s rules.

Files

Homework submission

  • Submit your homework here
  • Please upload your homework as a single zip file. Access it’s now open with any email address! But remember to name your file with your full name and or student ID.
  • The submission should include the .m file used to produce the results.
    • You can modify you submission until the beginning of week 10.