Applied Exercises
Last updated
Was this helpful?
Last updated
Was this helpful?
In this exercise you will estimate a logit regression model using maximum likelihood.
Recall the log likelihood of the logit model from Section 1:
Using the dataset provided in Section 1, write a script that estimates the unknown parameter using
fminunc
fminsearch
fminbnd
In this exercise you will estimate an AR(1) regression using Maximum Likelihood.
This task consists of two parts. In the first part you will simulate data from a stationary AR(1). In the second part you will use this data to estimate the AR(1) model by MLE and verify that you correctly estimated and .
Simulate data from a stationary AR(1) model building on the code example we covered in Part A of unit 4. Set and use and use 200 burn-in periods. Use the same parameter values that we used in the example. After you have simulated the data, export the vector containing the values into a .mat file using the save
command.
Create a new script and load the .mat file you just generated. Write function file for the target function which calculates the likelihood given parameter values for and . Then, create a new script and use fminunc
to estimate and from the data on you just imported.
Note: Remember that you have to choose sensible starting values for the optimisation algorithm. Make sure these starting values are different from the true parameter values you used to generate the data.
Consider the following stable AR(1) model
\begin{align}\log \mathcal{L}(y; \phi,\sigma^2) = &-(T/2) \log(2\pi) -(T/2) \log(\sigma^2)-(2\sigma^2)^{-1}\sum_{t=2}^{T}(y_t-\phi y_{t-1})^2 \\ &+ (1/2)\log(1-\phi^2)-(2\sigma^2)^{-1}(1-\phi^2)y_1^2 \end{align}
In this exercise you will solve an optimal consumption problem using MATLABs numerical solvers.
First solve the one-dimensional problem using the fzero
function.
Then solve the one-dimensional problem using the fminunc
function.
We would like to estimate the unknown parameters by maximum likelihood. Therefore we would like to find the values of and which maximize the following log-likelihood.
Consider a consumer who solves the following consumption () vs. leisure () problem
subject to the budget constraint where is the wage.
Write a Matlab program that solves this problem for given parameter values of , , , and . In particular
Start by reducing the problem to a one-dimensional problem in either or .