Discretization, Integration and Interpolation

Author

Pablo Winant

Expected Utility of Consumption

Assume consumption is given by \(C(\epsilon)=(\exp({\epsilon}))\) with \(\epsilon\) is a random variable with standard deviation \({\sigma}_{\epsilon}=0.05\).

Set utility of consumption to be: \(U(x)=\frac{x^{-\gamma}}{-\gamma}\).

Goal is to compare several ways to compute \(E_{\epsilon}(U(C(\epsilon)))\) .

We’ll use the calibration \(\gamma=40\) and \({\sigma}_{\epsilon}=0.05\).

(optional) Compute the result in closed form

Hint: \[\int_{-\infty}^{\infty}e^{-(a x^2+bx +c)} dx = \sqrt{\frac{\pi}{a}} e^{\frac{b^2}{4a}+c}\]

# your code

Compute the result using Monte-Carlo simulations. Evaluate the variance of the estimation.

# your code

Compute the result using Gauss-Hermite quadrature

# your code

Interpolation Methods

Take

\[ f(x)=\frac{1}{1+25x^2}, \quad x\in[-1,1] \]

and compare several interpolation methods.

  1. Implement piecewise linear interpolation on an equally spaced grid.
# your code
  1. Compute interpolation errors (max error and RMSE) on a fine grid.
# your code
  1. Plot

  2. Compare with:

  • nearest-neighbor interpolation on the same nodes
  • natural cubic spline interpolation on the same nodes
  • global polynomial interpolation on Chebyshev nodes
# your code
  1. Repeat for \(N=9\) and \(N=21\).
# your code
  1. Comments
# your code