First Year GPA
First Year GPA
(1) y=β0+β1x1+β2x2+ϵ
(2) y=β0+β1x1+β2x2+β3x1∗x2+ϵ
(3) y=β0+β1x3+ϵ
(4) y=β0+β2x2+ϵ
(5) y=β0+β1x4+ϵ
(1) y=β0+β1x1+β2x2+ϵ
(2) y=β0+β1x1+β2x2+β3x1∗x2+ϵ
(3) y=β0+β1x3+ϵ
(4) y=β0+β2x2+ϵ
(5) y=β0+β1x4+ϵ
(1) y=β0+β2x2+ϵ
(2) y=β0+β1x1+β2x2+β3x1∗x2+ϵ
(1) y=β0+β2x2+ϵ
(2) y=β0+β1x1+β2x2+β3x1∗x2+ϵ
(1) y=β0+β2x2+ϵ
(2) y=β0+β1x1+β2x2+β3x1∗x2+ϵ
(1) y=β0+β2x2+ϵ
(2) y=β0+β1x1+β2x2+β3x1∗x2+ϵ
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
model1
?data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
model1
?model2
?data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
data("Perch")model1 <- lm( Weight ~ Length + Width + Length * Width, data = Perch )model2 <- lm( Weight ~ Length + Width + I(Length ^ 2) + I(Width ^ 2) + Length * Width, data = Perch )
anova(model1)
## Analysis of Variance Table## ## Response: Weight## Df Sum Sq Mean Sq F value Pr(>F)## Length 1 6118739 6118739 3126.6 < 2e-16## Width 1 110593 110593 56.5 7.4e-10## Length:Width 1 314997 314997 161.0 < 2e-16## Residuals 52 101765 1957
(SSModel1 <- 6118739 + 110593 + 314997)
## [1] 6544329
anova(model2)
## Analysis of Variance Table## ## Response: Weight## Df Sum Sq Mean Sq F value Pr(>F)## Length 1 6118739 6118739 3289.64 < 2e-16## Width 1 110593 110593 59.46 4.7e-10## I(Length^2) 1 314899 314899 169.30 < 2e-16## I(Width^2) 1 5381 5381 2.89 0.095## Length:Width 1 3482 3482 1.87 0.177## Residuals 50 93000 1860
(SSModel1 <- 6118739 + 110593 + 314997)
## [1] 6544329
(SSModel2 <- 6118739 + 110593 + 314899 + 5381 + 3482)
## [1] 6553094
SSModel2 - SSModel1
## [1] 8765
SSModel2 - SSModel1
## [1] 8765
(SSModel2 - SSModel1) / 2
## [1] 4382
anova(model2)
## Analysis of Variance Table## ## Response: Weight## Df Sum Sq Mean Sq F value Pr(>F)## Length 1 6118739 6118739 3289.64 < 2e-16## Width 1 110593 110593 59.46 4.7e-10## I(Length^2) 1 314899 314899 169.30 < 2e-16## I(Width^2) 1 5381 5381 2.89 0.095## Length:Width 1 3482 3482 1.87 0.177## Residuals 50 93000 1860
((SSModel2 - SSModel1) / 2) / 1860
## [1] 2.36
((SSModel2 - SSModel1) / 2) / 1860
## [1] 2.36
((SSModel2 - SSModel1) / 2) / 1860
## [1] 2.36
((SSModel2 - SSModel1) / 2) / 1860
## [1] 2.36
pf(2.356183, 2, 50, lower.tail = FALSE)
## [1] 0.105
An easier way
anova(model1, model2)
## Analysis of Variance Table## ## Model 1: Weight ~ Length + Width + Length * Width## Model 2: Weight ~ Length + Width + I(Length^2) + I(Width^2) + Length * ## Width## Res.Df RSS Df Sum of Sq F Pr(>F)## 1 52 101765 ## 2 50 93000 2 8765 2.36 0.11
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model2)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.986 0.985 43.1 705. 4.41e-45 6 -287. 588. 602.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model2)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.986 0.985 43.1 705. 4.41e-45 6 -287. 588. 602.## # … with 2 more variables: deviance <dbl>, df.residual <int>
log(L)=−n2[log(2π)+log(SSE/n)+1]
log(L)=−n2[log(2π)+log(SSE/n)+1]
log()
in R
log(L)=−n2[log(2π)+log(SSE/n)+1]
log()
in R
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
-56 / 2 * (log(2 * pi) + log(101765 / 56) + 1)
## [1] -290
log(L)=−n2[log(2π)+log(SSE/n)+1]
log()
in R
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
-56 / 2 * (log(2 * pi) + log(101765 / 56) + 1)
## [1] -290
What I want you to remember
log(L)=−n2[log(SSE/n)]+some constant
log()
in R
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model2)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.986 0.985 43.1 705. 4.41e-45 6 -287. 588. 602.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model2)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.986 0.985 43.1 705. 4.41e-45 6 -287. 588. 602.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model2)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.986 0.985 43.1 705. 4.41e-45 6 -287. 588. 602.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model1)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.985 0.984 44.2 1115. 3.75e-47 4 -290. 589. 599.## # … with 2 more variables: deviance <dbl>, df.residual <int>
glance(model2)
## # A tibble: 1 x 11## r.squared adj.r.squared sigma statistic p.value df logLik AIC BIC## <dbl> <dbl> <dbl> <dbl> <dbl> <int> <dbl> <dbl> <dbl>## 1 0.986 0.985 43.1 705. 4.41e-45 6 -287. 588. 602.## # … with 2 more variables: deviance <dbl>, df.residual <int>
First Year GPA
First Year GPA
First Year GPA
First Year GPA
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |