### Unbalanced Panels

Let and be the independent and dependent variables arranged by time and by cross section within each time period. (Note that the input data set used by the PANEL procedure must be sorted by cross section and then by time within each cross section.) Let be the number of cross sections observed in year and let . Let be the matrix obtained from the identity matrix from which rows that correspond to cross sections not observed at time have been omitted. Consider where and . The matrix gives the dummy variable structure for the two-way model.

Let            The estimate of the regression slope coefficients is given by where is the matrix without the vector of 1s.

The estimator of the error variance is where the residuals are given by if there is an intercept in the model and by if there is no intercept.

The actual implementation is quite different from the theory. The PANEL procedure transforms all series using the matrix. The variable being transformed is , which could be or any column of . After the data are properly transformed, OLS is run on the resulting series.

Given , the next step is estimating the cross-sectional and time effects. Given that is the column vector of cross-sectional effects and is the column vector of time effects,     Given the cross-sectional and time effects, the next step is to derive the associated dummy variables. Using the NOINT option, the following equations give the dummy variables:  When an intercept is desired, the equations for dummy variables and intercept are:   The calculation of the variance-covariance matrix is as follows:      where           Now you work out the variance covariance estimates for the dummy variables.

#### Variance Covariance of Dummy Variables with No Intercept

The variances and covariances of the dummy variables are given under the NOINT selection as follows:          #### Variance Covariance of Dummy Variables with Intercept

The variances and covariances of the dummy variables are given as follows when the intercept is included:                