# A tibble: 2 x 7
term estimate std_error statistic p_value lower_ci upper_ci
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 intercept 4.46 0.127 35.2 0 4.21 4.71
2 age -0.006 0.003 -2.31 0.021 -0.011 -0.001
# A tibble: 463 x 5
ID score age score_hat residual
<int> <dbl> <int> <dbl> <dbl>
1 1 4.7 36 4.25 0.452
2 2 4.1 36 4.25 -0.148
3 3 3.9 36 4.25 -0.348
4 4 4.8 36 4.25 0.552
5 5 4.6 59 4.11 0.488
6 6 4.3 59 4.11 0.188
7 7 2.8 59 4.11 -1.31
8 8 4.1 51 4.16 -0.059
9 9 3.4 51 4.16 -0.759
10 10 4.5 40 4.22 0.276
# ... with 453 more rows
# A tibble: 1 x 1
stat
<dbl>
1 0.187
Call:
lm(formula = displ ~ hwy, data = .)
Coefficients:
(Intercept) hwy
7.368 -0.166
# A tibble: 2 x 7
term estimate std_error statistic p_value lower_ci upper_ci
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 intercept 7.37 0.221 33.3 0 6.93 7.80
2 hwy -0.166 0.009 -18.2 0 -0.184 -0.148
# A tibble: 234 x 5
ID displ hwy displ_hat residual
<int> <dbl> <int> <dbl> <dbl>
1 1 1.8 29 2.55 -0.748
2 2 1.8 29 2.55 -0.748
3 3 2 31 2.22 -0.215
4 4 2 30 2.38 -0.382
5 5 2.8 26 3.05 -0.246
6 6 2.8 26 3.05 -0.246
7 7 3.1 27 2.88 0.22
8 8 1.8 26 3.05 -1.25
9 9 1.8 25 3.21 -1.41
10 10 2 28 2.71 -0.714
# ... with 224 more rows
The two are related because displacement has a direct correlation to how high or low the mpg is.
Yes, because the standard error is very low.
# A tibble: 23 x 2
hwy n
<int> <int>
1 12 5
2 14 2
3 15 1
4 16 2
5 17 10
6 18 10
7 19 10
8 20 6
9 22 3
10 23 5
# ... with 13 more rows
# A tibble: 19 x 2
hwy n
<int> <int>
1 15 9
2 16 5
3 17 21
4 19 3
5 20 5
6 21 2
7 22 4
8 23 2
9 24 6
10 25 6
11 26 26
12 27 6
13 29 12
14 30 1
15 32 3
16 33 2
17 35 1
18 41 1
19 44 2
We know it is different because of the changing variables through the different intergers.
# A tibble: 4 x 2
cyl n
<int> <dbl>
1 4 28.8
2 5 28.8
3 6 22.8
4 8 17.6
Highway fuel mileage is higher with 4-cylinder vehicles but the same as 5 cylinder vehicles.