If we use the same sampling method to select different samples and computed an interval estimate for each sample, we would expect the true population parameter ( β1 ) to fall within the interval estimates 95% of the time.
How do we calculate the confidence interval for the slope?
How do we calculate the confidence interval for the slope?
ˆβ1±t∗SEˆβ1
lm(Weight ~ WingLength, Sparrows) %>% tidy(conf.int = TRUE)
## # A tibble: 2 x 7## term estimate std.error statistic p.value conf.low conf.high## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 1.37 0.957 1.43 1.56e- 1 -0.531 3.26 ## 2 WingLength 0.467 0.0347 13.5 2.62e-25 0.399 0.536
lm(Weight ~ WingLength, Sparrows) %>% tidy(conf.int = TRUE)
## # A tibble: 2 x 7## term estimate std.error statistic p.value conf.low conf.high## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>## 1 (Intercept) 1.37 0.957 1.43 1.56e- 1 -0.531 3.26 ## 2 WingLength 0.467 0.0347 13.5 2.62e-25 0.399 0.536
t_star <- qt(0.025, df = 116 - 2, lower.tail = FALSE)# ort_star <- qt(0.975, df = 116 - 2)
0.467 - t_star * 0.0347
## [1] 0.3982596
0.467 + t_star * 0.0347
## [1] 0.5357404
There are ✌️ other types of confidence intervals we may want to calculate
There are ✌️ other types of confidence intervals we may want to calculate
There are ✌️ other types of confidence intervals we may want to calculate
There are ✌️ other types of confidence intervals we may want to calculate
There are ✌️ other types of confidence intervals we may want to calculate
There are ✌️ other types of confidence intervals we may want to calculate
There are ✌️ other types of confidence intervals we may want to calculate
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
confidence interval for μy and prediction interval
ˆy±t∗SE
lm(Weight ~ WingLength, data = Sparrows) %>% predict()
## 1 2 3 ## 14.92020 15.85501 13.05059
lm(Weight ~ WingLength, data = Sparrows) %>% predict()
## 1 2 3 ## 14.92020 15.85501 13.05059
lm(Weight ~ WingLength, data = Sparrows) %>% predict(interval = "confidence")
## fit lwr upr## 1 14.92020 14.63801 15.20240## 2 15.85501 15.49396 16.21607## 3 13.05059 12.74776 13.35342
lm(Weight ~ WingLength, data = Sparrows) %>% predict()
## 1 2 3 ## 14.92020 15.85501 13.05059
lm(Weight ~ WingLength, data = Sparrows) %>% predict(interval = "confidence")
## fit lwr upr## 1 14.92020 14.63801 15.20240## 2 15.85501 15.49396 16.21607## 3 13.05059 12.74776 13.35342
lm(Weight ~ WingLength, data = Sparrows) %>% predict(interval = "prediction")
## WARNING predictions on current data refer to _future_ responses
## fit lwr upr## 1 14.92020 12.13329 17.70712## 2 15.85501 13.05902 18.65101## 3 13.05059 10.26151 15.83966
What if we have new data?
new_sparrows <- data.frame( WingLength = c(30, 28, 25))new_sparrows
## WingLength## 1 30## 2 28## 3 25
What if we have new data?
new_sparrows <- data.frame( WingLength = c(30, 28, 25))new_sparrows
## WingLength## 1 30## 2 28## 3 25
lm(Weight ~ WingLength, data = Sparrows) %>% predict(newdata = new_sparrows, interval = "prediction")
## fit lwr upr## 1 15.38761 12.59700 18.17822## 2 14.45280 11.66790 17.23771## 3 13.05059 10.26151 15.83966
If we use the same sampling method to select different samples and computed an interval estimate for each sample, we would expect the true population parameter ( β1 ) to fall within the interval estimates 95% of the time.
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 |