Stat/Math
Software Support
Software Consulting
Software Availability
Software Price
Contact

User Support
Documentation
Knowledge Base
Education
Consulting
Podcasts

Systems & Services
Cyberinfrastructure
Supercomputers
Grid Computing
Storage
Visualization
Digital Libraries & Data

Results & Impact
Publications
Grants & Grant Info
Events & Outreach
Economic Impact
Survey Results

Vision & Planning
News & Features

## 6. The Fixed Group and Time Effect Model

A two-way fixed model explores fixed effects of two group variables, two time variables, or one group or one time variables. This chapter investigates fixed group and time effects. This model thus needs two sets of group and time dummy variables (i.e., airline and year). The two-way fixed model considers both group and time effects.

6.1 Least Squares Dummy Variable Models

You may combine LSDV1, LSDV2, and LSDV3 to avoid perfect multicollinearity or the dummy variable trap in a two-way fixed effect model. There are five strategies when combining three LSDVs. Since .cnsreg does not allow suppressing the intercept, strategy 4 does not work in Stata. The first strategy of dropping two dummies is generally recommended because of its convenience of model estimation and interpretation.There are four approaches
• Drop one cross-section and one time-series dummy variables
• Drop one cross-section dummy and suppress the intercept. or drop one time-series and suppress the intercept
• Drop one cross-section dummy and impose a restriction on the time-series dummies. Or drop one time-series dummy and impose a restriction on the cross-section dummies
• Suppress the interceptone and impose a restriction on either cross-section or time-series dummies
• Include all dummy variables and impose two restrictions on the cross-section and time-series dummies
Each strategy produces different dummy coefficients but returns exactly same parameter estimates of regressors. In general, dummy coefficients are not of primary interest in panel data models.

6.2 LSDV1 without Two Dummies

Let us first run LSDV1 using Stata.

. regress cost g1-g5 t1-t14 output fuel load

Source |       SS       df       MS              Number of obs =      90
-------------+------------------------------           F( 22,    67) = 1960.82
Model |  113.864044    22  5.17563838           Prob > F      =  0.0000
Residual |  .176848775    67  .002639534           R-squared     =  0.9984
Total |  114.040893    89  1.28135835           Root MSE      =  .05138

------------------------------------------------------------------------------
cost |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
g1 |   .1742825   .0861201     2.02   0.047     .0023861     .346179
g2 |   .1114508   .0779551     1.43   0.157    -.0441482    .2670499
g3 |   -.143511   .0518934    -2.77   0.007    -.2470907   -.0399313
g4 |   .1802087   .0321443     5.61   0.000     .1160484    .2443691
g5 |  -.0466942   .0224688    -2.08   0.042    -.0915422   -.0018463
t1 |  -.6931382   .3378385    -2.05   0.044    -1.367467   -.0188098
t2 |  -.6384366   .3320802    -1.92   0.059    -1.301271    .0243983
t3 |  -.5958031   .3294473    -1.81   0.075    -1.253383    .0617764
t4 |  -.5421537   .3189139    -1.70   0.094    -1.178708    .0944011
t5 |  -.4730429   .2319459    -2.04   0.045    -.9360088   -.0100769
t6 |  -.4272042     .18844    -2.27   0.027    -.8033319   -.0510764
t7 |  -.3959783   .1732969    -2.28   0.025    -.7418804   -.0500762
t8 |  -.3398463   .1501062    -2.26   0.027    -.6394596    -.040233
t9 |  -.2718933   .1348175    -2.02   0.048    -.5409901   -.0027964
t10 |  -.2273857   .0763495    -2.98   0.004      -.37978   -.0749914
t11 |  -.1118032   .0319005    -3.50   0.001     -.175477   -.0481295
t12 |   -.033641   .0429008    -0.78   0.436    -.1192713    .0519893
t13 |  -.0177346   .0362554    -0.49   0.626    -.0901007    .0546315
t14 |  -.0186451    .030508    -0.61   0.543    -.0795393     .042249
output |   .8172487    .031851    25.66   0.000     .7536739    .8808235
fuel |     .16861    .163478     1.03   0.306    -.1576935    .4949135
load |  -.8828142   .2617373    -3.37   0.001    -1.405244   -.3603843
_cons |   12.94004   2.218231     5.83   0.000     8.512434    17.36765
------------------------------------------------------------------------------

The following is the corresponding SAS REG procedure (outputs are skipped).

PROC REG DATA=masil.airline;
MODEL cost = g1-g5 t1-t14 output fuel load;
RUN;

The LIMDEP example is skipped here, since many dummy variables need to be listed in the Regress\$ command.

Top

6.3 LSDV1 + LSDV3: Dropping a Dummy and Imposing a Restriction

