The error \(u\) arises because of factors, or variables, that influence Y but are not included in the regression function. There are always omitted variables. Sometimes, the omission of those variables can lead to bias in the OLS estimator.
The bias in the OLS estimator that occurs as a result of an omitted factor, or variable, is called omitted variable bias. For omitted variable bias to occur, the omitted variable \(Z\) must satisfy two conditions: The two conditions for omitted variable bias (1) \(Z\) is a determinant of \(Y\) (i.e. \(Z\) is part of \(u\)); and
(2) \(Z\) is correlated with the regressor \(X\) i.e. \(corr(Z,X) \neq 0\)
Both conditions must hold for the omission of \(Z\) to result in omitted variable bias.
In the test score example:
English language ability (whether the student has English as a second language) plausibly affects standardized test scores: \(Z\) is a determinant of \(Y\).
Immigrant communities tend to be less affluent and thus have smaller school budgets and higher STR: \(Z\) is correlated with $X$. Accordingly, \(\hat\beta_1\) is biased. What is the direction of this bias?
What does common sense suggest?
If common sense fails you, there is a formula…\(\sum^n_{i = 1} (Y_i - b_0 - b_1 X_i)^2\).
If If an omitted variable \(Z\) is both: (1) a determinant of \(Y\) (that is, it is contained in \(u\)); and (2) correlated with \(X\), then \(\rho_{Xu} \neq0\), and the OLS estimator \(\hat{\beta_1}\) is biased and is not consistent.
For example, districts with few ESL students (1) do better on standardized tests and (2) have smaller classes (bigger budgets), so ignoring the effect of having many ESL students factor would result in overstating the class size effect. Is this is actually going on in the CA data?
Districts with fewer English Learners have higher test scores
Districts with lower percent EL (PctEL) have smaller classes
Among districts with comparable PctEL, the effect of class size
is small (recall overall “test score gap” = 7.4)
Causality and regression analysis
The test score/STR/fraction English Learners example shows that, if an omitted variable satisfies the two conditions for omitted variable bias, then the OLS estimator in the regression omitting that variable is biased and inconsistent. So, even if n is large, \(\hat{\beta_1}\) will not be close to \(\beta_1\) . This raises a deeper question: how do we define \(\beta_1\) ? That is, what precisely do we want to estimate when we run a regression?
What precisely do we want to estimate when we run a regression? There are (at least) three possible answers to this question:
We want to estimate the slope of a line through a scatterplot as a simple summary of the data to which we attach no substantive meaning. This can be useful at times, but isn’t very interesting intellectually and isn’t what this course is about.
We want to make forecasts, or predictions, of the value of \(Y\) for an entity not in the data set, for which we know the value of \(X\).
Forecasting is an important job for economists, and excellent forecasts are possible using regression methods without needing to know causal effects. We will return to forecasting later in the course.
We want to estimate the causal effect on Y of a change in \(X\).
This is why we are interested in the class size effect. Suppose the school board decided to cut class size by 2 students per class. What would be the effect on test scores? This is a causal question (what is the causal effect on test scores of STR?) so we need to estimate this causal effect. Except when we discuss forecasting, the aim of this course is the estimation of causal effects using regression methods.
What, precisely, is a causal effect?
“Causality” is a complex concept!
In this course, we take a practical approach to defining causality:
A causal effect is defined to be the effect measure in an ideal randomized controlled experimentin an ideal randomized controlled experiment.
Ideal Randomized Controlled Experiment
Ideal: subjects all follow the treatment protocol – perfect compliance, no errors in reporting, etc.!
Randomized: subjects from the population of interest are randomly assigned to a treatment or control group (so there are no confounding factors)
Controlled: having a control group permits measuring the differential effect of the treatment
Experiment: the treatment is assigned as part of the experiment: the subjects have no choice, so there is no “reverse causality” in which subjects choose the treatment they think will work best.
Back to class size:
Imagine an ideal randomized controlled experiment for measuring the effect on Test Score of reducing STR…
In that experiment, students would be randomly assigned to classes, which would have different sizes.
Because they are randomly assigned, all student characteristics (and thus \(u_i\)) would be distributed independently of STRi.
Thus, \(E(u_i|STR_i)=0\) – that is, LSA #1 holds in a randomized controlled experiment.
How does our observational data differ from this ideal?
The treatment is not randomly assigned
Consider PctEL – percent English learners – in the district.
It plausibly satisfies the two criteria for omitted variable bias: Z = PctEL is:
a determinant of Y; and
correlated with the regressor X.
Thus, the “control” and “treatment” groups differ in a systematic way, so \(corr(STR,PctEL)\neq0\)
Randomization + control group means that any differences between the treatment and control groups are random – not systematically related to the treatment
We can eliminate the difference in PctEL between the large (control) and small (treatment) groups by examining the effect of class size among districts with the same PctEL.
If the only systematic difference between the large and small class size groups is in PctEL, then we are back to the randomized controlled experiment – within each PctEL group.
This is one way to “control” for the effect of PctEL when estimating the effect of STR.
Return to omitted variable bias
Three ways to overcome omitted variable bias
Run a randomized controlled experiment in which treatment (STR) is randomly assigned: then PctEL is still a determinant of TestScore, but PctEL is uncorrelated with STR. (This solution to OV bias is rarely feasible.)
Adopt the “cross tabulation” approach, with finer gradations of STR and PctEL – within each group, all classes have the same PctEL, so we control for PctEL (But soon you will run out of data, and what about other determinants like family income and parental education?)
Use a regression in which the omitted variable (PctEL) is no longer omitted: include PctEL as an additional regressor in a multiple regression.
\(\beta_0 = predicted value of Y when X1 = X2 = 0\). (Theoretically speaking)
The OLS Estimator in Multiple Regression
(SW Section 6.3) With two regressors, the OLS estimator solves: \(min_{b_1,b_2}\sum^n_{i = 1} (Y_i - b_0 - b_1 X_{1i}-b_2 X_{2i})^2.\)
The OLS estimator minimizes the average squared difference between the actual values of Yi and the prediction (predicted value) based on the estimated line.
This minimization problem is solved using calculus
This yields the OLS estimators of \(\beta_0\) , \(\beta_1\) and \(\beta_2\)
Example: the California test score data
Regression of TestScore against STR:
\(\widehat{TestScore}= 698.9 – 2.28STR\)
Now include percent English Learners in the district (PctEL):
SER = std. deviation of \(\hat{u_i}\) (with d.f. correction) RMSE = std. deviation of \(\hat{u_i}\) (without d.f. correction) \(R^2\) = fraction of variance of Y explained by X \(\bar{R^2}\) = “adjusted \(R^2\)” = \(R^2\) with a degrees-of-freedom correction that adjusts for estimation uncertainty; \(\bar{R^2} <R^2\)
SER and RMSE
As in regression with a single regressor, the SER and the RMSE are measures of the spread of the Ys around the regression line:
What – precisely – does this tell you about the fit of regression (2) compared with regression (1)?
Why are the \(R^2\) and \(\bar{R^2}\) so close in (2)?
OLS Assumptions in the MLR Model
The multiple regression model is given by \(Y_i = \beta_0 + \beta_1 X_{1i} + \beta_1 X_{2i} + \dots + \beta_k X_{ki} + u_i \ , \ i=1,\dots,n.\)
The OLS assumptions in the multiple regression model are an extension of the ones made for the simple regression model:
\(u_i\) is an error term with conditional mean zero given the regressors, i.e., \(E(u_i\vert X_{1i}, X_{2i}, \dots, X_{ki}) = 0.\)
2.Regressors \((X_{1i}, X_{2i}, \dots, X_{ki}, Y_i) \ , \ i=1,\dots,n\) are drawn such that the i.i.d. assumption holds.
Large outliers are unlikely, formally \(X_{1i},\dots,X_{ki}\) and \(Y_i\) have finite fourth moments.
No perfect multicollinearity.
Assumption #1: the conditional mean of u given the
included Xs is zero. \(E(u_i\vert X_{1i}, X_{2i}, \dots, X_{ki}) = 0.\) - This has the same interpretation as in regression with a single regressor. - Failure of this condition leads to omitted variable bias, specifically, if an omitted variable (1) belongs in the equation (so is in \(u\)) and (2) is correlated with an included \(X\) then this condition fails and there is OV bias. - The best solution, if possible, is to include the omitted variable in the regression. - A second, related solution is to include a variable that controls for the omitted variable (discussed in Ch. 7)
Assumption #2
\((X_{1i}, X_{2i}, \dots, X_{ki}, Y_i) \ , \ i=1,\dots,n\) This is satisfied automatically if the data are collected by simple random sampling.
Assumption #3: large outliers are rare (finite fourth moments) This is the same assumption as we had before for a single regressor. As in the case of a single regressor, OLS can be sensitive to large outliers, so you need to check your data (scatterplots!) to make sure there are no crazy values (typos or coding errors).
Assumption #4 : There is no perfect multicollinearity
Perfect multicollinearity is when one of the regressors is an exact linear function of the other regressors. Example: Suppose you accidentally include STR twice
Model 1
(Intercept)
698.933
(9.467)
str
−2.280
(0.480)
Num.Obs.
420
R2
0.051
R2 Adj.
0.049
AIC
3650.5
BIC
3662.6
Log.Lik.
−1822.250
F
22.575
RMSE
18.54
Perfect multicollinearity
It occurs when one of the regressors is an exact linear function of the other regressors. - In the previous regression, \(\beta_1\) is the effect on TestScore of a unit change in STR, holding STR constant (???) - We will return to perfect (and imperfect) multicollinearity shortly, with more examples… With these least squares assumptions in hand, we now can derive the sampling distribution of \(\hat{\beta_1}, \dots,\hat{\beta_k}\)
The Sampling Distribution of the OLS Estimator
Under the four Least Squares Assumptions
- The sampling distribution of \(\hat{\beta_1}\) has mean \(\beta_1\) -\(var(\hat{\beta_1}\) is inversely proportional to n.
- Other than its mean and variance, the exact (finite-n) distribution of \(\hat{\beta_1}\) is very complicated; but for large n…
\(\hat{\beta_1}\) is consistent \(\hat\beta_1 \xrightarrow[]{p} \beta_1\) (law of large numbers) is approximately distributed N(0,1) (CLT) oThese statements hold for 1 \(\frac{\hat{\beta_1} - \beta_1}{SE(\hat{\beta_1})}\) is approximately N(0,1) (CLT)
These statements hold for \(\hat{\beta_1},\dots,\hat{\beta_k}\) Conceptually, there is nothing new here
Multicollinearity, Perfect and Imperfect
Perfect multicollinearity is when one of the regressors is an exact linear function of the other regressors.
Some more examples of perfect multicollinearity
The example from before: you include STR twice,
Regress TestScore on a constant, D, and B, where: \(D_i = 1\) if \(STR ≤ 20\), \(= 0\) otherwise; \(B_i = 1\) if \(STR >20, = 0\) otherwise, so \(B_i = 1 – D_i\) and there is perfect multicollinearity.
Would there be perfect multicollinearity if the intercept (constant) were excluded from this regression? This example is a special case of…
The dummy variable trap
Suppose you have a set of multiple binary (dummy) variables, which are mutually exclusive and exhaustive – that is, there are multiple categories and every observation falls in one and only one category (Freshmen, Sophomores, Juniors, Seniors, Other). If you include all these dummy variables and a constant, you will have perfect multicollinearity – this is sometimes called the dummy variable trap.
- Why is there perfect multicollinearity here? - Solutions to the dummy variable trap: 1. Omit one of the groups (e.g. Senior), or 2. Omit the intercept - What are the implications of (1) or (2) for the interpretation of the coefficients?
Perfect multicollinearity, ctd. Perfect multicollinearity usually reflects a mistake in the definitions of the regressors, or an oddity in the data
- If you have perfect multicollinearity, your statistical software will let you know – either by crashing or giving an error message or by “dropping” one of the variables arbitrarily - The solution to perfect multicollinearity is to modify your list of regressors so that you no longer have perfect multicollinearity.
Imperfect multicollinearity
Imperfect and perfect multicollinearity are quite different despite the similarity of the names. Imperfect multicollinearity occurs when two or more regressors are very highly correlated. - Why the term “multicollinearity”? If two regressors are very highly correlated, then their scatterplot will pretty much look like a straight line – they are “co-linear” – but unless the correlation is exactly \(\pm1\), that collinearity is imperfect.
Imperfect multicollinearity, ctd.
Imperfect multicollinearity implies that one or more of the regression coefficients will be imprecisely estimated. - The idea: the coefficient on \(X_1\) is the effect of \(X_1\) holding \(X_2\) constant; but if \(X_1\) and \(X_2\) are highly correlated, there is very little variation in \(X_1\) once \(X_2\) is held constant – so the data don’t contain much information about what happens when \(X_1\) changes but \(X_2\) doesn’t. If so, the variance of the OLS estimator of the coefficient on \(X_1\) will be large. - Imperfect multicollinearity (correctly) results in large standard errors for one or more of the OLS coefficients. - The math? See SW, App. 6.2
Hypothesis Testing and Confidence Intervals in Multiple Regressions
\(F-Statistics\) is given as below \(F = \frac{(SSR_{\text{restricted}} - SSR_{\text{unrestricted}})/q}{SSR_{\text{unrestricted}} / (n-k-1)}\) with
S S R r e s t r i c t e d being the sum of squared residuals from the restricted regression, i.e., the regression where we impose the restriction. \(SSR_{unrestricted}\) is the sum of squared residuals from the full model, \(q\) is the number of restrictions under the null and \(k\) is the number of regressors in the unrestricted regression. It is fairly easy to conduct \(F-tests\) in \(R\). We can use the function linearHypothesis()contained in the Hypothesis Testing and Confidence Intervals in Multiple Regressions.
Code
library(car)
Loading required package: carData
Attaching package: 'car'
The following object is masked from 'package:dplyr':
recode
The following object is masked from 'package:purrr':
some
Code
# estimate the multiple regression modelmodel <-lm(testscr ~ str + el_pct + meal_pct, data = caschool)# execute the function on the model object and provide both linear restrictions # to be tested as stringslinearHypothesis(model, c("str=0", "el_pct=0"))
Linear hypothesis test
Hypothesis:
str = 0
el_pct = 0
Model 1: restricted model
Model 2: testscr ~ str + el_pct + meal_pct
Res.Df RSS Df Sum of Sq F Pr(>F)
1 418 37303
2 416 34298 2 3004.3 18.22 2.6e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
To test \(\beta_2+\beta_3=1\) we can proceed as follows:
Code
linearHypothesis(model,c('el_pct+meal_pct=1'))
Linear hypothesis test
Hypothesis:
el_pct + meal_pct = 1
Model 1: restricted model
Model 2: testscr ~ str + el_pct + meal_pct
Res.Df RSS Df Sum of Sq F Pr(>F)
1 417 410435
2 416 34298 1 376136 4562.1 < 2.2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1