1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple...

22
1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example of a model with two types. COST = 1 + OCC + RES + 2 N + u

Transcript of 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple...

Page 1: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

1

TWO SETS OF DUMMY VARIABLES

The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example of a model with two types.

COST = 1+ OCC + RES + 2N + u

Page 2: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

2

We will continue with the school cost function model and extend it to take account of the fact that some of the schools are residential.

TWO SETS OF DUMMY VARIABLES

COST = 1+ OCC + RES + 2N + u

Page 3: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

3

To model the higher overhead costs of residential schools, we introduce a dummy variable RES which is equal to 1 for them and 0 for nonresidential schools. is the extra annual overhead cost of a residential school, relative to that of a nonresidential one.

TWO SETS OF DUMMY VARIABLES

COST = 1+ OCC + RES + 2N + u

Page 4: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

4

We will also make a distinction between occupational and regular schools, using the dummy variable OCC defined in the first sequence. (It would be better to use the four-category school classification, and in practice we would, but it would complicate the graphics.)

TWO SETS OF DUMMY VARIABLES

COST = 1+ OCC + RES + 2N + u

Page 5: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

5

If a school has a regular curriculum and is nonresidential, both dummy variables are 0 and the cost function simplifies to its basic components.

TWO SETS OF DUMMY VARIABLES

Regular, nonresidential(OCC = RES = 0)

COST = 1+ OCC + RES + 2N + u

COST = 1+ 2N + u

Page 6: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

6

TWO SETS OF DUMMY VARIABLES

For a residential regular school, RES is equal to 1 and the intercept increases by an amount .

TWO SETS OF DUMMY VARIABLES

Regular, nonresidential(OCC = RES = 0)

COST = 1+ OCC + RES + 2N + u

COST = 1+ 2N + u

COST = (1+ ) + 2N + uRegular, residential(OCC = 0; RES = 1)

Page 7: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

7

In the case of a nonresidential occupational school, RES is 0 and OCC is 1, so the overhead cost increases by . If the school is both occupational and residential, it increases by ( + ).

TWO SETS OF DUMMY VARIABLES

Regular, nonresidential(OCC = RES = 0)

COST = 1+ OCC + RES + 2N + u

COST = 1+ 2N + u

COST = (1+ ) + 2N + uRegular, residential(OCC = 0; RES = 1)

COST = (1+ + ) + 2N + u

Occupational, residential(OCC = 1; RES = 1)

COST = (1+ ) + 2N + uOccupational, nonresidential (OCC = 1; RES = 0)

Page 8: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

N

1++1+

1+1

Occupational, residential

Regular, nonresidential

+

8

Occupational,nonresidential

Regular,residential

The diagram illustrates the model graphically. Note that the effects of the different components of the model are assumed to be separate and additive in this specification.

TWO SETS OF DUMMY VARIABLES

COST

Page 9: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

9

In particular, we are assuming that the extra overhead cost of a residential school is the same for regular and occupational schools.

TWO SETS OF DUMMY VARIABLES

N

1++1+

1+1

Occupational, residential

Regular, nonresidential

+

Occupational,nonresidential

Regular,residential

COST

Page 10: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

Here are the data for the first 10 schools. Note how the values of the dummy variables vary according to the characteristics of the school.

10

School Type Residential? COST  N  OCC RES

1 Occupational No 345,000 623 1 0

2 Occupational Yes 537,000 653 1 1

3 Regular No 170,000 400 0 0

4 Occupational Yes 526.000 663 1 1

5 Regular No 100,000 563 0 0

6 Regular No 28,000 236 0 0

7 Regular Yes 160,000 307 0 1

8 Occupational No 45,000 173 1 0

9 Occupational No 120,000 146 1 0

10 Occupational No 61,000 99 1 0

TWO SETS OF DUMMY VARIABLES

Page 11: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

Here is a scatter diagram showing the four types of school.

11

TWO SETS OF DUMMY VARIABLES

N

COST

-100000

0

100000

200000

300000

400000

500000

600000

0 200 400 600 800 1000 1200

Nonresidential regular Residential regular

Nonresidential occupational Residential occupational

Page 12: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

. reg COST N OCC RES

Source | SS df MS Number of obs = 74---------+------------------------------ F( 3, 70) = 40.43 Model | 9.3297e+11 3 3.1099e+11 Prob > F = 0.0000Residual | 5.3838e+11 70 7.6911e+09 R-squared = 0.6341---------+------------------------------ Adj R-squared = 0.6184 Total | 1.4713e+12 73 2.0155e+10 Root MSE = 87699

