PANEL Procedure

Two-Way Fixed-Effects Model (FIXTWO Option)

You perform two-way fixed-effects estimation by specifying the FIXTWO option in the MODEL statement. The error specification for the two-way fixed-effects model is

u Subscript i t Baseline equals nu Subscript i Baseline plus lamda Subscript t Baseline plus e Subscript i t

where the nu Subscript i and lamda Subscript t are nonrandom parameters to be estimated.

Estimation is similar to that for one-way fixed effects, for which a within transformation is used to convert the problem to OLS regression. For two-way models under the general case of unbalanced data, the within transformation is more complex.

Following Wansbeek and Kapteyn (1989) and Baltagi (2013, sec. 9.4), let bold upper X Superscript asterisk and bold y Superscript asterisk be versions of bold upper X and bold y whose rows are sorted by time period, and by cross section within each time period. With the data sorted in this manner, define bold upper D Subscript upper N to be the upper M times upper N design matrix for cross sections. Each row of bold upper D Subscript upper N contains a 1 in the column that corresponds to that observation’s cross section, and 0s in the remaining columns. Similarly, define bold upper D Subscript upper T to be the upper M times upper T design matrix for time periods. In balanced data, bold upper D Subscript upper N Baseline equals bold j Subscript upper T Baseline circled-times bold upper I Subscript upper N and bold upper D Subscript upper T Baseline equals bold upper I Subscript upper T Baseline circled-times bold j Subscript upper N.

Define the following:

StartLayout 1st Row 1st Column bold upper Delta Subscript upper N 2nd Column equals bold upper D Subscript upper N Superscript prime Baseline bold upper D Subscript upper N Baseline 3rd Column left-parenthesis upper N times upper N right-parenthesis 2nd Row 1st Column bold upper Delta Subscript upper T 2nd Column equals bold upper D Subscript upper T Superscript prime Baseline bold upper D Subscript upper T Baseline 3rd Column left-parenthesis upper T times upper T right-parenthesis 3rd Row 1st Column bold upper A 2nd Column equals bold upper D Subscript upper T Superscript prime Baseline bold upper D Subscript upper N Baseline 3rd Column left-parenthesis upper T times upper N right-parenthesis 4th Row 1st Column bold upper D overbar 2nd Column equals bold upper D Subscript upper T Baseline minus bold upper D Subscript upper N Baseline normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper A Superscript prime Baseline 3rd Column left-parenthesis upper M times upper T right-parenthesis 5th Row 1st Column bold upper Q 2nd Column equals normal upper Delta Subscript upper T Baseline minus bold upper A normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper A Superscript prime Baseline 3rd Column left-parenthesis upper T times upper T right-parenthesis 6th Row 1st Column bold upper P 2nd Column equals bold upper I Subscript upper M Baseline minus bold upper D Subscript upper N Baseline normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper D Subscript upper N Superscript prime Baseline minus bold upper D overbar bold upper Q Superscript negative 1 Baseline bold upper D overbar Superscript prime Baseline 3rd Column left-parenthesis upper M times upper M right-parenthesis EndLayout

The matrix bold upper P provides the two-way within transformation. If the data are balanced, this amounts to transforming any data value z Subscript i t to z Subscript i t Baseline minus z overbar Subscript i period Baseline minus z overbar Subscript period t plus z overbar Subscript period period.

Applying the two-way within transformation means that you can use OLS regression of bold upper P bold y Superscript asterisk on bold upper P bold upper X Superscript asterisk to obtain ModifyingAbove bold-italic beta With caret Subscript f, Var left-parenthesis ModifyingAbove bold-italic beta With caret Subscript f Baseline right-parenthesis, and fit statistics such as mean square error (MSE), provided that you adjust the error degrees of freedom to equal upper M minus upper N minus upper T minus upper K plus 1.

Define the residual vector bold r Superscript asterisk Baseline equals bold y Superscript asterisk Baseline minus bold upper X Superscript asterisk Baseline ModifyingAbove bold-italic beta With caret Subscript f. Estimates of the time effects are ModifyingAbove bold-italic lamda With caret equals bold upper Q Superscript negative 1 Baseline bold upper D overbar Superscript prime Baseline bold r Superscript asterisk, and estimates of the cross-sectional effects are ModifyingAbove bold-italic nu With caret equals left-parenthesis normal upper Theta 1 minus normal upper Theta 2 plus normal upper Theta 3 right-parenthesis bold r Superscript asterisk, where

StartLayout 1st Row 1st Column normal upper Theta 1 2nd Column equals normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper D Subscript upper N Superscript prime Baseline 2nd Row 1st Column normal upper Theta 2 2nd Column equals normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper A Superscript prime Baseline bold upper Q Superscript negative 1 Baseline bold upper D Subscript upper T Superscript prime Baseline 3rd Row 1st Column normal upper Theta 3 2nd Column equals normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper A Superscript prime Baseline bold upper Q Superscript negative 1 Baseline bold upper A normal upper Delta Subscript upper N Superscript negative 1 Baseline bold upper D Subscript upper N Superscript prime EndLayout

The full model that contains the intercept, N cross-sectional effects, and T time effects is overidentified, and simultaneous estimation of these quantities is not possible without restrictions. If you specify the PRINTFIXED option, the printed fixed effects reflect these restrictions.

If the model has an intercept, then the PRINTFIXED option output is parameterized as follows:

  • Intercept: ModifyingAbove nu With caret Subscript upper N Baseline plus ModifyingAbove lamda With caret Subscript upper T

  • Cross section i: ModifyingAbove nu With caret Subscript i Baseline minus ModifyingAbove nu With caret Subscript upper N

  • Time period t: ModifyingAbove lamda With caret Subscript t Baseline minus ModifyingAbove lamda With caret Subscript upper T

If the model does not include an intercept, then the PRINTFIXED option output is parameterized as follows:

  • Cross section i: ModifyingAbove nu With caret Subscript i Baseline plus ModifyingAbove lamda With caret Subscript upper T

  • Time period t: ModifyingAbove lamda With caret Subscript t Baseline minus ModifyingAbove lamda With caret Subscript upper T

Variance and covariance estimates for the intercept and printed fixed effects are obtained by the delta method, because each of these quantities is a linear transformation of bold y Superscript asterisk and ModifyingAbove bold-italic beta With caret Subscript f.

Last updated: June 19, 2025