LEC 5 Multivariate Regression: Concepts and Application
PUBPOL 5310: Applied Stats - Multivariate Regression
Overview of Regression Analysis
First Part: Focused on univariate and bivariate analysis (one or two variables).
Remainder (Current Topic): Focuses on multivariate analysis.
Multivariate Data: Involves three or more variables.
(Earlier material can be considered a special case of multivariate analysis).
Outline and Goals
Goal: To achieve "Controlling for other variables" in regression analysis.
This means isolating the effect of one independent variable on the dependent variable while holding other relevant factors constant.
Notation: Understanding the symbols used for multivariate data analysis.
Summary of Multivariate Data:
Graphical summary (with limitations).
Least squares regression method for multivariate data.
Interpretation of multivariate regression coefficients.
Measures of goodness of fit.
"Controlling for Other Variables"
Bivariate Regression Slope (): Indicates the change in predicted Y for a one-unit change in X, on average.
Example: Relationship between health and income.
Confounding Factors: Often, the observed change in Y due to X also includes effects from other factors (e.g., age).
Example: Age might influence both income and health, making a simple health-income relationship misleading.
Desired Outcome: To understand the relationship between income and health for individuals of the same age (i.e., "for two folks of the same age, how are income and health related?").
Terminology for Control:
"Control for age."
"Hold age constant."
"Hold age fixed."
"Condition on age."
One Approach (Stata's
ifmodifier):Using
regress health income if age == 47to analyze data only for individuals aged 47.Using
regress health income if (age >= 45 & age <= 49)to analyze data within an age range.Limitations of the
ifapproach:Difficulty in choosing specific ages or age ranges.
Risk of insufficient data within narrow subsets.
Potentially many regressions to run for different age groups.
Hard to get an "overall answer" across all ages.
Multivariate Regression as an Alternative: Provides a statistical model to control for age (or other variables) without subsetting the data.
Motivation #2: Optimal Predictions
Utilizing several predictor variables (independent variables) to make the best possible predictions for the dependent variable (Y).
Notation for Multivariate Regression
Variables: Y, and
: Covariates, explanatory variables, independent variables, Right-Hand-Side (RHS) variables, or regressors.
Y: Dependent variable, outcome, regressand, or Left-Hand-Side (LHS) variable.
: Represents the total number of variables being analyzed, where .
This includes Y variable and X variables.
also signifies the total number of regression parameters (coefficients).
This includes intercept (constant term) and "slopes" (coefficients for the X variables).
Graphical Description of Multivariate Data
Difficulty: Generally, it is challenging to visualize multivariate data graphically due to its high dimensionality.
One Exception: When there are three variables and one of the X variables is a dummy variable.
"Best practice" examples:
Edward Tufte: Known for "The Visual Display of Quantitative Information," emphasizing clarity and efficiency in data graphics (e.g., Minard's map of Napoleon's Russian campaign).
Hans Rosling (animated): Famous for using animated bubble charts to visualize complex socioeconomic data (e.g., Gapminder videos).
The Best-Fit "Line" with Multivariate Data: Definitions and Interpretation
Multivariate Best-Fit "Line" (Equation):
: The predicted value for Y for individual .
: The intercept (predicted Y when all X variables are zero).
(for ): Represents the change in predicted Y for a one-unit increase in , holding constant all other X variables. This is akin to a partial derivative: . (The character in the slide \text{\raise.17em\hbox{\$ }} appears to be a typo for ).
The Fundamental Difference in Interpretation: The key phrase is "holding the other X's constant."
Example: Wage, Education, and Gender
Set-Up:
Y: Hourly wages (WAGE)
: Education in years (EDUC)
: Dummy variable for female (FEMALE, where .
Best-Fit Line:
Interpretation of Coefficients:
: The predicted wage for person .
and : The specific values of education and female status for person .
: The predicted wage of someone with and (i.e., a male with zero years of education).
: The average change in WAGE for a one-year increase in EDUC, holding constant FEMALE (i.e., for both males and females, separately).
: The average change in WAGE when FEMALE changes from to (i.e., for females compared to males), holding constant EDUC (i.e., for individuals with the same level of education).
Graphical Interpretation (with FEMALE as a dummy variable):
Since FEMALE is a dummy, the model generates two parallel lines (assuming no interaction term):
For males (FEMALE = 0):
For females (FEMALE = 1):
Visualizing the effect of : Holding FEMALE constant (staying on one line), an increase of one unit in EDUC (e.g., from to ) results in a unit change in wage.
Visualizing the effect of : Holding EDUC constant (moving vertically at a given ), changing from FEMALE=0 to FEMALE=1 results in a unit change in wage. If , the female line would be below the male line, indicating lower wages for females with the same education.
Least Squares Regression with Multivariate Data
Choosing the "Line": Involves selecting the optimal values for all coefficients: .
Objective: To find such that the average observed Y is as close as possible to its prediction ().
Minimization: Minimize the average squared deviation of Y from (the predicted value).
Deviation (Residual):
Squared Deviation:
Average Squared Deviation (Mean Squared Error - MSE):
The Problem (Sum of Squared Residuals - SSR): Minimize
Solving with Calculus (First-Order Conditions): To find the minimum, we take the partial derivative of the SSR with respect to each coefficient () and set them to zero. This results in a system of K linear equations.
… (and so on for all terms up to )
The Solution: Similar to the bivariate case, there are solution formulas for , which are complex functions of the data. In practice, statistical software like Stata is used to compute these coefficients.
Measures of Goodness of Fit
1. Standard Error of the Regression (SER)
Definition: Measures the magnitude of the typical deviation of the observed Y from the predicted Y ().
Calculation: Similar to a standard deviation.
The Standard Error of the Regression is the square root:
(Note: in the denominator accounts for the degrees of freedom lost in estimating K coefficients).
In Stata Output: Labeled as "Root MSE."
Interpretation:
Sensitive to the unit of measurement of Y, so it's best interpreted by comparing it across similar regressions.
A lower Standard Error of the Regression indicates a better fit of the regression model to the data.
2. R-squared ()
Definition: The fraction of the total variation in Y that is "explained by" the variation in the X variables included in the model.
Formal Formulas:
ESS (Explained Sum of Squares):
TSS (Total Sum of Squares):
SSR (Sum of Squared Residuals):
In Excel Output: Labeled as "R square" in the "Regression Statistics" table.
Interpretation:
: A perfect fit; all data points lie exactly on the regression line/plane.
: The usual case. A higher indicates a better fit of the regression model.
: No fit; the model explains none of the variation in Y.
Problem with :
Adding more explanatory variables (X's) to the model will always increase or leave it unchanged.
This happens because TSS remains constant, and ESS will either stay the same or go up (SSR will either stay the same or go down).
Therefore, an increase in might not truly represent an improvement in the model's predictive power or fit, but merely an increase in the number of regressors ().
3. Adjusted R-squared ()
Purpose: An alternative goodness-of-fit measure that "penalizes" models for including too many covariates, addressing the problem of artificially increasing with more variables.
Formula: (The slide presented this as which is a common variant or simplification, assuming slopes. Using the slide's initial notation of total parameters: where is number of total parameters)
More precisely from the slide:
Comparison to : Generally, .
Difference between measures is larger when:
(the number of parameters/variables) is larger.
(the sample size) is smaller.
Behavior: Unlike , Adjusted can either increase or decrease when a new variable is added to the model. It will only increase if the new variable significantly improves the model's fit, outweighing the penalty for adding a new parameter.
Dummy Variables and Multivariate Regression
Recap (Bivariate Dummy Model):
Model:
: Wages; : Female (dummy, .
Interpretation: is the expected change in hourly wages for a respondent who is female, compared to males ().
Categorical Variables with Many Categories:
To use a categorical variable (e.g., region, occupation type) with multiple categories in multivariate regression, it must be recoded as a set of dummy variables.
Create one dummy variable for each category.
Rule: Include dummy variables in the regression model.
Omitted Group: The category for which no dummy variable is explicitly included becomes the "reference group."
Interpretation: The coefficients for the included dummy variables represent the shift in the intercept relative to the omitted (reference) group, holding other variables constant.
Revisiting the Example: Wage, Education, Female:
If FEMALE=0 (omitted group for males), then predicted wage is .
If FEMALE=1 (included dummy for females), then predicted wage is .
Dummy Variable Trap
Problem: If you include a dummy variable for every category of a categorical variable (e.g., both
maleandfemaledummies, plus an intercept), perfect multicollinearity will occur. This makes the model inestimable.Suppose there are categories for a categorical variable.
Solution: To ensure the model is estimable, always use dummy variables.
The omitted group serves as the baseline, and its line is the one to which the lines for all other groups are compared.
For the omitted group, all included dummy variables will take a value of zero, making its intercept equivalent to .
For an included dummy, say for group compared to the omitted group, its line would be (if there were other variables). Otherwise, if just using dummy and intercept . For instance, if original equation , for the omitted group it's , and for the dummy group it's . ( as shown in the slide with as the dummy would be the intercept for the dummy group).