library(tidyverse)
library(Stat2Data)
library(skimr)
Does the prediction equation for final exam scored in 3.1 suggest that the project score has a stronger relationship with the final exam than the midterm exam? Explain why or why not.
data(MathEnrollment)
skim(MathEnrollment)
## Skim summary statistics
## n obs: 11
## n variables: 3
##
## ── Variable type:integer ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
## variable missing complete n mean sd p0 p25 p50 p75 p100
## AYear 0 11 11 2006 3.32 2001 2003.5 2006 2008.5 2011
## Fall 0 11 11 285.45 28.18 248 266 286 302 343
## Spring 0 11 11 257.82 32.71 206 238 254 285.5 308
## hist
## ▇▃▃▇▃▃▃▇
## ▇▁▅▅▇▁▁▂
## ▅▂▁▇▁▂▇▂
mod = lm(Spring ~ Fall + AYear, data = MathEnrollment)
summary(mod)
##
## Call:
## lm(formula = Spring ~ Fall + AYear, data = MathEnrollment)
##
## Residuals:
## Min 1Q Median 3Q Max
## -30.613 -23.022 5.416 7.541 55.357
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -8743.3901 6141.5341 -1.424 0.192
## Fall -0.2021 0.3589 -0.563 0.589
## AYear 4.5159 3.0492 1.481 0.177
##
## Residual standard error: 31.09 on 8 degrees of freedom
## Multiple R-squared: 0.2773, Adjusted R-squared: 0.09663
## F-statistic: 1.535 on 2 and 8 DF, p-value: 0.2728
anova(mod)
## Analysis of Variance Table
##
## Response: Spring
## Df Sum Sq Mean Sq F value Pr(>F)
## Fall 1 847.0 847.00 0.8763 0.3766
## AYear 1 2120.1 2120.06 2.1934 0.1769
## Residuals 8 7732.6 966.57