term | estimate | std.error | statistic | p.value |
---|---|---|---|---|
(Intercept) | 50.93 | 2.66 | 19.14 | 0.00 |
female_literacy_rate_2011 | 0.23 | 0.03 | 7.38 | 0.00 |
2023-01-29
Describe the model assumptions made in linear regression using ordinary least squares
Determine if the relationship between our sampled X and Y is linear
Use QQ plots to determine if our fitted model holds the normality assumption
Use residual plots to determine if our fitted model holds the equality of variance assumption
We have been looking at the association between life expectancy and female literacy rate
We used OLS to find the coefficient estimates of our best-fit line
\[Y = \beta_0 + \beta_1 X + \epsilon\]
term | estimate | std.error | statistic | p.value |
---|---|---|---|---|
(Intercept) | 50.93 | 2.66 | 19.14 | 0.00 |
female_literacy_rate_2011 | 0.23 | 0.03 | 7.38 | 0.00 |
The residuals \(\widehat\epsilon_i\) are the vertical distances between
\[ \widehat\epsilon_i =Y_i - \widehat{Y}_i \text{, for } i=1, 2, ..., n \]
Determine if the relationship between our sampled X and Y is linear
Use QQ plots to determine if our fitted model holds the normality assumption
Use residual plots to determine if our fitted model holds the equality of variance assumption
These are the model assumptions made in ordinary least squares:
[L] Linearity of relationship between variables
[I] Independence of the \(Y\) values
[N] Normality of the \(Y\)’s given \(X\) (residuals)
[E] Equality of variance of the residuals (homoscedasticity)
\[\mu_{y|x} = \beta_0 + \beta_1 \cdot X\]
The \(Y\)-values are statistically independent of one another
Examples of when they are not independent, include
repeated measures (such as baseline, 3 months, 6 months)
data from clusters, such as different hospitals or families
This condition is checked by reviewing the study design and not by inspecting the data
The variance of \(Y\) given \(X\) (\(\sigma_{Y|X}^2\)), is the same for any \(X\)
This is also called homoscedasticity
The distribution of \(Y\) given \(X\) is
This means that the residuals are
[L] Linearity of relationship between variables
Check if there is a linear relationship between the mean response (Y) and the explanatory variable (X)
[I] Independence of the \(Y\) values
Check that the observations are independent
[N] Normality of the \(Y\)’s given \(X\) (residuals)
Check that the responses (at each level X) are normally distributed
[E] Equality of variance of the residuals (homoscedasticity)
Check that the variance (or standard deviation) of the responses is equal for all levels of X
Use QQ plots to determine if our fitted model holds the normality assumption
Use residual plots to determine if our fitted model holds the equality of variance assumption
Is the association between the variables linear?
Describe the model assumptions made in linear regression using ordinary least squares
Determine if the relationship between our sampled X and Y is linear
Diagnostic tools:
Distribution plots of residuals
QQ plots of residuals
augment()
function from the broom
package.model1 <- lm(life_expectancy_years_2011 ~ female_literacy_rate_2011,
data = gapm)
aug1 <- augment(model1)
glimpse(aug1)
Rows: 80
Columns: 9
$ .rownames <chr> "1", "2", "5", "6", "7", "8", "14", "22", "…
$ life_expectancy_years_2011 <dbl> 56.7, 76.7, 60.9, 76.9, 76.0, 73.8, 71.0, 7…
$ female_literacy_rate_2011 <dbl> 13.0, 95.7, 58.6, 99.4, 97.9, 99.5, 53.4, 9…
$ .fitted <dbl> 53.94643, 73.14897, 64.53453, 74.00809, 73.…
$ .resid <dbl> 2.7535654, 3.5510294, -3.6345319, 2.8919074…
$ .hat <dbl> 0.13628996, 0.01768176, 0.02645854, 0.02077…
$ .sigma <dbl> 6.172684, 6.168414, 6.167643, 6.172935, 6.1…
$ .cooksd <dbl> 1.835891e-02, 3.062372e-03, 4.887448e-03, 2…
$ .std.resid <dbl> 0.48238134, 0.58332052, -0.59972251, 0.4757…
Note that below I save each figure as an object, and then combine them together in one row of output using grid.arrange()
from the gridExtra
package
Normal
Uniform
T
Skewed
Normal
Uniform
T
Skewed
Normal
Uniform
T
Skewed
Goodness-of-fit test for the normal distribution: Is there evidence that our residuals are from a normal distribution?
Hypothesis test:
\[\begin{aligned} H_0 & : \text{data are from a normally distributed population} \\ H_1 & : \text{data are NOT from a normally distributed population} \end{aligned}\]
Describe the model assumptions made in linear regression using ordinary least squares
Determine if the relationship between our sampled X and Y is linear
Use QQ plots to determine if our fitted model holds the normality assumption
autoplot()
can be a helpful toolAssumption | What needs to hold? | Diagnostic tool |
---|---|---|
Linearity \(\text{}\) |
|
\(\text{}\) |
Independence \(\text{}\) |
|
\(\text{}\) |
Normality \(\text{}\) |
|
|
Equality of variance \(\text{}\) |
|
\(\text{}\) |
SLR 4