Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please solve in python 4. This simulation exercise should be done using R. (a) Generate n = 100 observations from the model Y=at BXi+ Vi,

please solve in python

image text in transcribed
4. This simulation exercise should be done using R. (a) Generate n = 100 observations from the model Y=at BXi+ Vi, where a = 1, # = 1, X, ~ N(0, 1) and independent across i, U; ~ N(0, 1) and independent across i, and X, and U; are independent for all i. (b) Let # denote the OLS estimator of 8, and define (1) Compute S and # using the data simulated in (a). (c) Repeat parts (a)-(b) R = 10, 000 times generating new simulated data and re- computing # and # at each iteration to construct {8, : r = 1 ..., R} and (8, : " = 1,..., R}, where , denotes the values of the OLS estimator obtained in iteration r, and S is defined similarly with the OLS estimator replaced by the estimator in (1). Use a for loop in R. (d) Using the simulated values of & and S in part (c), construct histograms describing the distributions of the OLS estimator and S. In R, you can construct a histogram using hist ( ). (e) Based on the histograms in (d), do the two estimators appear to be unbiased? Compute the averages of the simulated estimates of / and 8. Are they close to the true value of 8? (f) Using the simulated values of # and # in part (c), estimate the variances of the two estimators. Which of the two estimators is more efficient? (g) Repeat parts (c)-(f) with sample size n = 10, 000. (h) Describe how the distributions and variances of # and / change with the sample size. Explain your results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Discrete Mathematics

Authors: Gary Chartrand, Ping Zhang

1st Edition

1478616261, 9781478616269

More Books

Students also viewed these Mathematics questions

Question

When is the duration of an asset equal to its maturity? LO.1

Answered: 1 week ago

Question

3. Keep a list of suggestions.

Answered: 1 week ago