P1. Use a gradient hill-climbing algorithm to maximize the following
function of two variables (x,y) starting from the initial point
(0,0):
f(x,y)=10*exp(-[(2/3)*(x-.2)^2-(2/3)(x-.2)(y-.1)+(2/3)(y-.1)^2])+
9*exp(-4*[2(x+1)^2+2(x+1)(y-3)+2(y-3)^2])+sin(xy)-2cos(xy)
- Can you use the BHHH algorithm to optimize this function?
- Use a gradient hill-climbing algorithm with analytically computed
second derivatives. Can you get the hill climbing algorithm
to converge starting from (0,0)? Try starting from some other
points: (-1,-1) (-1,5) (4,2) (10,-10). Does the algorithm
converge for these different starting values? If so does it
converge to the same point in each case?
- Repeat the above exercise but using initially
the identity matrix as an estimate of the hessian at (0,0)
and the BFGS algorithm for computing an approximate inverse Hessian.
- From inspection of the function, can you guess what its true
global is (assuming it exists)? Do a surface plot of
the function: does the surface plot give you some
clues about where the global maximum
is located, and some insight into
the problems a gradient hill-climbing
algorithm may be experiencing?
- Implement the simulated annealing algorithm as described
in Numerical Recipes. Launch the simulated
annealing algorithm from the various starting
points in part 2 above. Does this method
invariably converge to the global optimum
of this function (if it exists)?
P2. Access the Gauss code for the nested fixed point
algorithm at
http://gemini.econ.yale.edu/jrust/nfxp.html and use
it to answer the following questions.
- Assume the discount factor beta=.9999.
Estimate a model of bus engine replacement where the monthly
cost of maintaining a bus with x accumulated miles is a linear
function of x. Use the full sample of buses in the data set
to estimate the unknown parameters. Is it possible to estimate
the intercept of the maintenance cost function c(x)?
- Now treat beta as an unknown parameter to be estimated.
Is the nested fixed point algorithm successful in finding
joint maximum likelihood estimates of beta, the slope
of the cost function, and the cost of replacing a bus engine?
- Now change the cost function to a cubic function and
attempt to estimate the unknown parameters. Does the algorithm
experience troubles finding a maximum likelihood estimate?
If you have trouble getting the algorithm to converge, does
it help if you set beta to a fixed value such as .9999?
- Repeat steps 1 and 3, but also include a lagged dependent
variable in the estimation (i.e. a dummy variable indicating whether
the bus engine was replaced last period). Is the coefficient estimate of
this lagged dependent variable statistically significantly different
from 0?
- Use the parameter estimates from step 1 to compute the
stationary distribution of mileage on buses in the bus fleet
under the optimal replacement policy implied by the maximum likelihood
parameter estimates. Using the stationary distribution, calculate
a) the mean mileage on a bus at the time a bus engine is replaced,
b) the unconditional mean mileage (odometer) for all the buses
in the fleet, and c) the fraction of buses which have their engines
replaced in any given month.
- Treating the cost of replacing a bus engine as a parameter, compute
the expected ``replacement demand function'' as this parameter varies
between one half and twice the nested fixed point algorithm's
maximum likelihood estimate of this parameter. Plot the mean number
of engine replacements per month (in steady state)
as a function of this cost of replacment.
- Finally, show how this ``replacement demand curve'' shifts if we
assume that the discount factor beta=0. Plot this next to the
demand curve computed under the assumption that beta=.9999.
Send questions/comments to: jrust@econ.yale.edu
|