In the second approach, you may drop either one group dummy or one time dummy. The following drops one time dummy, includes all group dummies, and imposes a restriction on group dummies.

PROC REG DATA=masil.airline;
MODEL cost = g1-g6 t1-t14 output fuel load;
RESTRICT g1 + g2 + g3 + g4 + g5 + g6 = 0;
RUN;

The REG Procedure
Model: MODEL1
Dependent Variable: cost

NOTE: Restrictions have been applied to parameter estimates.

Number of Observations Used          90

Analysis of Variance

Sum of           Mean
Source                   DF        Squares         Square    F Value    Pr > F

Model                    22      113.86404        5.17564    1960.82    <.0001
Error                    67        0.17685        0.00264
Corrected Total          89      114.04089

Root MSE              0.05138    R-Square     0.9984
Dependent Mean       13.36561    Adj R-Sq     0.9979
Coeff Var             0.38439

Parameter Estimates

Parameter       Standard
Variable     DF       Estimate          Error    t Value    Pr > |t|

Intercept     1       12.98600        2.22540       5.84     <.0001
g1            1        0.12833        0.04601       2.79     0.0069
g2            1        0.06549        0.03897       1.68     0.0975
g3            1       -0.18947        0.01561     -12.14     <.0001
g4            1        0.13425        0.01832       7.33     <.0001
g5            1       -0.09265        0.03731      -2.48     0.0155
g6            1       -0.04596        0.04161      -1.10     0.2733
t1            1       -0.69314        0.33784      -2.05     0.0441
t2            1       -0.63844        0.33208      -1.92     0.0588
t3            1       -0.59580        0.32945      -1.81     0.0750
t4            1       -0.54215        0.31891      -1.70     0.0938
t5            1       -0.47304        0.23195      -2.04     0.0454
t6            1       -0.42720        0.18844      -2.27     0.0266
t7            1       -0.39598        0.17330      -2.28     0.0255
t8            1       -0.33985        0.15011      -2.26     0.0268
t9            1       -0.27189        0.13482      -2.02     0.0477
t10           1       -0.22739        0.07635      -2.98     0.0040
t11           1       -0.11180        0.03190      -3.50     0.0008
t12           1       -0.03364        0.04290      -0.78     0.4357
t13           1       -0.01773        0.03626      -0.49     0.6263
t14           1       -0.01865        0.03051      -0.61     0.5432
output        1        0.81725        0.03185      25.66     <.0001
fuel          1        0.16861        0.16348       1.03     0.3061
load          1       -0.88281        0.26174      -3.37     0.0012
RESTRICT     -1    -1.9387E-16              .        .        .

* Probability computed using beta distribution.

Alternatively, you may run the Stata .cnsreg command with the second constraint (output is skipped).

. cnsreg cost g1-g6 t1-t14 output fuel load, constraint(2)

The following drops one group dummy and imposes a restriction on time dummies.

. cnsreg cost g1-g5 t1-t15 output fuel load, constraint(3)

Constrained linear regression                          Number of obs =      90
F( 22,    67) = 1960.82
Prob > F      =  0.0000
Root MSE      =  .05138
( 1)  t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 + t14 + t15 = 0
------------------------------------------------------------------------------
cost |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
g1 |   .1742825   .0861201     2.02   0.047     .0023861     .346179
g2 |   .1114508   .0779551     1.43   0.157    -.0441482    .2670499
g3 |   -.143511   .0518934    -2.77   0.007    -.2470907   -.0399313
g4 |   .1802087   .0321443     5.61   0.000     .1160484    .2443691
g5 |  -.0466942   .0224688    -2.08   0.042    -.0915422   -.0018463
t1 |  -.3740245    .191872    -1.95   0.055    -.7570026    .0089536
t2 |  -.3193228   .1860877    -1.72   0.091    -.6907554    .0521097
t3 |  -.2766893   .1833501    -1.51   0.136    -.6426576    .0892789
t4 |  -.2230399   .1729671    -1.29   0.202    -.5682837    .1222038
t5 |  -.1539291   .0864404    -1.78   0.079    -.3264649    .0186066
t6 |  -.1080904   .0448591    -2.41   0.019    -.1976296   -.0185513
t7 |  -.0768646   .0319336    -2.41   0.019    -.1406043   -.0131248
t8 |  -.0207326   .0204506    -1.01   0.314     -.061552    .0200869
t9 |   .0472205   .0290822     1.62   0.109    -.0108278    .1052688
t10 |   .0917281   .0811525     1.13   0.262    -.0702531    .2537092
t11 |   .2073105   .1491443     1.39   0.169    -.0903829    .5050039
t12 |   .2854727   .1756365     1.63   0.109    -.0650993    .6360447
t13 |   .3013791   .1660294     1.82   0.074     -.030017    .6327752
t14 |   .3004686   .1536212     1.96   0.055    -.0061606    .6070978
t15 |   .3191137   .1474883     2.16   0.034     .0247259    .6135015
output |   .8172487    .031851    25.66   0.000     .7536739    .8808235
fuel |     .16861    .163478     1.03   0.306    -.1576935    .4949135
load |  -.8828142   .2617373    -3.37   0.001    -1.405244   -.3603843
_cons |   12.62093   2.074302     6.08   0.000     8.480603    16.76125
------------------------------------------------------------------------------

