library(rio)
acs <- import("https://github.com/marctrussler/IIS-Data/raw/main/ACSCountyCOVIDData.Rds", trust=T)Problem Set 5
Problem Set Due Monday, December 9th at 7pm on Canvas.
You will hand in a .Rmd file and a knitted html output.
I have provided the raw RMD of this problem set you can use as a template for answering.
Question 1
Load in the file acs, which contains demographic information on every country. This dataset also includes the columns cases.per.1000, which gives the total number of COVID cases per 1000 residents recorded in that county on April 30, 2020.
Plot the bivariate relationship between
percent.transit.commuteon the x-axis andcases.per.1000on the y-axis. Describe what you find.Estimate the bivariate regression: \(\hat{Cases.per.1000} = \hat{\alpha} + \hat{\beta_{t}Perc.Transit_i}\). Evaluate and explain the intercept and \(\hat{\beta_{t}}\). Interpret the hypothesis test being performed for \(\hat{\beta_{t}}\).
In words: why might this relationship between transit commuting and COVID cases be misleading?
Look in the data set for a variable that might be an omitted variable for the regression in (b) (there is not one answer here), why does variable meet the criteria? Use correlation to show it meets the minimum criteria to be an omitted variable.
Now re-estimate the regression from (b) and add in your proposed omitted variable. Interpret the intercept and the two slope coefficients. How did the coefficient on \(\hat{\beta_{t}}\) change?
Determine if the coefficient on \(\hat{\beta_{t}}\) from the regression in (b) is statistically distinct from the coefficient on \(\hat{\beta_{t}}\) in part (e) using the bootstrap.
Question 2
Copy in the following code to generate two related variables, x and y:
set.seed(19104)
x <- rnorm(100,100,30)
y <- 50 + 3*x + rnorm(100, sd=60)Plot the bivariate relationship between these two variables and estimate the regression of
xpredictingy.Using the provided code, repeatedly re-sample these two variables and generate a sampling distribution of the slope coefficient for the regression of x on y. Plot this sampling distribution, and report the standard error.
What if we want to generate a smaller standard error? Edit the above code in 2 distinct ways that will produce a smaller standard error. Re-sample the data a large number of times, plot the sampling distribution, and report the standard error to show that each change did indeed produce a smaller standard error. (To be clear, you need to make one change, re-sample, and show you have a smaller standard error. Then make a second, distinct, change, re-sample, and show that also produces a smaller standard error.) Reference the equation for the standard error of a regression coefficient to explain why your 2 changes worked.