PANEL Procedure

Example 25.2 The Airline Cost Data: First Difference or Fixed Effects

(View the complete code for this example.)

Example 25.1 fits the airline data by using a two-way fixed-effects model, as suggested by the poolability test results in Output 25.1.3. However, you might wonder why you should not use a first-difference model, considering that both first-difference models and fixed-effects models can be used for data that have fixed effects. The answer is that you could, but the first-difference model does not provide as good a fit as the fixed-effects model in this case. This example illustrates how to fit the airline cost data by using a first-difference model. It also gives you some guidance about when to use a first-difference model and when to use a fixed-effects model.

When there are only two time periods, the two methods are identical. When there are more than two time periods, the two models are different. Under the strict exogeneity assumption, both models provide unbiased and consistent estimates; however, the efficiency is different between the two models. The efficiency depends on the serial correlation of errors in the original model. Consider the following one-way fixed-effects model:

y Subscript i t Baseline equals alpha plus bold x Subscript i t Baseline bold-italic beta plus nu Subscript i Baseline plus e Subscript i t

The fixed effects can be removed by subtracting first-order lags (first differences) or by subtracting the mean of the series (fixed effects) from both sides of the equation. The regression error is normal upper Delta e Subscript i t Baseline identical-to e Subscript i t Baseline minus e Subscript i comma t minus 1 for the first-difference model and e overTilde Subscript i t Baseline identical-to e Subscript i t Baseline minus e Subscript i Baseline overbar for the fixed-effects model, where e Subscript i Baseline overbar is the mean of the e Subscript i t series. If the original error term e Subscript i t is uncorrelated over time (that is, normal c normal o normal v left-parenthesis e Subscript i t Baseline comma e Subscript i comma t minus 1 Baseline right-parenthesis equals 0), then normal c normal o normal v left-parenthesis normal upper Delta e Subscript i t Baseline comma normal upper Delta e Subscript i comma t minus 1 Baseline right-parenthesis equals minus normal v normal a normal r left-parenthesis normal upper Delta e Subscript i comma t minus 1 Baseline right-parenthesis and normal c normal o normal r normal r left-parenthesis normal upper Delta e Subscript i comma t minus 1 Baseline right-parenthesis equals negative 0.5. This means that the first-difference model is not efficient in this case, and that the fixed-effects model would be more efficient and thus preferred. On the other hand, if e Subscript i t follows a random walk process (that is, e Subscript i t Baseline equals e Subscript i comma t minus 1 Baseline plus epsilon Subscript i t and epsilon Subscript i t is a white noise process), then normal upper Delta e Subscript i t Baseline equals epsilon Subscript i t is a white noise process. In this case, the first-difference model is efficient and the fixed-effects model is not. Every so often you might see that the error term is between these two extremes, meaning that e Subscript i t follows an AR(1) process and e Subscript i t Baseline equals rho e Subscript i comma t minus 1 Baseline plus epsilon Subscript i t. In such cases, the choice of model depends on where rho is. If rho is close to 0, the fixed-effects model is preferred. If rho is close to 1, the first-difference model is preferred. Hence you need to check the autocorrelation of the regression errors. Run the first-difference model or fixed-effects model first, and then check the autocorrelation of the regression errors (normal upper Delta e Subscript i t and e overTilde Subscript i t). For example, if the covariance of the regression errors from the first-difference model is negative and significant, this suggests that original errors are more likely to be uncorrelated, and the fixed-effects model is preferred. Of course, you might also get positive correlation, which makes it harder to make a decision. A common practice is to run both models and use the model that provides more efficient estimates.

First, you create the Airline data set and log-transform the variables, as in the following DATA step:

data Airline;
   input Obs AirlineID T C Q PF LF;
   Year = T + 1969;
   lC   = log(C);
   lQ   = log(Q);
   lPF  = log(PF);
   label lC  = "Log Transformation of Costs";
   label lQ  = "Log Transformation of Quantity";
   label lPF = "Log Transformation of Price of Fuel";
   label LF  = "Load Factor (utilization index)";
datalines;
 1    1     1    1140640    0.95276     106650    0.53449
 2    1     2    1215690    0.98676     110307    0.53233
 3    1     3    1309570    1.09198     110574    0.54774
 4    1     4    1511530    1.17578     121974    0.54085
 5    1     5    1676730    1.16017     196606    0.59117

   ... more lines ...   

Example 25.1 shows how to fit the airline data by using a fixed-effects model. The following statements fit a two-way fixed-effects model and test the autocorrelation of the regression errors:

proc sort data = Airline;
   by AirlineID Year;
run;

proc panel data = Airline;
   id AirlineID Year;
   model lC = lQ lPF LF / fixtwo printfixed DW;
run;

The estimation results are the same as in Output 25.1.7 and so are not listed here. The DW option provides a test of serial correlation by using the Durbin-Watson statistic. The test results are shown in Output 25.2.1.

Output 25.2.1: Durbin-Watson Statistic for Two-Way Fixed-Effects Model

The PANEL Procedure
Fixed Two-Way Estimates
 
Dependent Variable: lC (Log Transformation of Costs)