You may run the following SAS REG procedure to get the same result (output is skipped).

PROC REG DATA=masil.airline; /* LSDV3 */
MODEL cost = g1-g5 t1-t15 output fuel load;
RESTRICT t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15=0;
RUN;

Top

6.4 LSDV3 with Two Restrictions

The third approach includes all group and time dummies and imposes two restrictions on group and time dummies.

. cnsreg cost g1-g6 t1-t15 output fuel load, constraint(2 3)

Constrained linear regression                          Number of obs =      90
F( 22,    67) = 1960.82
Prob > F      =  0.0000
Root MSE      =  .05138
( 1)  g1 + g2 + g3 + g4 + g5 + g6 = 0
( 2)  t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + t11 + t12 + t13 + t14 + t15 = 0
------------------------------------------------------------------------------
cost |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
g1 |   .1283264   .0460126     2.79   0.007     .0364849    .2201679
g2 |   .0654947   .0389685     1.68   0.097    -.0122867    .1432761
g3 |  -.1894671   .0156096   -12.14   0.000     -.220624   -.1583102
g4 |   .1342526   .0183163     7.33   0.000      .097693    .1708121
g5 |  -.0926504   .0373085    -2.48   0.016    -.1671184   -.0181824
g6 |  -.0459561   .0416069    -1.10   0.273    -.1290038    .0370916
t1 |  -.3740245    .191872    -1.95   0.055    -.7570026    .0089536
t2 |  -.3193228   .1860877    -1.72   0.091    -.6907554    .0521097
t3 |  -.2766893   .1833501    -1.51   0.136    -.6426576    .0892789
t4 |  -.2230399   .1729671    -1.29   0.202    -.5682837    .1222038
t5 |  -.1539291   .0864404    -1.78   0.079    -.3264649    .0186066
t6 |  -.1080904   .0448591    -2.41   0.019    -.1976296   -.0185513
t7 |  -.0768646   .0319336    -2.41   0.019    -.1406043   -.0131248
t8 |  -.0207326   .0204506    -1.01   0.314     -.061552    .0200869
t9 |   .0472205   .0290822     1.62   0.109    -.0108278    .1052688
t10 |   .0917281   .0811525     1.13   0.262    -.0702531    .2537092
t11 |   .2073105   .1491443     1.39   0.169    -.0903829    .5050039
t12 |   .2854727   .1756365     1.63   0.109    -.0650993    .6360447
t13 |   .3013791   .1660294     1.82   0.074     -.030017    .6327752
t14 |   .3004686   .1536212     1.96   0.055    -.0061606    .6070978
t15 |   .3191137   .1474883     2.16   0.034     .0247259    .6135015
output |   .8172487    .031851    25.66   0.000     .7536739    .8808235
fuel |     .16861    .163478     1.03   0.306    -.1576935    .4949135
load |  -.8828142   .2617373    -3.37   0.001    -1.405244   -.3603843
_cons |   12.66688   2.081068     6.09   0.000     8.513054    16.82071
------------------------------------------------------------------------------

The following SAS REG procedure gives you the same result (output is skipped).

PROC REG DATA=masil.airline;
MODEL cost = g1-g6 t1-t15 output fuel load;
RESTRICT g1 + g2 + g3 + g4 + g5 + g6 = 0;
RESTRICT t1+t2+t3+t4+t5+t6+t7+t8+t9+t10+t11+t12+t13+t14+t15=0;
RUN;

Top

6.5 Two-way Within Effect Model

The two-way within group and time effect model requires a transformation of the data set. The following commands do this task.

. gen w_cost = cost - gm_cost - tm_cost + m_cost
. gen w_output = output - gm_output - tm_output + m_output
. gen w_fuel = fuel - gm_fuel - tm_fuel + m_fuel

. tabstat cost output fuel load, stat(mean)

stats |      cost    output      fuel      load
---------+----------------------------------------
mean |  13.36561 -1.174309  12.77036  .5604602
--------------------------------------------------

Now, run the OLS with the transformed variables. Do not forget to suppress the intercept.

. regress w_cost w_output w_fuel w_load, noc // within effect

Source |       SS       df       MS              Number of obs =      90
-------------+------------------------------           F(  3,    87) =  307.86
Model |  1.87739643     3  .625798811           Prob > F      =  0.0000
Residual |  .176848774    87  .002032745           R-squared     =  0.9139
Total |  2.05424521    90  .022824947           Root MSE      =  .04509

