Anda di halaman 1dari 2

SINGAPORE MANAGEMENT UNIVERSITY

School of Economics

Econ107 Introduction to Econometrics


Assignment 2
Due: Thursday, 2 March 2017

Note that this exercise modifies Johnson Ch 4. We intend to run 1000 replications of OLS from
simulated data with sample size set to be 50, 200.

Do Steps 1-3 of Ch 4 (read Johnson for the explanation)

Step 1

create MonteCarlo U 1 50 (this command creates a workfile with sample size of data set at 50)
matrix(1000,1) beta1 (this command creates a vector at the dimension of 1000)
series x = 10+nrnd (this command will generate variable x and be fixed from now on)

For Step 2, you create a short program and run it. To do this, click File/New/Program. In the
program window, key in the following program:

FOR !C = 1 TO 1000 (where !C stands for an index and 1000 is the number of replications)
SERIES Y=X+NRND (#)
EQUATION EQ1.LS Y C X
BETA1(!C)=@COEFS(2)
NEXT

then click run in the program window. Now you may view the 1000 betas you have sampled.
Give this program a name before you close the program window.

Step 1 creates a series X of independent variables with 50 observations. In Step 2 you generate
a sample for the dependent variable Y with zero intercept and slope of 1, and an error term
which is normally distributed with mean zero and standard deviation 1. So Y must have 50
observations. And then you run a linear regression model of Y on X to get the slope coefficient
estimate. You save this estimate into vector beta1.

If you repeat these 3 lines, you can get another sample for Y (while X is fixed), and hence
another slope coefficient estimate. If you repeat these 3 lines for 1000 times, you can get 1000
betas. Note that For loop and !Care used in program so that you do not need to re-type the
commands.
Step 3

CREATE BETA WF U 1 1000

And then copy 1000 numbers in BETA1 into the workfile BETA. Remember to save Workfile
and the Program for future use. In the end you should have a histogram for the 1000 slope
coefficient estimates. The histogram represents the sampling distribution of the OLS estimator
of beta1.

Now do the following modifications:

1) Change sample size to 200 (which command do you have to change?).

2) Change (#) to: SERIES Y=X+@rtdist(4) (The error term is now t distributed with 4 degrees
of freedom), with sample size of 50 and 200.

You will need to hand in an EViews printout of the histograms of the betas and a
summary of the statistical distribution of the betas. Write a short paragraph of what you
observed. Examine how the histogram changes with the sample size and the error
distribution.

Anda mungkin juga menyukai