Durbin-Watson Statistic for First-Order Correlation in a Fixed Effects Model
DFStatisticWhite Noise vs. Positive
Correlation
Random Walk vs. StationaryWhite Noise vs. Negative
Correlation
Pr <
DWLower
Pr <
DWUpper
Pr >
DWLower
Pr >
DWUpper
StatisticPr <
DWLower
Pr <
DWUpper
10.69<.0001<.00010.03230.43443.311.00001.0000


As shown in Output 25.2.1, the test statistic is 0.69, indicating positive correlation among regression errors. The white noise versus positive correlation test result also rejects the null hypothesis of white noise and suggests positive correlation at the 1% significance level. The DWLower and DWUpper values for the random walk versus stationary test can be treated as bounds on the exact p-value. The results show that the exact p-value is from 0.0323 to 0.4344, making it uncertain whether the regression errors follow a random walk. In such cases, you should probably also run the first-difference model and compare the estimation results from the two models. For more information about the Durbin-Watson test, see the section Durbin-Watson Test.

The following statements fit a two-way first-difference model and test the autocorrelation of the regression errors:

proc panel data = Airline;
   id AirlineID Year;
   model lC = lQ lPF LF / fdtwo printfixed BW;
run;

Output 25.2.2 provides a model description, a data description, and fit statistics. The fit statistics are very close to the fit statistics of the fixed-effects model shown in Output 25.1.7, indicating that the two models have a close fit.

Output 25.2.2: Airline Cost Data, First-Difference, Model Description

The PANEL Procedure
First Difference Estimates for Two-Way
 
Dependent Variable: lC (Log Transformation of Costs)

Model Description
Estimation MethodFDTwo
Number of Cross Sections6
Time Series Length15

Fit Statistics
SSE0.1562DFE67
MSE0.0023Root MSE0.0483
R-Square0.9986  


The first-difference model also supports the PRINTFIXED option. The BW option provides a test of serial correlation for the first-difference model by using the Berenblut-Webb statistic. The test results are shown in Output 25.2.3.

Output 25.2.3: Berenblut-Webb Statistic for Two-Way First-Difference Model

Berenblut-Webb Statistic for First-Order Correlation in a Fixed Effects Model
DFStatisticWhite Noise vs. Positive
Correlation
Random Walk vs. StationaryWhite Noise vs. Negative
Correlation
Pr < BWLowerPr < BWUpperPr > BWLowerPr > BWUpper StatisticPr < BWLowerPr < BWUpper
10.60<.0001<.00010.08370.60943.401.00001.0000


As for the fixed-effects model, Output 25.2.3 also indicates a positive correlation among the regression errors, and it is not clear whether the random walk hypothesis could be rejected at the 10% significance level. You need to compare the standard errors of the two models. The estimation results are shown in Output 25.2.4.

Output 25.2.4: Airline Cost Data, Two-Way First-Difference

Parameter Estimates
VariableDFEstimateStandard
Error
t ValuePr > |t|Label
CS110.3453210.14992.300.0243Cross Sectional Effect 1
CS210.2413740.13321.810.0745Cross Sectional Effect 2
CS31-0.032710.0852-0.380.7021Cross Sectional Effect 3
CS410.2360730.04884.84<.0001Cross Sectional Effect 4
CS51-0.010920.0221-0.490.6226Cross Sectional Effect 5
TS11-0.990650.1923-5.15<.0001Time Series Effect 1
TS21-0.926560.1886-4.91<.0001Time Series Effect 2
TS31-0.856240.1843-4.65<.0001Time Series Effect 3
TS41-0.790410.1773-4.46<.0001Time Series Effect 4
TS51-0.648820.1322-4.91<.0001Time Series Effect 5
TS61-0.582450.1110-5.25<.0001Time Series Effect 6
TS71-0.53520.1020-5.25<.0001Time Series Effect 7
TS81-0.458870.0894-5.13<.0001Time Series Effect 8
TS91-0.348290.0794-4.39<.0001Time Series Effect 9
TS101-0.25850.0503-5.14<.0001Time Series Effect 10
TS111-0.126130.0343-3.670.0005Time Series Effect 11
TS121-0.027510.0365-0.750.4543Time Series Effect 12
TS131-0.016820.0326-0.520.6072Time Series Effect 13
TS141-0.018480.0285-0.650.5194Time Series Effect 14
Intercept10.3091391.20770.260.7988Intercept
lQ10.7693040.054214.19<.0001Log Transformation of Quantity
lPF10.0754820.08710.870.3893Log Transformation of Price of Fuel
LF1-1.403260.2173-6.46<.0001Load Factor (utilization index)


As shown in Output 25.2.4, most parameter estimation results of two-way first-difference models are close to the results of the two-way fixed-effects model in Output 25.1.7. The estimation of the intercept is the one item that is very different between the two methods, but it is not significant in the first-difference method. As in the two-way fixed-effects model, the estimation of the log transformation of fuel price is not significant here, because the change in it is mostly captured by the time effect. Comparing the results of the two models, the fixed-effects model works slightly better for the airline cost data, because there are more estimates at the 5% significance level in this model. If you are interested, you can run the one-way fixed effects by using both methods, and you will find that the estimation results are even more similar than for the two-way model.

Last updated: June 19, 2025