Вы находитесь на странице: 1из 10

Financial Modeling & Risk Analysis

FIN 475
Finance Dept. | CoB | JMU

MODULE 5 5.2 2
Dummy Variables
ANOVA & ANCOVA
Elias J. Semaan

Dummy Variables ANOVA models.


In regression analysis, the dependent variable might sometimes be influenced by variables that are qualitative in nature. Salary affected by race race, sex sex, nationality nationality, etc. etc Such qualitative variables are termed Dummy Variables, and since they usually indicate the presence or absence of a specific attribute, they take on the values of 0 or 1. 1 A regression model might be constructed with only dummy variables as the independent variables, and is termed ANOVA model (Analysisof-variance): f i ) Yi= + Di + u
Wh Where Y = annual l salary l of f college ll professor. f Di = 1 if male, 0 if female.
Y SEX 22.0 1 19.0 0 18.0 0 21.7 1 18.5 0 21.0 1 20.5 1 17.0 0 17.5 0 21.2 1 2

ANOVA EXAMPLE

SUMMARY OUTPUT Regression Statistics M lti l R Multiple R Square Adjusted R Square Standard Error Observations ANOVA df Regression Residual Total 1 8 9 SS 26.896 3.888 30.784 MS F Significance F 26.896 55.34156379 7.33967E-05 0.486 0 934719543 0.934719543 0.873700624 0.857913202 0.697137002 10

Intercept SEX

Coefficients Standard Error t Stat P-value 18 0.311769145 57.73502692 8.99405E-12 3.28 0.440908154 7.439191071 7.33967E-05

Lower 95% Upper 95% Lower 95.0% Upper 95.0% 17.28105906 18.71894094 17.28105906 18.71894094 2.263263975 4.296736025 2.263263975 4.296736025

ANOVA EXAMPLE
Salary

Sex Female
T for H0: Parameter INTERCEPT SEX Estimate 18 18.00000000 00000000 3.28000000 Parameter=0 57 57.74 74 7.44 0 0.0001 0001 0.0001

Male
Pr > |T| Std Error of Estimate 0 0.31176915 31176915 0.44090815

Dummy Variables ANCOVA models


When regression models contain an admixture of quantitative and qualitative variables, they are termed ANCOVA models. (Analysis-ofcovariance): Yi= + 1Di + 2Xi + u
Where Y = annual salary of college professor. Xi = Years of Experience Experience. Di = 1 if male, 0 if female.
Y X SEX 23.0 1 1 19.5 1 0 24.0 2 1 21.0 2 0 25.0 3 1

Thi model This d l postulates t l t that th t male l and d female f l professors salary functions in relation to the years of teaching experience have the same slope but different intercepts. When Di is equal to one (male case), the factor 1Di is a constant term that is added to the intercept . Accordingly,
f a dummy y variable can be seen as the inclusion of constructing 2 different regression lines but with the same slope.

22.0 3 0 26.5 4 1 23.1 4 0 25.0 5 0 28.0 5 1 29.5 6 1 26.0 6 0 27.5 7 0 31.5 7 1 29 0 8 0 29.0

ANCOVA EXAMPLE
SUMMARY OUTPUT Regression Statistics Multiple R R Square Standard Error Observations ANOVA df Regression Residual Total 2 12 14 SS 157.7020476 1.067285714 158.7693333 MS 0.088940476 F Significance F 9.22751E-14 78.85102381 886.5594967 0.996633212 0.993277759 0.298228899 15

Adjusted R Squa 0.992157386

Intercept X SEX

Coefficients Standard Error 17.96928571 0.191955122 1 370714286 0.035645171 1.370714286 0 035645171 3.333571429 0.155373699

Upper 95.0% t Stat P-value Lower 95% Upper 95% Lower 95.0% 93.61191077 1.4761E-18 17.55105143 18.38752 17.55105 18.38752 38 45441721 6 38.45441721 6.15868E-14 15868E 14 1.293050129 1 293050129 1 1.448378442 448378442 1.29305 1 29305 1.448378 1 448378 21.4551848 6.1339E-11 2.99504122 3.672101637 2.995041 3.672102

Example
Salary Male

21.30286

Female

Years
T for H0: Parameter INTERCEPT YEARS SEX Estimate 17.96928571 1.37071429 3 3.33357143 33357143 Parameter=0 93.61 38.45 21 21.46 46 Pr > |T| 0.0001 0.0001 0 0.0001 0001 Std Error of Estimate 0.19195512 0.03564517 0 0.15537370 15537370

Dummy Variables Interaction


So far, we have discussed models where the impact of the dummy variable was on the intercept only not the slope (in the case of the ANCOVA example). But what if the qualitative variable impacted the slope as well? (in other words, words what if the impact of years of experience on the salary of males differed from that of females, and as such they each is going to have a different slope for the years variable?) In order to capture this possible difference in the Sal Years SEX 18 1 0 slope, we need to create an interaction term which will 21 1 1 be the product of our qualtitative variable with the 22 2 0 quantitative one (Years*Sex): q ( ) 22 3 22.3 2 1 Yi= + 1Di + 2Xi + 3 (Xi*Di )+ u
Where
Y = annual salary of college professor. Xi = Years of Experience. Experience Di = 1 if male, 0 if female.
24 24 25.2 25.6 27.8 28 28.3 30.2 29 32 33.2 3 3 4 4 5 5 6 6 7 7 8 0 1 0 1 1 0 1 0 1 0 0

will be added to 2. Accordingly, the slope for females will be 2 while the slope for males will be (2 + 3).
8

This model postulates that male and female professors salary functions in relation to the years of teaching experience could have different intercepts and different slopes. When Di is equal to one (male case), case) the factor 1Di is a constant term that is added to the intercept , and 3

Years*SEX 0 1 0 2 0 3 0 4 5 0 6 0 7 0 0

Example
Salary Slope=2.116-0.695=1.421 Male

Female

Slope=2.116

Years

Intercept Years SEX Years*SEX

Coefficients 17.05 2.116666667 2.692857143 -0.695238095

Standard Error 0.516044372 0.102192013 0.761313353 0.16157976


9

t Stat 33.03979452 20.71264278 3.5371206 -4.302754835

P-value 2.33092E-12 3.66968E-10 0.004656211 0.001250187

More on Dummy Variables


It is extremely important to note that we assign dummy variables in such a way that if a variable has m categories, we introduce only (m-1) dummies, otherwise we fall into what is termed the Dummy Variable Trap, where we have perfect collinearity. The mth category is regularly captured in the intercept coefficient. For example, p , if we are to introduce dummy y variables for College g Standing g with 4 different categories (Freshman, Sophomore, Junior and Others). We will only need three dummy variables. The reference standing will be captured by the intercept. intercept
Yi= + 1D1 + 2D2 + 3D3 + u
Where Y = annual salary D1 = 1 if Freshman, 0 otherwise D2 = 1 if Sophomore, 0 otherwise D3 = 1 if Junior, 0 otherwise
Freshman Sophomore Junior Others

D1
1 0 0 0

D2 D3
0 1 0 0 0 0 1 0
10

Вам также может понравиться