Create section for linear regression chapter consisting of:
We use a data-set of grades for calculus, which has the score on the midterm, endterm, final grade and resit grade. We will try to construct a linear model for the resit grade explained by the midterm, endterm and final grade. We show again a plot of y against yhat with the slope 1 line and the summary. This time we point to the very large values of the coefficients and the high p-values of each coefficient against the reasonable performance in the plot. Then we also point to the low p-value of the F-test. This indicates that there is a problem with dependence of random variables. Indeed final grade is a weighted average midterm plus twice endterm over 3. In the summary we also see an error message saying that the design matrix is singular. The high p-values for each variable mean that that explanatory variable does not add to the model if the other two are present (true for each of the three variables since all information is contained in the other two already). The low value of the F-test and the plot indicate that there is some explanatory value in the variables themselves. The high values of the coefficients are caused by rounding errors since at some point there is a division by the determinant of X transpose X which is 0, but only very small due to rounding errors. Next we run the model again using only two of the three variables (we can ask students to check that it does not matter which of the two we use). To see we actually obtain the same performance apart from no error message and lower p-values for the separate variables.
Create section for linear regression chapter consisting of:
We use a data-set of grades for calculus, which has the score on the midterm, endterm, final grade and resit grade. We will try to construct a linear model for the resit grade explained by the midterm, endterm and final grade. We show again a plot of y against yhat with the slope 1 line and the summary. This time we point to the very large values of the coefficients and the high p-values of each coefficient against the reasonable performance in the plot. Then we also point to the low p-value of the F-test. This indicates that there is a problem with dependence of random variables. Indeed final grade is a weighted average midterm plus twice endterm over 3. In the summary we also see an error message saying that the design matrix is singular. The high p-values for each variable mean that that explanatory variable does not add to the model if the other two are present (true for each of the three variables since all information is contained in the other two already). The low value of the F-test and the plot indicate that there is some explanatory value in the variables themselves. The high values of the coefficients are caused by rounding errors since at some point there is a division by the determinant of X transpose X which is 0, but only very small due to rounding errors. Next we run the model again using only two of the three variables (we can ask students to check that it does not matter which of the two we use). To see we actually obtain the same performance apart from no error message and lower p-values for the separate variables.