Assume that the data are balanced (for example, all cross sections have T observations). Then you can write
where the symbols are as follows:
and are the dependent variable (a scalar) and the explanatory variables (a vector whose columns are the explanatory variables, not including a constant), respectively
and are cross section means
and are time means
and are the overall means
The two-way fixed-effects model is simply a regression of on . Therefore, the two-way is given by
The following calculations of cross-sectional dummy variables, time dummy variables, and intercepts are similar to how they are calculated in the one-way model:
First, you obtain the net cross-sectional and time effects. Denote the cross-sectional effects by and the time effects by . These effects are calculated from the following relations:
Use the superscript C and T to denote the cross-sectional dummy variables and time dummy variables, respectively. Under the NOINT option, the following equations produce the dummy variables:
When an intercept is specified, the equations for dummy variables and intercept are
The sum of squared errors is
The estimated error variance is
With or without a constant, the covariance matrix of is given by
For information about the covariance matrix that is related to dummy variables, see the section Two-Way Fixed-Effects Model.