Reference no: EM132396778
Linear regression basics
Interpreting R's output of a regression model
In lecture 12, we investigated the relationship between math and read scores in the High School and Beyond survey. In this homework, you will take a closer look at the R's model output.
1. Load the dataset hsb2 in R from the library openintro.
2. Produce a scatterplot of math vs read score. If we want to predict math scores based on read scores, which variabled should be on the y-axis?
3. The following command fits a linear regression model (math) = a + b × (read) to the data, and store the output in a variable called model
model <- lm(math ~ read, data =hsb2) Run this command, print the model, and write down the equation that R fitted to the data.
4. Interpret the intercept (a) and the slope (b) in the context of this problem (ie: what do these numbers say about read scores and math scores?)
5. Adapt the code from lecture to plot the above equation on top of the scatterplot you had before. Based on this plot, do you think that the linear model is a good fit?
Attachment:- Data File.rar