------------------------------------------------------------------------------ COST | Coef. Std. Err. t P>|t| [95% Conf. Interval]---------+-------------------------------------------------------------------- N | 321.833 39.40225 8.168 0.000 243.2477 400.4183 OCC | 109564.6 24039.58 4.558 0.000 61619.15 157510 RES | 57909.01 30821.31 1.879 0.064 -3562.137 119380.2 _cons | -29045.27 23291.54 -1.247 0.217 -75498.78 17408.25------------------------------------------------------------------------------

Here is the Stata output for the regression. We will start by interpreting the regression coefficients. The coefficient of N indicates that the marginal cost per student is 322 yuan per year.

12

TWO SETS OF DUMMY VARIABLES

Page 13: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

. reg COST N OCC RES

Source | SS df MS Number of obs = 74---------+------------------------------ F( 3, 70) = 40.43 Model | 9.3297e+11 3 3.1099e+11 Prob > F = 0.0000Residual | 5.3838e+11 70 7.6911e+09 R-squared = 0.6341---------+------------------------------ Adj R-squared = 0.6184 Total | 1.4713e+12 73 2.0155e+10 Root MSE = 87699

------------------------------------------------------------------------------ COST | Coef. Std. Err. t P>|t| [95% Conf. Interval]---------+-------------------------------------------------------------------- N | 321.833 39.40225 8.168 0.000 243.2477 400.4183 OCC | 109564.6 24039.58 4.558 0.000 61619.15 157510 RES | 57909.01 30821.31 1.879 0.064 -3562.137 119380.2 _cons | -29045.27 23291.54 -1.247 0.217 -75498.78 17408.25------------------------------------------------------------------------------

The constant provides an estimate of the annual overhead cost of the reference category, nonresidential regular schools. It is still negative, which does not make any sense.

13

TWO SETS OF DUMMY VARIABLES

Page 14: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

. reg COST N OCC RES

Source | SS df MS Number of obs = 74---------+------------------------------ F( 3, 70) = 40.43 Model | 9.3297e+11 3 3.1099e+11 Prob > F = 0.0000Residual | 5.3838e+11 70 7.6911e+09 R-squared = 0.6341---------+------------------------------ Adj R-squared = 0.6184 Total | 1.4713e+12 73 2.0155e+10 Root MSE = 87699

------------------------------------------------------------------------------ COST | Coef. Std. Err. t P>|t| [95% Conf. Interval]---------+-------------------------------------------------------------------- N | 321.833 39.40225 8.168 0.000 243.2477 400.4183 OCC | 109564.6 24039.58 4.558 0.000 61619.15 157510 RES | 57909.01 30821.31 1.879 0.064 -3562.137 119380.2 _cons | -29045.27 23291.54 -1.247 0.217 -75498.78 17408.25------------------------------------------------------------------------------

The coefficient of OCC indicates that the annual overhead costs of occupational schools are 110,000 yuan more than those of regular schools.

14

TWO SETS OF DUMMY VARIABLES

Page 15: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

. reg COST N OCC RES

Source | SS df MS Number of obs = 74---------+------------------------------ F( 3, 70) = 40.43 Model | 9.3297e+11 3 3.1099e+11 Prob > F = 0.0000Residual | 5.3838e+11 70 7.6911e+09 R-squared = 0.6341---------+------------------------------ Adj R-squared = 0.6184 Total | 1.4713e+12 73 2.0155e+10 Root MSE = 87699

------------------------------------------------------------------------------ COST | Coef. Std. Err. t P>|t| [95% Conf. Interval]---------+-------------------------------------------------------------------- N | 321.833 39.40225 8.168 0.000 243.2477 400.4183 OCC | 109564.6 24039.58 4.558 0.000 61619.15 157510 RES | 57909.01 30821.31 1.879 0.064 -3562.137 119380.2 _cons | -29045.27 23291.54 -1.247 0.217 -75498.78 17408.25------------------------------------------------------------------------------

The coefficient of RES indicates that the annual overhead costs of residential schools are 58,000 yuan greater than those of nonresidential schools.

15

TWO SETS OF DUMMY VARIABLES

Page 16: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

The regression result is shown at the top in equation form. Putting both dummy variables equal to 0, we obtain the implicit cost function for nonresidential regular schools.

16

TWO SETS OF DUMMY VARIABLES

Regular, nonresidential(OCC = RES = 0)

COST = –29,000 + 110,000OCC + 58,000RES + 322N^

^COST = –29,000 + 322N

Page 17: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

Putting RES equal to 1, but keeping OCC at 0, we obtain the cost function for residential regular schools.

17

TWO SETS OF DUMMY VARIABLES

Regular, nonresidential(OCC = RES = 0)

COST = –29,000 + 110,000OCC + 58,000RES + 322N

Regular, residential(OCC = 0; RES = 1)

