This book is in Open Review. We want your feedback to make the book better for you and other students. You may annotate some text by selecting it with the cursor and then click the on the pop-up menu. You can also see the annotations of others: click the in the upper right hand corner of the page

9.5 Exercises

1. Simulation Study: Misspecification of Functional Form

As stated in Chapter 9.2, misspecification of the regression function violates assumption 1 of Key Concept 6.3 so that the OLS estimator will be biased and inconsistent. We have illustrated the bias of ˆβ0^β0 for the example of the quadratic population regression function Yi=X2iYi=X2i and the linear model Yi=β0+β1Xi+ui,uiN(0,1)Yi=β0+β1Xi+ui,uiN(0,1) using 100 randomly generated observations. Strictly speaking, this finding could be just a coincidence because we consider just one estimate obtained using a single data set.

In this exercise, you have to generate simulation evidence for the bias of ˆβ0^β0 in the model Yi=β0+β1Xi+uiYi=β0+β1Xi+ui if the population regression function is Yi=X2i.Yi=X2i.

Instructions:

Make sure to use the definitions suggested in the skeleton code in script.R to complete the following tasks:

  • Generate 1000 OLS estimates of β0β0 in the model above using a for() loop where XiU[5,5]XiU[5,5], uiN(0,1)uiN(0,1) using samples of size 100100. Save the estimates in beta_hats.

  • Compare the sample mean of the estimates to the true parameter using the == operator.

Hint:

You can generate random numbers from a uniform distribution using runif().

2. Simulation Study: Errors-in-Variables Bias

Consider again the application of the classical measurement error model introduced in Chapter 9.2:

The single regressor XiXi is measured with error so that XiXi is observed instead. Thus one estimates β1β1 in Yi=β0+β1Xi+β1(XiXi)+ui=viYi=β0+β1Xi+vi

instead of Yi=β0+β1Xi+ui,

with the zero mean error wi being uncorrelated with Xi and ui. Then β1 is inconsistently estimated by OLS: ˆβ1pσ2Xσ2X+σ2wβ1

Let (X,Y)N[(50100),(105510)]. Recall from (9.2) that E(Yi|Xi)=75+0.5Xi in this case. Further Assume that Xi=Xi+wi with wii.i.dN(0,10).

As mentioned in Exercise 1, Chapter 9.2 discusses the consequences of the measurement error for the OLS estimator of β1 in this setting based on a single sample and and thus just one estimate. Strictly speaking, the conclusion made could be wrong because the oberseved bias may be due to random variation. A Monto Carlo simulation is more appropriate here.

Instructions:

Show that β1 is estimated with a bias using a simulation study. Make sure to use the definitions suggested in the skeleton code in script.R to complete the following tasks:

  • Generate 1000 estimates of β1 in the simple regression model Yi=β0+β1Xi+ui. Use rmvnorm() to generate samples of 100 random observations from the bivariate normal distribution stated above.

  • Save the estimates in beta_hats.

  • Compute the sample mean of the estimates.