Question
Problem 1: Linear regression with one regressor Please use RStudio to finish the following questions: 1. Class Size 23 19 30 22 23 29 35
Problem 1: Linear regression with one regressor
Please use RStudio to finish the following questions: 1. Class Size 23 19 30 22 23 29 35 36 33 25 Test Score 430 430 333 410 390 377 325 310 328 375 (a) Create the vectors cs (the class size) and ts (the test score) (b) Draw a scatterplot of the results using plot(). (c) Compute the mean, the sample variance and the sample standard deviation of ts. (d) Compute the covariance and the correlation coefficient for ts and cs. (e) Estimate the regression model and obtain a statistical summary of the model. (f) Add the regression line to the scatterplot. (g) Create a new variable R2 and assign the R-squared of the regression 2. Use Caschool dataset to finish the following questions: (a) generate a binary variable indicating whether a schooling district in the CASchools data set has a student-teacher ratio below 20. (b) Use lm() to regress Y on D, i.e., estimate the coefficients in the model. (c) Start by drawing a visually appealing plot of the observations on Y and D
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started