LECTURE 7 Introduction to Econometrics Nonlinear specifications and dummy variables October 27, 2017 1 / 25 ON THE PREVIOUS LECTURE 2 / 25 ON THE PREVIOUS LECTURE We showed how restrictions are incorporated in regression models 2 / 25 ON THE PREVIOUS LECTURE We showed how restrictions are incorporated in regression models We explained the idea of the F-test 2 / 25 ON THE PREVIOUS LECTURE We showed how restrictions are incorporated in regression models We explained the idea of the F-test We defined the notion of the overall significance of a regression 2 / 25 ON THE PREVIOUS LECTURE We showed how restrictions are incorporated in regression models We explained the idea of the F-test We defined the notion of the overall significance of a regression We introduced the measure or the goodness of fit - R2 2 / 25 ON THE PREVIOUS LECTURE We showed how restrictions are incorporated in regression models We explained the idea of the F-test We defined the notion of the overall significance of a regression We introduced the measure or the goodness of fit - R2 We showed how the F-test and the R2 are related 2 / 25 ON TODAY’S LECTURE 3 / 25 ON TODAY’S LECTURE We will discuss different specifications nonlinear in dependent and independent variables and their interpretation 3 / 25 ON TODAY’S LECTURE We will discuss different specifications nonlinear in dependent and independent variables and their interpretation We will define the notion of a dummy variable and we will show its different uses in linear regression models 3 / 25 NONLINEAR SPECIFICATION 4 / 25 NONLINEAR SPECIFICATION There is not always a linear relationship between dependent variable and explanatory variables 4 / 25 NONLINEAR SPECIFICATION There is not always a linear relationship between dependent variable and explanatory variables The use of OLS requires that the equation be linear in coefficients 4 / 25 NONLINEAR SPECIFICATION There is not always a linear relationship between dependent variable and explanatory variables The use of OLS requires that the equation be linear in coefficients However, there is a wide variety of functional forms that are linear in coefficients while being nonlinear in variables! 4 / 25 NONLINEAR SPECIFICATION There is not always a linear relationship between dependent variable and explanatory variables The use of OLS requires that the equation be linear in coefficients However, there is a wide variety of functional forms that are linear in coefficients while being nonlinear in variables! We have to choose carefully the functional form of the relationship between the dependent variable and each explanatory variable 4 / 25 NONLINEAR SPECIFICATION There is not always a linear relationship between dependent variable and explanatory variables The use of OLS requires that the equation be linear in coefficients However, there is a wide variety of functional forms that are linear in coefficients while being nonlinear in variables! We have to choose carefully the functional form of the relationship between the dependent variable and each explanatory variable The choice of a functional form should be based on the underlying economic theory and/or intuition 4 / 25 NONLINEAR SPECIFICATION There is not always a linear relationship between dependent variable and explanatory variables The use of OLS requires that the equation be linear in coefficients However, there is a wide variety of functional forms that are linear in coefficients while being nonlinear in variables! We have to choose carefully the functional form of the relationship between the dependent variable and each explanatory variable The choice of a functional form should be based on the underlying economic theory and/or intuition Do we expect a curve instead of a straight line? Does the effect of a variable peak at some point and then start to decline? 4 / 25 LINEAR FORM 5 / 25 LINEAR FORM y = β0 + β1x1 + β2x2 + ε 5 / 25 LINEAR FORM y = β0 + β1x1 + β2x2 + ε Assumes that the effect of the explanatory variable on the dependent variable is constant: 5 / 25 LINEAR FORM y = β0 + β1x1 + β2x2 + ε Assumes that the effect of the explanatory variable on the dependent variable is constant: ∂y ∂xk = βk k = 1, 2 5 / 25 LINEAR FORM y = β0 + β1x1 + β2x2 + ε Assumes that the effect of the explanatory variable on the dependent variable is constant: ∂y ∂xk = βk k = 1, 2 Interpretation: if xk increases by 1 unit (in which xk is measured), then y will change by βk units (in which y is measured) 5 / 25 LINEAR FORM y = β0 + β1x1 + β2x2 + ε Assumes that the effect of the explanatory variable on the dependent variable is constant: ∂y ∂xk = βk k = 1, 2 Interpretation: if xk increases by 1 unit (in which xk is measured), then y will change by βk units (in which y is measured) Linear form is used as default functional form until strong evidence that it is inappropriate is found 5 / 25 DOUBLE-LOG FORM 6 / 25 DOUBLE-LOG FORM ln y = β0 + β1 ln x1 + β2 ln x2 + ε 6 / 25 DOUBLE-LOG FORM ln y = β0 + β1 ln x1 + β2 ln x2 + ε Assumes that the elasticity of the dependent variable with respect to the explanatory variable is constant: 6 / 25 DOUBLE-LOG FORM ln y = β0 + β1 ln x1 + β2 ln x2 + ε Assumes that the elasticity of the dependent variable with respect to the explanatory variable is constant: ∂ ln y ∂ ln xk = ∂y/y ∂xk/xk = βk k = 1, 2 6 / 25 DOUBLE-LOG FORM ln y = β0 + β1 ln x1 + β2 ln x2 + ε Assumes that the elasticity of the dependent variable with respect to the explanatory variable is constant: ∂ ln y ∂ ln xk = ∂y/y ∂xk/xk = βk k = 1, 2 Interpretation: if xk increases by 1 percent, then y will change by βk percents 6 / 25 DOUBLE-LOG FORM ln y = β0 + β1 ln x1 + β2 ln x2 + ε Assumes that the elasticity of the dependent variable with respect to the explanatory variable is constant: ∂ ln y ∂ ln xk = ∂y/y ∂xk/xk = βk k = 1, 2 Interpretation: if xk increases by 1 percent, then y will change by βk percents Before using a double-log model, make sure that there are no negative or zero observations in the data set 6 / 25 EXAMPLE 7 / 25 EXAMPLE Estimating the production function of Indian sugar industry: 7 / 25 EXAMPLE Estimating the production function of Indian sugar industry: ln Q = 2.70 + 0.59 0.14) ln L + 0.33 0.17) ln K Q . . . output L . . . labor K . . . capital employed 7 / 25 EXAMPLE Estimating the production function of Indian sugar industry: ln Q = 2.70 + 0.59 0.14) ln L + 0.33 0.17) ln K Q . . . output L . . . labor K . . . capital employed Interpretation: if we increase the amount of labor by 1%, the production of sugar will increase by 0.59%, ceteris paribus. 7 / 25 EXAMPLE Estimating the production function of Indian sugar industry: ln Q = 2.70 + 0.59 0.14) ln L + 0.33 0.17) ln K Q . . . output L . . . labor K . . . capital employed Interpretation: if we increase the amount of labor by 1%, the production of sugar will increase by 0.59%, ceteris paribus. Ceteris paribus is a Latin phrase meaning ’other things being equal’. 7 / 25 SEMILOG FORMS 8 / 25 SEMILOG FORMS Linear-log form: y = β0 + β1 ln x1 + β2 ln x2 + ε 8 / 25 SEMILOG FORMS Linear-log form: y = β0 + β1 ln x1 + β2 ln x2 + ε Interpretation: if xk increases by 1 percent, then y will change by (βk/100) units (k = 1, 2) 8 / 25 SEMILOG FORMS Linear-log form: y = β0 + β1 ln x1 + β2 ln x2 + ε Interpretation: if xk increases by 1 percent, then y will change by (βk/100) units (k = 1, 2) Log-linear form: ln y = β0 + β1x1 + β2x2 + ε 8 / 25 SEMILOG FORMS Linear-log form: y = β0 + β1 ln x1 + β2 ln x2 + ε Interpretation: if xk increases by 1 percent, then y will change by (βk/100) units (k = 1, 2) Log-linear form: ln y = β0 + β1x1 + β2x2 + ε Interpretation: if xk increases by 1 unit, then y will change by (βk ∗ 100) percent (k = 1, 2) 8 / 25 EXAMPLES OF SEMILOG FORMS 9 / 25 EXAMPLES OF SEMILOG FORMS Estimating demand for chicken meat: Y = −6.94 − 0.57 0.19) PC + 0.25 0.11) PB + 12.2 2.81) ln YD Y . . . annual chicken consumption (kg.) PC . . . price of chicken PB . . . price of beef YD . . . annual disposable income 9 / 25 EXAMPLES OF SEMILOG FORMS Estimating demand for chicken meat: Y = −6.94 − 0.57 0.19) PC + 0.25 0.11) PB + 12.2 2.81) ln YD Y . . . annual chicken consumption (kg.) PC . . . price of chicken PB . . . price of beef YD . . . annual disposable income Interpretation: An increase in the annual disposable income by 1% increases chicken consumption by 0.12 kg per year, ceteris paribus. 9 / 25 EXAMPLES OF SEMILOG FORMS 10 / 25 EXAMPLES OF SEMILOG FORMS Estimating the influence of education and experience on wages: ln wage = 0.217 + 0.098 0.008) educ + 0.010 0.002) exper wage . . . annual wage (USD) educ . . . years of education exper . . . years of experience 10 / 25 EXAMPLES OF SEMILOG FORMS Estimating the influence of education and experience on wages: ln wage = 0.217 + 0.098 0.008) educ + 0.010 0.002) exper wage . . . annual wage (USD) educ . . . years of education exper . . . years of experience Interpretation: An increase in education by one year increases annual wage by 9.8%, ceteris paribus. An increase in experience by one year increases annual wage by 1%, ceteris paribus. 10 / 25 POLYNOMIAL FORM 11 / 25 POLYNOMIAL FORM y = β0 + β1x1 + β2x2 1 + ε 11 / 25 POLYNOMIAL FORM y = β0 + β1x1 + β2x2 1 + ε To determine the effect of x1 on y, we need to calculate the derivative: ∂y ∂x1 = β1 + 2 · β2 · x1 11 / 25 POLYNOMIAL FORM y = β0 + β1x1 + β2x2 1 + ε To determine the effect of x1 on y, we need to calculate the derivative: ∂y ∂x1 = β1 + 2 · β2 · x1 Clearly, the effect of x1 on y is not constant, but changes with the level of x1 11 / 25 POLYNOMIAL FORM y = β0 + β1x1 + β2x2 1 + ε To determine the effect of x1 on y, we need to calculate the derivative: ∂y ∂x1 = β1 + 2 · β2 · x1 Clearly, the effect of x1 on y is not constant, but changes with the level of x1 We might also have higher order polynomials, e.g.: y = β0 + β1x1 + β2x2 1 + β3x3 1 + β4x4 1 + ε 11 / 25 EXAMPLE OF POLYNOMIAL FORM 12 / 25 EXAMPLE OF POLYNOMIAL FORM The impact of the number of hours of studying on the grade from Introductory Econometrics: grade = 30 + 1.4 · hours − 0.009 · hours2 12 / 25 EXAMPLE OF POLYNOMIAL FORM The impact of the number of hours of studying on the grade from Introductory Econometrics: grade = 30 + 1.4 · hours − 0.009 · hours2 To determine the effect of hours on grade, calculate the derivative: ∂y ∂x = ∂grade ∂hours = 1.4 − 2 · 0.009 · hours = 1.4 − 0.018 · hours 12 / 25 EXAMPLE OF POLYNOMIAL FORM The impact of the number of hours of studying on the grade from Introductory Econometrics: grade = 30 + 1.4 · hours − 0.009 · hours2 To determine the effect of hours on grade, calculate the derivative: ∂y ∂x = ∂grade ∂hours = 1.4 − 2 · 0.009 · hours = 1.4 − 0.018 · hours Decreasing returns to hours of studying: more hours implies higher grade, but the positive effect of additional hour of studying decreases with more hours 12 / 25 CHOICE OF CORRECT FUNCTIONAL FORM 13 / 25 CHOICE OF CORRECT FUNCTIONAL FORM The functional form has to be correctly specified in order to avoid biased and inconsistent estimates 13 / 25 CHOICE OF CORRECT FUNCTIONAL FORM The functional form has to be correctly specified in order to avoid biased and inconsistent estimates Remember that one of the OLS assumptions is that the model is correctly specified 13 / 25 CHOICE OF CORRECT FUNCTIONAL FORM The functional form has to be correctly specified in order to avoid biased and inconsistent estimates Remember that one of the OLS assumptions is that the model is correctly specified Ideally: the specification is given by underlying theory of the equation 13 / 25 CHOICE OF CORRECT FUNCTIONAL FORM The functional form has to be correctly specified in order to avoid biased and inconsistent estimates Remember that one of the OLS assumptions is that the model is correctly specified Ideally: the specification is given by underlying theory of the equation In reality: underlying theory does not give precise functional form 13 / 25 CHOICE OF CORRECT FUNCTIONAL FORM The functional form has to be correctly specified in order to avoid biased and inconsistent estimates Remember that one of the OLS assumptions is that the model is correctly specified Ideally: the specification is given by underlying theory of the equation In reality: underlying theory does not give precise functional form In most cases, either linear form is adequate, or common sense will point out an easy choice from among the alternatives 13 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables 14 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables often approximated by polynomial form 14 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables often approximated by polynomial form missing higher powers of a variable can be detected as omitted variables (see next lecture) 14 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables often approximated by polynomial form missing higher powers of a variable can be detected as omitted variables (see next lecture) Nonlinearity of dependent variable 14 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables often approximated by polynomial form missing higher powers of a variable can be detected as omitted variables (see next lecture) Nonlinearity of dependent variable harder to detect based on statistical fit of the regression 14 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables often approximated by polynomial form missing higher powers of a variable can be detected as omitted variables (see next lecture) Nonlinearity of dependent variable harder to detect based on statistical fit of the regression R2 is incomparable across models where the y is transformed 14 / 25 CHOICE OF CORRECT FUNCTIONAL FORM Nonlinearity of explanatory variables often approximated by polynomial form missing higher powers of a variable can be detected as omitted variables (see next lecture) Nonlinearity of dependent variable harder to detect based on statistical fit of the regression R2 is incomparable across models where the y is transformed dependent variables are often transformed to log-form in order to make their distribution closer to the normal distribution 14 / 25 DUMMY VARIABLES 15 / 25 DUMMY VARIABLES Dummy variable - takes on the values of 0 or 1, depending on a qualitative attribute 15 / 25 DUMMY VARIABLES Dummy variable - takes on the values of 0 or 1, depending on a qualitative attribute Examples of dummy variables: 15 / 25 DUMMY VARIABLES Dummy variable - takes on the values of 0 or 1, depending on a qualitative attribute Examples of dummy variables: Male = 1 if the person is male 0 if the person is female Weekend = 1 if the day is on weekend 0 if the day is a work day NewStadium = 1 if the team plays on new stadium 0 if the team plays on old stadium 15 / 25 INTERCEPT DUMMY 16 / 25 INTERCEPT DUMMY Dummy variable included in a regression alone (not interacted with other variables) is an intercept dummy 16 / 25 INTERCEPT DUMMY Dummy variable included in a regression alone (not interacted with other variables) is an intercept dummy It changes the intercept for the subset of data defined by a dummy variable condition: yi = β0 + β1Di + β2xi + εi where Di = 1 if the i-th observation meets a particular condition 0 otherwise 16 / 25 INTERCEPT DUMMY Dummy variable included in a regression alone (not interacted with other variables) is an intercept dummy It changes the intercept for the subset of data defined by a dummy variable condition: yi = β0 + β1Di + β2xi + εi where Di = 1 if the i-th observation meets a particular condition 0 otherwise We have yi = (β0 + β1) + β2xi + εi if Di = 1 yi = β0 + β2xi + εi if Di = 0 16 / 25 INTERCEPT DUMMY X Y β0+β1 β0 Di=0 Di=1 Slope = β2 Slope = β2 17 / 25 EXAMPLE 18 / 25 EXAMPLE Estimating the determinants of wages: 18 / 25 EXAMPLE Estimating the determinants of wages: wagei = −3.890 + 2.156 0.270) Mi + 0.603 0.051) educi + 0.010 0.064) experi where Mi = 1 if the i-th person is male 0 if the i-th person is female wage . . . average hourly wage in USD 18 / 25 EXAMPLE Estimating the determinants of wages: wagei = −3.890 + 2.156 0.270) Mi + 0.603 0.051) educi + 0.010 0.064) experi where Mi = 1 if the i-th person is male 0 if the i-th person is female wage . . . average hourly wage in USD Interpretation of the dummy variable M: men earn on average $2.156 per hour more than women, ceteris paribus 18 / 25 SLOPE DUMMY 19 / 25 SLOPE DUMMY If a dummy variable is interacted with another variable (x), it is a slope dummy. 19 / 25 SLOPE DUMMY If a dummy variable is interacted with another variable (x), it is a slope dummy. It changes the relationship between x and y for a subset of data defined by a dummy variable condition: yi = β0 + β1xi + β2(xi · Di) + εi where Di = 1 if the i-th observation meets a particular condition 0 otherwise 19 / 25 SLOPE DUMMY If a dummy variable is interacted with another variable (x), it is a slope dummy. It changes the relationship between x and y for a subset of data defined by a dummy variable condition: yi = β0 + β1xi + β2(xi · Di) + εi where Di = 1 if the i-th observation meets a particular condition 0 otherwise We have yi = β0 + (β1 + β2)xi + εi if Di = 1 yi = β0 + β1xi + εi if Di = 0 19 / 25 SLOPE DUMMY X Y Slope = β1+β2 β0 Di=0 Di=1 Slope = β1 20 / 25 EXAMPLE 21 / 25 EXAMPLE Estimating the determinants of wages: 21 / 25 EXAMPLE Estimating the determinants of wages: wagei = −2.620+ 0.450 0.054) educi+ 0.170 0.021) Mi·educi+ 0.010 0.065) experi where Mi = 1 if the i-th person is male 0 if the i-th person is female wage . . . average hourly wage in USD 21 / 25 EXAMPLE Estimating the determinants of wages: wagei = −2.620+ 0.450 0.054) educi+ 0.170 0.021) Mi·educi+ 0.010 0.065) experi where Mi = 1 if the i-th person is male 0 if the i-th person is female wage . . . average hourly wage in USD Interpretation: men gain on average 17 cents per hour more than women for each additional year of education, ceteris paribus 21 / 25 SLOPE AND INTERCEPT DUMMIES 22 / 25 SLOPE AND INTERCEPT DUMMIES Allow both for different slope and intercept for two subsets of data distinguished by a qualitative condition: 22 / 25 SLOPE AND INTERCEPT DUMMIES Allow both for different slope and intercept for two subsets of data distinguished by a qualitative condition: yi = β0 + β1Di + β2xi + β3(xi · Di) + εi where Di = 1 if the i-th observation meets a particular condition 0 otherwise 22 / 25 SLOPE AND INTERCEPT DUMMIES Allow both for different slope and intercept for two subsets of data distinguished by a qualitative condition: yi = β0 + β1Di + β2xi + β3(xi · Di) + εi where Di = 1 if the i-th observation meets a particular condition 0 otherwise We have yi = (β0 + β1) + (β2 + β3)xi + εi if Di = 1 yi = β0 + β2xi + εi if Di = 0 22 / 25 SLOPE AND INTERCEPT DUMMIES X Y Slope = β2+β3 β0 Di=0 Di=1 Slope = β2 β0+β1 23 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES 24 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES What if a variable defines three or more qualitative attributes? 24 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES What if a variable defines three or more qualitative attributes? Example: level of education - elementary school, high school, and college 24 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES What if a variable defines three or more qualitative attributes? Example: level of education - elementary school, high school, and college Define and use a set of dummy variables: H = 1 if high school 0 otherwise and C = 1 if college 0 otherwise 24 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES What if a variable defines three or more qualitative attributes? Example: level of education - elementary school, high school, and college Define and use a set of dummy variables: H = 1 if high school 0 otherwise and C = 1 if college 0 otherwise Should we include also a third dummy in the regression, which is equal to 1 for people with elementary education? 24 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES What if a variable defines three or more qualitative attributes? Example: level of education - elementary school, high school, and college Define and use a set of dummy variables: H = 1 if high school 0 otherwise and C = 1 if college 0 otherwise Should we include also a third dummy in the regression, which is equal to 1 for people with elementary education? No, unless we exclude the intercept! 24 / 25 DUMMY VARIABLES - MULTIPLE CATEGORIES What if a variable defines three or more qualitative attributes? Example: level of education - elementary school, high school, and college Define and use a set of dummy variables: H = 1 if high school 0 otherwise and C = 1 if college 0 otherwise Should we include also a third dummy in the regression, which is equal to 1 for people with elementary education? No, unless we exclude the intercept! Using full set of dummies leads to perfect multicollinearity (dummy variable trap, see next lectures) 24 / 25 SUMMARY 25 / 25 SUMMARY We discussed different nonlinear specifications of a regression equation and their interpretation 25 / 25 SUMMARY We discussed different nonlinear specifications of a regression equation and their interpretation We defined the concept of a dummy variable and we showed its use 25 / 25 SUMMARY We discussed different nonlinear specifications of a regression equation and their interpretation We defined the concept of a dummy variable and we showed its use Further readings: Studenmund, Chapter 7 Wooldridge, Chapters 6 & 7 25 / 25