Multiple linear regression

Inference for Linear Regression in R

Jo Hardin

Professor, Pomona College

Bathrooms negative coefficient

lm(log(price) ~  log(bath), data=LAhomes) %>% tidy()
         term estimate std.error statistic   p.value
1 (Intercept)    12.23    0.0280     437.2  0.00e+00
2   log(bath)     1.43    0.0306      46.6 9.66e-300
lm(log(price) ~ log(sqft) + log(bath), data=LAhomes) %>% tidy()
         term estimate std.error statistic   p.value
1 (Intercept)    2.514    0.2619     9.601  2.96e-21
2   log(sqft)    1.471    0.0395    37.221 1.19e-218
3   log(bath)   -0.039    0.0453    -0.862  3.89e-01
Inference for Linear Regression in R

Bathrooms non-significant coefficient

lm(log(price) ~  log(bath), data=LAhomes) %>% tidy()
         term estimate std.error statistic   p.value
1 (Intercept)    12.23    0.0280     437.2  0.00e+00
2   log(bath)     1.43    0.0306      46.6 9.66e-300
lm(log(price) ~ log(sqft) + log(bath), data=LAhomes) %>% tidy()
         term estimate std.error statistic   p.value
1 (Intercept)    2.514    0.2619     9.601  2.96e-21
2   log(sqft)    1.471    0.0395    37.221 1.19e-218
3   log(bath)   -0.039    0.0453    -0.862  3.89e-01
Inference for Linear Regression in R

Price on bed and bath

lm(log(price) ~ log(bath) + bed, data=LAhomes) %>% tidy()
         term estimate std.error statistic   p.value
1 (Intercept)   11.965    0.0384    311.67  0.00e+00
2   log(bath)    1.076    0.0465     23.14 2.38e-102
3         bed    0.189    0.0193      9.82  4.01e-22
Inference for Linear Regression in R

Large model on price

lm(log(price) ~ log(sqft) + log(bath) + bed, data=LAhomes) %>% tidy()
         term estimate std.error statistic   p.value
1 (Intercept)   1.5364    0.2894     5.310  1.25e-07
2   log(sqft)   1.6456    0.0454    36.215 6.27e-210
3   log(bath)   0.0165    0.0452     0.365  7.15e-01
4         bed  -0.1236    0.0167    -7.411  2.03e-13
Inference for Linear Regression in R

Let's practice!

Inference for Linear Regression in R

Preparing Video For Download...