^

^COST = –29,000 + 322N

^COST = –29,000 + 58,000 + 322N= 29,000 + 322N

Page 18: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

And similarly the cost functions for nonresidential and residential occupational schools are derived by putting OCC equal to 1 and RES equal to 0 and 1, respectively.

18

TWO SETS OF DUMMY VARIABLES

Regular, nonresidential(OCC = RES = 0)

COST = –29,000 + 110,000OCC + 58,000RES + 322N

Regular, residential(OCC = 0; RES = 1)

Occupational, residential(OCC = 1; RES = 1)

Occupational, nonresidential(OCC = 1; RES = 0)

^

^COST = –29,000 + 322N

^COST = –29,000 + 58,000 + 322N= 29,000 + 322N

^COST = –29,000 + 110,000 + 322N= 81,000 + 322N

^COST = –29,000 + 110,000 + 58,000 + 322N= 139,000 + 322N

Page 19: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

Here is the scatter diagram with the four cost functions implicit in the regression result.

19

TWO SETS OF DUMMY VARIABLES

-100000

0

100000

200000

300000

400000

500000

600000

0 200 400 600 800 1000 1200

Nonresidential regular Residential regular

Nonresidential occupational Residential occupational

O, R

O, NR, R

R, N

N

COST

Page 20: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

. reg COST N OCC RES

Source | SS df MS Number of obs = 74---------+------------------------------ F( 3, 70) = 40.43 Model | 9.3297e+11 3 3.1099e+11 Prob > F = 0.0000Residual | 5.3838e+11 70 7.6911e+09 R-squared = 0.6341---------+------------------------------ Adj R-squared = 0.6184 Total | 1.4713e+12 73 2.0155e+10 Root MSE = 87699

------------------------------------------------------------------------------ COST | Coef. Std. Err. t P>|t| [95% Conf. Interval]---------+-------------------------------------------------------------------- N | 321.833 39.40225 8.168 0.000 243.2477 400.4183 OCC | 109564.6 24039.58 4.558 0.000 61619.15 157510 RES | 57909.01 30821.31 1.879 0.064 -3562.137 119380.2 _cons | -29045.27 23291.54 -1.247 0.217 -75498.78 17408.25------------------------------------------------------------------------------

t tests and F tests can be performed in the usual way. The coefficient of the occupational school dummy variable is significantly different from 0 at the 0.1% significance level.

20

TWO SETS OF DUMMY VARIABLES

Page 21: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

. reg COST N OCC RES

Source | SS df MS Number of obs = 74---------+------------------------------ F( 3, 70) = 40.43 Model | 9.3297e+11 3 3.1099e+11 Prob > F = 0.0000Residual | 5.3838e+11 70 7.6911e+09 R-squared = 0.6341---------+------------------------------ Adj R-squared = 0.6184 Total | 1.4713e+12 73 2.0155e+10 Root MSE = 87699

------------------------------------------------------------------------------ COST | Coef. Std. Err. t P>|t| [95% Conf. Interval]---------+-------------------------------------------------------------------- N | 321.833 39.40225 8.168 0.000 243.2477 400.4183 OCC | 109564.6 24039.58 4.558 0.000 61619.15 157510 RES | 57909.01 30821.31 1.879 0.064 -3562.137 119380.2 _cons | -29045.27 23291.54 -1.247 0.217 -75498.78 17408.25------------------------------------------------------------------------------

However, the t ratio for the coefficient of RES is only 1.87. Fortunately we may perform a one-sided test (why?), so it is significantly different from 0 at the 5% level (but not the 1% level).

21

TWO SETS OF DUMMY VARIABLES

Page 22: 1 TWO SETS OF DUMMY VARIABLES The explanatory variables in a regression model may include multiple sets of dummy variables. This sequence provides an example.

Copyright Christopher Dougherty 2012.

These slideshows may be downloaded by anyone, anywhere for personal use.

Subject to respect for copyright and, where appropriate, attribution, they may be

used as a resource for teaching an econometrics course. There is no need to

refer to the author.

The content of this slideshow comes from Section 5.2 of C. Dougherty,

Introduction to Econometrics, fourth edition 2011, Oxford University Press.

Additional (free) resources for both students and instructors may be

downloaded from the OUP Online Resource Centre

http://www.oup.com/uk/orc/bin/9780199567089/.

Individuals studying econometrics on their own who feel that they might benefit

from participation in a formal course should consider the London School of

Economics summer school course

EC212 Introduction to Econometrics

http://www2.lse.ac.uk/study/summerSchools/summerSchool/Home.aspx

or the University of London International Programmes distance learning course

EC2020 Elements of Econometrics

www.londoninternational.ac.uk/lse.

2012.11.04