Inference for Linear Regression in R
Jo Hardin
Professor, Pomona College
$$Y = \beta_0 + \beta_1 \cdot X + \epsilon$$
$$\epsilon \sim N(0, \sigma_\epsilon)$$
linear_lm <- augment(
lm(response ~ explanatory,
data = lineardata)
)
ggplot(linear_lm,
aes(x =. fitted, y = .resid)) +
geom_point() +
geom_hline(yintercept=0)
Fitted value: $\hat{Y}_i = b_0 + b_1 X_i$
Residual: $e_i= Y_i - \hat{Y}_i$
$$Y = \beta_0 + \beta_1 \cdot X + \epsilon$$
$$\epsilon \sim N(0, \sigma_\epsilon)$$
nonlinear_lm <- augment(
lm(response ~ explanatory,
data = nonlineardata))
ggplot(nonlinear_lm,
aes(x = .fitted, y = .resid)) +
geom_point() +
geom_hline(yintercept=0)
fitted value: $\hat{Y}_i = b_0 + b_1 X_i$
residual: $e_i= Y_i - \hat{Y}_i$
$$Y = \beta_0 + \beta_1 \cdot X + \epsilon$$
$$\epsilon \sim N(0, \sigma_\epsilon)$$
nonnormal_lm <- augment(
lm(response ~ explanatory,
data = nonnormaldata))
ggplot(nonnormal_lm,
aes(x = .fitted, y = .resid)) +
geom_point() +
geom_hline(yintercept = 0)
fitted value: $\hat{Y}_i = b_0 + b_1 X_i$
residual: $e_i= Y_i - \hat{Y}_i$
$$Y = \beta_0 + \beta_1 \cdot X + \epsilon$$
$$\epsilon \sim N(0, \sigma_\epsilon)$$
nonequal_lm <- augment(
lm(response ~ explanatory,
data = nonequaldata))
ggplot(nonequal_lm,
aes(x = .fitted, y = .resid)) +
geom_point() +
geom_hline(yintercept = 0)
fitted value: $\hat{Y}_i = b_0 + b_1 X_i$
residual: $e_i= Y_i - \hat{Y}_i$
Inference for Linear Regression in R