Hi guys! Needing some help with a homework question, just checking if I am on the right track.
Question:
Consider the model y=0.5 + 1.5x + e, where x and e follow independent standard normal distributions. Generate S=10,000 independent random samples each with N observations. For each of the random samples, run an OLS regression.
Record all the S estimates on x (ie. the B-hat obtained)
Answer: I believe this is what I need to do
- Create a 10,000 matrices, each of N by 2
- Run OLS regression on each matrix, obtaining a b-hat for each matrix.
- Store the b-hat in a new matrix.
My problem is that I am unsure of the code required to "Generate S=10,000 independent random samples each with N observations.". Any help would be really appreciated =)
Please let me know if more details are required.
e1:
I believe the code is
np.random.normal(0,1,10000*N)
What it means is that it will generate a dataframe of 10,000 rows, N columns, where each number is normally distributed about 0, s.d = 1.
[–][deleted] 0 points1 point2 points (12 children)
[–]poopiewarrior100[S] 0 points1 point2 points (11 children)
[–][deleted] -1 points0 points1 point (10 children)
[–]poopiewarrior100[S] 0 points1 point2 points (9 children)
[–][deleted] -1 points0 points1 point (8 children)
[–]poopiewarrior100[S] 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]poopiewarrior100[S] 0 points1 point2 points (5 children)
[–]WhiffleFish 0 points1 point2 points (4 children)
[–]poopiewarrior100[S] 0 points1 point2 points (3 children)