without having points overlay it… this is something you should do for a plot). Overlay the linear regression line on the plot steps vs temperature and steps vs daylight hours. Note that there seems to be some funny business going on with the daylight hours plot… the residuals of the linear regression line are definitely not homoscedastic (they are spread wider for low and high daylight hours than they are for middle-values of daylight hours). It looks like a linear model isn’t likely to be appropriate, and a quadratic would likely fit the data better. Add a quadratic term to your regression fit and repeat the fit, overlaying the new line on the plot. Also write the code to reproduce the following output: Was the quadratic model a better fit? g) Now do a regression fit that includes temperature, daylight hours, daylight hours quadratic term, weekdays as a factor, and weather events as a factor. Reproduce the following output from the lm() method: of the fit terms do not appear to be significant? (note, that when a multi-level factor is included, if one level is significant, the factor is considered significant in the fit) Using the R stepAIC() function, obtain the most parsimonious model, and reproduce the following output: Which term went away in the full model? Did it make much of a difference either way? h) For the most parsimonious model, reproduce the following set of plots (note that you can use the norm_overlay_and_qq() function in the AML_course_libs.R script to produce the second and third plots). On the first plot, overlay the 45 degree line that represents a fit” (ie; a fit with perfect one-to-one correspondence between the fit “perfect results and the data).
without having points overlay it… this is something you should do for a plot). Overlay the linear regression line on the plot steps vs temperature and steps vs daylight hours. Note that there seems to be some funny business going on with the daylight hours plot… the residuals of the linear regression line are definitely not homoscedastic (they are spread wider for low and high daylight hours than they are for middle-values of daylight hours). It looks like a linear model isn’t likely to be appropriate, and a quadratic would likely fit the data better. Add a quadratic term to your regression fit and repeat the fit, overlaying the new line on the plot. Also write the code to reproduce the following output: Was the quadratic model a better fit? g) Now do a regression fit that includes temperature, daylight hours, daylight hours quadratic term, weekdays as a factor, and weather events as a factor. Reproduce the following output from the lm() method: of the fit terms do not appear to be significant? (note, that when a multi-level factor is included, if one level is significant, the factor is considered significant in the fit) Using the R stepAIC() function, obtain the most parsimonious model, and reproduce the following output: Which term went away in the full model? Did it make much of a difference either way? h) For the most parsimonious model, reproduce the following set of plots (note that you can use the norm_overlay_and_qq() function in the AML_course_libs.R script to produce the second and third plots). On the first plot, overlay the 45 degree line that represents a “perfect fit” (ie; a fit with perfect one-to-one correspondence between the fit results and the data).
AML_612_Spring_2018_Hwk5.docx