We use the dataset "MASchools" in the package "AER". The dataset contains information on test performance, school characteristics and student demographic backgrounds for school districts in Massachusetts (MA). In this exercise, we shall use R-functions in the packages "estimatr", "car" and "ggplot2". Whenever you need to compute standard errors, the type of standard error should be "HC1"or equivalently "stata".
We use the dataset "MASchools" in the package "AER". The dataset contains information on test performance, school characteristics and student demographic backgrounds for school districts in Massachusetts (MA). In this exercise, we shall use R-
The R-code below is supposed to generate a graph similar to Figure 9.1 of Stock and Watson (the left graph on page 19 of Lecture Slides 7) with the three estimated regression functions. However, when you implement it, you find that the resulting graph has a problem.
Choose the wrong statement about the code and/or the generated diagram.
a. The resulting graph shows the data points.
b. The error can be fixed by changing the location of one of the '+' symbols in the code.
c. The unknown expression y ~ poly(x,3) causes the error.
d. The x and y in the formula of geom_smooth are defined as the two arguments in aes( , ) on the first line of code.
e. When the error is fixed, two regression lines have the same colour.


Trending now
This is a popular solution!
Step by step
Solved in 2 steps









