A Grade.
Task:
Fall 2024
This assessment is to be undertaken by groups of 3 to 4 students. Please read this section carefully before
you proceed.
Answers need to be typed using a text editor. Hand-written answers (or photos of hand-written notes)
will not be accepted. Your report should be converted to pdf before you submit it.
Please include the R-code used in your submitted document. If it is not possible to copy-paste the code
from your pdf-file
A Grade.
Task:
Fall 2024
This assessment is to be undertaken by groups of 3 to 4 students. Please read this section carefully before
you proceed.
Answers need to be typed using a text editor. Hand-written answers (or photos of hand-written notes)
will not be accepted. Your report should be converted to pdf before you submit it.
Please include the R-code used in your submitted document. If it is not possible to copy-paste the code
from your pdf-file into R, please submit an appendix file with the R-code as well. If the exam written in R
markdown / R notebook and converted to pdf, this should not be necessary.
Please do not write too much. A short answer is often better than a long answer. About 5 pages should
be sufficient to answer the problems in this problem set.
There are 9 subproblems. Each will count ten percent, except subproblem 2d, which counts double.
Exercise 1
In this exercise, we will consider data from the dataset ”sleep75” from the ‘wooldridge‘ package. Recall that
you can learn more about the dataset with ”?sleep75”. Unfortunately, this dataset has some missing values.
To avoid the problems this can cause, we will instead consider the dataset of only complete entries by
SleepData = na.omit(sleep87)
For the full Exercise 1 we will use variables from ”SleepData”.
1a
We consider first the model
sleep = β0 + β1age + u.
where sleep is the number of minutes of sleep per week, while age in years. Complete the regression of sleep
on age. Explain the estimate of β1, and comment on the p-value produced by the ‘summary‘ command.
1b
Next we consider a model
sleep = β0 + β1age + β2lhrwage + u.
Here, lhrwage is log of the hourly wage.
• What would you assume the correlation between age and lhrwage is? Give a reason for what you would
expect the sign of β2 to be.
• From the previous reasoning, explain if you think there is a bias in 1a, and if so, what the sign of the
bias is.
• Complete a regression of sleep on age and lhrwage. Comment on the results.
1c
In the previous model, you suspect that that the estimated effect of age on the number of hours of sleep is
too large. You suspect that much of the effect is because older people are more likely to be retired. Hence,
they are out of work, and have more time for sleep.
Create your own model, where you also test the assumption that people’s sleeping habits depend on
whether or not they are employed. You also do not assume that age has the same effect for employed people
compared to the non-employed. Explain your model, complete the regression and comment on the result.
Hint: Again, looking at the variables using the command ‘?sleep75‘ could be helpful.
1d
One of your fellow students is skeptical of your model, and claims that participation in the labor force does
not need to be in the model, and has no real use in explaining differences in sleeping habits. What would
you do to prove your collegue wrong?
Exercise 2
We consider two artificial models
yi = 3 + 2xi + ui, Yi = 3 + 2xi +Ui.
We consider n = 100 samples.
• xi is sampled uniformly from the interval [0, 2].
• ui is sampled from a normal distribution with mean 0 and standard deviation 1, so from N(0, 1).
• Ui = vi +wixi, where both vi and wi are sampled from N(0, 1) as well.
• ui, vi, xi and wi are all independent.
2a
Set seed equal to the last two digit of a group members’ student number. Generate the samples above.
Make a scatter plot of (xi, yi) and (xi, Yi). From the plot, make an initial guess of if the models satisfy
homo-/heteroskedasticity.
2b
Argue for why the model for y satisfies/does not satisfy MLR.5 Homoskedasticity. Do the same for Y. Answer
then the same question for both y and Y for MLR.4.
2c
Complete a regression of Y on x, and give details using the ‘summary‘ command. Which of the numbers in
the summary table are not correct if we have heteroskedasticity?
2d
Again set seed to the value in (a). We will now complete a Monte Carlo simulation. Complete nrep = 10000
simulations, where we generate y and Y from n = 100 samples. We compute the regression of both y and Y
on x.
• For each iteration and for both models, compute the slope variable β1. Take the average of all 10 000
iterations. Explain the result.
• Also, for each iteration, at 5%, test the hypothesis
H0 : β1 = 1, H1 ̸= 1.
We use the usual standard errors, assuming homoskedasticiy. Compute what percentage of the iterations
where we keep H0. We complete this for both y and Y. Comment on the result.
2e
Again set seed to the value in (a). Redo exercise 2d, but now we use robust standard errors. Comment on
the result. Do we need to find the mean of the β1-coefficients again?
Du må være innlogget og ha kjøpt dette dokument for å kunne gi en omtale.