Robust-StdErrors.R

37 views 12:48 pm 0 Comments March 3, 2023

This question will have you answer the following questions about the R code “Robust-StdErrors.R”. This code runs a simulation designed to test the performance of robust standard errors to correct for heteroscadasticity relative to the OLS standard errors that assume no heteroscadasticity or autocorrelation.


Lines 8-13 of the code define a number of parameters that are used within simulation. Trace through the code and describe what role each of these parameters plays in structuring the simulation.


Explain what part of the code creates heteroscadasticity in the unobserved variables when running the regression on line 33.


Line 49 defines a variable called “withinCI”. Highlight what values that this variable can take on and under what circumstances it takes each of the potential values.


Explain what the values of “numwithinCIols” and “numwithinCIrobust” representon lines 52 and 67 of the code, respectively.


Run the simulation. What do you conclude about the appropriateness of using OLS and robust standard errors when analyzing these data based on the values of ‘numwithinCIols” and “numwithinCIrobust” that the simulation generates?


Edit the code in a way such that the unobservable variables are homoscedastic and rerun the simulation. Based on these results, what do you conclude about the best course of action when you are uncertain whether the unobserved variables are homoscadastic or heteroscadastic and you have a sizable amount of data?