------------------------------------------------------------------------------
w_cost |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
w_output |   .8172487   .0279512    29.24   0.000     .7616927    .8728048
w_fuel |     .16861   .1434621     1.18   0.243    -.1165364    .4537565
w_load |  -.8828142   .2296907    -3.84   0.000    -1.339349    -.426279
------------------------------------------------------------------------------

Note again that R2, MSE, standard errors, and DF of error are not correct. The dummy variable coefficients need to be computed. The standard errors also need to be adjusted; for instance, the standard error of the load factor is .2617=.2297*sqrt(87/67).

Top

6.6 Using the TSCSREG and PANEL Procedures

The SAS TSCSREG and PANEL procedures have the /FIXTWO option to fit the two-way fixed effect model.

PROC TSCSREG DATA=masil.airline;
ID airline year;
MODEL cost = output fuel load /FIXTWO;
RUN;

The TSCSREG Procedure

Dependent Variable: cost

Model Description

Estimation Method             FixTwo
Number of Cross Sections           6
Time Series Length                15

Fit Statistics

SSE              0.1768    DFE                  67
MSE              0.0026    Root MSE         0.0514
R-Square         0.9984

F Test for No Fixed Effects

Num DF      Den DF    F Value    Pr > F

19          67      23.10    <.0001

Parameter Estimates

Standard
Variable        DF    Estimate       Error    t Value    Pr > |t|    Label

CS1              1    0.174283      0.0861       2.02      0.0470    Cross Sectional
Effect    1
CS2              1    0.111451      0.0780       1.43      0.1575    Cross Sectional
Effect    2
CS3              1    -0.14351      0.0519      -2.77      0.0073    Cross Sectional
Effect    3
CS4              1    0.180209      0.0321       5.61      <.0001    Cross Sectional
Effect    4
CS5              1    -0.04669      0.0225      -2.08      0.0415    Cross Sectional
Effect    5
TS1              1    -0.69314      0.3378      -2.05      0.0441    Time Series
Effect    1
TS2              1    -0.63844      0.3321      -1.92      0.0588    Time Series
Effect    2
TS3              1     -0.5958      0.3294      -1.81      0.0750    Time Series
Effect    3
TS4              1    -0.54215      0.3189      -1.70      0.0938    Time Series
Effect    4
TS5              1    -0.47304      0.2319      -2.04      0.0454    Time Series
Effect    5
TS6              1     -0.4272      0.1884      -2.27      0.0266    Time Series
Effect    6
TS7              1    -0.39598      0.1733      -2.28      0.0255    Time Series
Effect    7
TS8              1    -0.33985      0.1501      -2.26      0.0268    Time Series
Effect    8
TS9              1    -0.27189      0.1348      -2.02      0.0477    Time Series
Effect    9
TS10             1    -0.22739      0.0763      -2.98      0.0040    Time Series
Effect   10
TS11             1     -0.1118      0.0319      -3.50      0.0008    Time Series
Effect   11
TS12             1    -0.03364      0.0429      -0.78      0.4357    Time Series
Effect   12
TS13             1    -0.01773      0.0363      -0.49      0.6263    Time Series
Effect   13
TS14             1    -0.01865      0.0305      -0.61      0.5432    Time Series
Effect   14
Intercept        1    12.94004      2.2182       5.83      <.0001    Intercept
output           1    0.817249      0.0319      25.66      <.0001
fuel             1     0.16861      0.1635       1.03      0.3061
load             1    -0.88281      0.2617      -3.37      0.0012

The Stata .xtreg command does not fit the two-way fixed or random effect model. The following LIMDEP command fits the two-way fixed model. Note that this command has Str\$ and Period\$ specifications to specify stratification and time variables. This command presents the pooled model and one-way group effect model as well, but reports the incorrect intercept in the two-way fixed model, 12.667 (2.081).

Fixed\$

Top

6.7 Testing Fixed Group and Time Effects

The null hypothesis is that parameters of group and time dummies are zero. The F test compares the pooled regression and two-way group and time effect model. The F statistic of 23.1085 rejects the null hypothesis at the .01 significance level (p<.0000).

The SAS TSCSREG and PANEL procedures conduct the F-test for the group and time effects. You may also run the following SAS REG procedure and .regress command to perform the same test.

PROC REG DATA=masil.airline;
MODEL cost = g1-g5 t1-t14 output fuel load;
TEST g1=g2=g3=g4=g5=t1=t2=t3=t4=t5=t6=t7=t8=t9=t10=t11=t12=t13=t14=0;
RUN;

. quietly regress cost g1-g5 t1-t14 output fuel load
. test g1 g2 g3 g4 g5 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14