Lab 9
Lab 9
Lab 9
Name:
All Plots must be visualized. Use proper tables (no R screen shots). Do not show codes if not
asked!
In this Lab you will be using lm() to estimate the regression model. The function lm() is part of
the package AER. Attach the package using library(). The RMD file that is attached is information
for how to run this lab using different data, for this lab you will be performing similar
assessments using the following data:
1. A researcher wants to analyze the relationship between class size (measured by the
student-teacher ratio) and the average test score. Therefore, he measures both
variables in 10 different classes and ends up with the following results.
Class Size 23 19 30 22 23 29 35 36 33 25
Test Score 430 430 333 410 390 377 325 310 328 385
Instructions: Create the vectors cs (the class size) and ts (the test score), containing the
observations above.
Draw a scatterplot of the results.
Compute the mean, the sample variance, and the sample standard deviation of
Test Scores.
Compute the covariance and the correlation coefficient for Test Scores and Class
Size.
Estimate the regression model using lm(). To find out more about this function
use help. Assign the result to mod.
Obtain a statistical summary of the model. Report the findings here in a proper
table with explanation.
Create a new scatterplot with the regression line from the first bullet. Use the
object mod to create the abline (abline()).
2. Now, Using the CASchools Data you are going to regress income on to test scores.
Write the regression model for this relationship.
Provide the summary stats and correlation coefficient for these variables. Plot
the scatter plot. Describe your findings.
Estimate the regression model. Store the information that is contained in the
output of summary(), assign the output of summary(mod) to the variable
inc_mod. Report the findings of the model.
Calculate the Sum of Squared Residuals and the Total Sum of Squares. Now
compute the R2 manually. Discuss what the SSR and TSS are. Discuss what the R2
is. Report the R2 of this model.
Report the SER and what it is.
3. Explain the three assumptions of OLS in your own words.