Inference for Linear Regression in R
Jo Hardin
Professor, Pomona College
head(change)
A tibble: 6 x 7
Coins Qrts Dimes Nickels Pennies Small Amount
<int> <int> <int> <int> <int> <int> <dbl>
1 2 1 1 0 0 1 0.35
2 3 3 0 0 0 0 0.75
3 2 0 0 2 0 2 0.10
4 4 4 0 0 0 0 1.00
5 2 2 0 0 0 0 0.50
6 13 3 4 2 4 10 1.29
lm(Amount ~ Coins, data = change) %>% tidy()
term estimate std.error statistic p.value
1 (Intercept) 0.1449 0.0902 1.61 1.13e-01
2 Coins 0.0945 0.0063 14.99 6.01e-22
lm(Amount ~ Small, data = change) %>% tidy()
term estimate std.error statistic p.value
1 (Intercept) 0.4225 0.1244 3.40 1.22e-03
2 Small 0.0989 0.0118 8.38 1.10e-11
$\hat{\text{Amount}} = -0.00554 + 0.25862 \cdot \text{Coins} - 0.21611 \cdot \text{Small Coins}$
lm(Amount ~ Coins + Small, data = change) %>% tidy()
term estimate std.error statistic p.value
1 (Intercept) -0.00554 0.02735 -0.202 8.40e-01
2 Coins 0.25862 0.00682 37.917 3.95e-43
3 Small -0.21611 0.00864 -25.021 4.17e-33
Inference for Linear Regression in R