SHAZAM Seasonal Dummy Variables

Seasonal Dummy Variables


Seasonally adjusted time series are obtained by removing the seasonal component from the data. Statistical agencies may implement a seasonal adjustment procedure and report the deseaonalized time series. Another method for removing the seasonal factor is by the use of dummy variables.

A matrix of seasonal dummy variables can be created with the command:

MATRIX newvar=SEAS(nobs,nseas)

where newvar is the name of a matrix to contain the seasonal dummies, nobs is the number of observations and nseas is the number of periods in the seasonal cycle (4 for quarterly data and 12 for monthly data).

For example, with quarterly data, seasonal dummy variables may be defined as follows.

  QD1 = 1, if quarter 1 (Jan., Feb., Mar.), 0 otherwise
  QD2 = 1, if quarter 2 (Apr., May, June), 0 otherwise
  QD3 = 1, if quarter 3 (July, Aug., Sep.), 0 otherwise
  QD4 = 1, if quarter 4 (Oct., Nov., Dec.), 0 otherwise

The data matrix has the form:

                    QD1   QD2   QD3   QD4
                    ---------------------
Year 1  Quarter 1     1     0     0     0 
                2     0     1     0     0 
                3     0     0     1     0 
                4     0     0     0     1 
Year 2  Quarter 1     1     0     0     0 
                2     0     1     0     0 
                3     0     0     1     0 
                4     0     0     0     1 
Year 3  Quarter 1     1     0     0     0 
                2     0     1     0     0 
                3     0     0     1     0 
                4     0     0     0     1 
        etc.    

Warning: The SEAS function on the MATRIX command places a 1 in the first observation of the first column. Therefore, if the quarterly data starts in quarter 3 then the first column of the matrix of seasonal dummies will be the dummy variable for quarter 3.


Example

This example is discussed in Section 15.10 of Gujarati [1995, pp. 517-519]. The data set is quarterly seasonally unadjusted data on profits and sales for U.S. manufacturing corporations. The SHAZAM commands (filename: PROFITS.SHA) below create a matrix QD that contains 4 columns of seasonal dummies. The dummy variables for quarters 2, 3 and 4 are placed in the variables QD2, QD3 and QD4.

TIME 1965 4
SAMPLE 1965.1 1970.4
READ (PROFITS.txt) PERIOD PROFITS SALES 
GEN1 N=$N
* Create seasonal dummy variables
MATRIX QD=SEAS(N,4)
GENR QD2=QD:2
GENR QD3=QD:3
GENR QD4=QD:4

* Estimation with seasonal dummy variables   (Gujarati, Equation (15.10.2))
OLS PROFITS QD2 QD3 QD4 SALES 

* Test for the significance of seasonal factors
TEST  
  TEST QD2=0
  TEST QD3=0
  TEST QD4=0
END  
STOP

After the READ command the number of observations is available in the SHAZAM temporary variable $N. The GEN1 command is used to save this value in the variable N.

After estimation it may be of interest to test the various seasonal effects for statistical significance. The commands above show the use of TEST commands to test the null hypothesis that all seasonal effects are 0. An F-test statistic will be computed.

The SHAZAM output can be viewed. The estimated regression equation (with t-ratios in parentheses) is:

  Profits =  6688 + 1323 QD2 - 218 QD3 + 184 QD4 + 0.038 Sales + ê
            (3.91)  (2.07)   (-0.34)    (0.28)    (3.33)

The t-ratios give statistics for separately testing that each coefficient is equal to 0. The results show that the coefficients on the dummy variables for quarters 3 and 4 are not significantly different from 0. However, there is evidence that the coefficient on the dummy variable for quarter 2 is significantly greater than 0.

Testing a number of single hypotheses is not equivalent to a joint hypothesis test. A test of the joint hypothesis that all coefficients on the 3 quarterly seasonal dummy variables are equal to 0 has an F-test statistic of 2.38. This can be compared with a critical value from the F-distribution with (3,19) degrees of freedom. The SHAZAM output reports a p-value of 0.102. Therefore, at a 5% significance level we do not reject the null hypothesis, but at a 10% significance level there is some evidence to reject the null hypothesis of no seasonal effects.

Since there is some evidence for increased profits in the second quarter, relative to the other quarters, a restricted regression can be estimated using just a second quarter seasonal dummy. The following SHAZAM estimation command can be inserted into the above program to get the restricted OLS estimation results:

* Restricted Estimation    (Gujarati, Equation (15.10.3))
OLS PROFITS QD2 SALES

The SHAZAM estimation results can be viewed.

Avoid the Dummy Variable Trap

Alternative schemes can be used to allocate the dummy variables. For example, instead of excluding the first quarter dummy variable, the above application could have excluded the fourth quarter dummy variable. Another way of proceeding is to include dummy variables for all four quarters. If this method is used then the intercept must be dropped from the regression equation to avoid the dummy variable trap.

The next SHAZAM commands show model estimation with 4 quarterly seasonal dummy variables. The OLS regression includes the matrix of seasonal dummies QD in the list of explanatory variables. (SHAZAM will interpret the columns of the matrix as 4 separate explanatory variables). The NOCONSTANT option is used on the OLS command to specify that the intercept is to be excluded.

TIME 1965 4
SAMPLE 1965.1 1970.4
READ (PROFITS.txt) PERIOD PROFITS SALES 
GEN1 N=$N
* Create seasonal dummy variables
MATRIX QD=SEAS(N,4)
* Equation estimation
OLS PROFITS QD SALES / NOCONSTANT
STOP

The SHAZAM estimation results can be viewed. The estimated regression equation (with t-ratios in parentheses) is:

  Profits =  6688 QD1 + 8011 QD2 + 6471 QD3 + 6872 QD4 + 0.038 Sales + ê
            (3.91)      (4.38)     (3.62)    (3.63)      (3.33)

Home [SHAZAM Guide home]

SHAZAM output


|_TIME 1965 4
|_SAMPLE 1965.1 1970.4
|_READ (PROFITS.txt) PERIOD PROFITS SALES
UNIT 88 IS NOW ASSIGNED TO: PROFITS.txt
   3 VARIABLES AND       24 OBSERVATIONS STARTING AT OBS       1

|_GEN1 N=$N
..NOTE..CURRENT VALUE OF $N   =   24.000

|_* Create seasonal dummy variables
|_MATRIX QD=SEAS(N,4)
|_GENR QD2=QD:2
|_GENR QD3=QD:3
|_GENR QD4=QD:4

|_* Estimation with seasonal dummy variables   (Gujarati, Equation (15.10.2))
|_OLS PROFITS QD2 QD3 QD4 SALES

 OLS ESTIMATION
      24 OBSERVATIONS     DEPENDENT VARIABLE = PROFITS
...NOTE..SAMPLE RANGE SET TO:    1,   24

 R-SQUARE =   0.5255     R-SQUARE ADJUSTED =   0.4256
VARIANCE OF THE ESTIMATE-SIGMA**2 =  0.11800E+07
STANDARD ERROR OF THE ESTIMATE-SIGMA =   1086.3
SUM OF SQUARED ERRORS-SSE=  0.22420E+08
MEAN OF DEPENDENT VARIABLE =   12839.
LOG OF THE LIKELIHOOD FUNCTION = -199.023

VARIABLE   ESTIMATED  STANDARD   T-RATIO        PARTIAL STANDARDIZED ELASTICITY
  NAME    COEFFICIENT   ERROR      19 DF   P-VALUE CORR. COEFFICIENT  AT MEANS
QD2        1322.9      638.5       2.072     0.052 0.429     0.4083     0.0258
QD3       -217.81      632.3     -0.3445     0.734-0.079    -0.0672    -0.0042
QD4        183.86      654.3      0.2810     0.782 0.064     0.0567     0.0036
SALES     0.38246E-01 0.1148E-01   3.331     0.004 0.607     0.5503     0.4539
CONSTANT   6688.4      1711.       3.908     0.001 0.668     0.0000     0.5210

|_* Test for the significance of seasonal factors
|_TEST
|_  TEST QD2=0
|_  TEST QD3=0
|_  TEST QD4=0
|_END
F STATISTIC =   2.3796491     WITH    3 AND   19 D.F.  P-VALUE= 0.10171
WALD CHI-SQUARE STATISTIC =   7.1389474     WITH    3 D.F.  P-VALUE= 0.06760
UPPER BOUND ON P-VALUE BY CHEBYCHEV INEQUALITY = 0.42023
|_STOP

back [Back to Top] Home [SHAZAM Guide home]

SHAZAM output


 |_* Restricted Estimation    (Gujarati, Equation (15.10.3))
 |_OLS PROFITS QD2 SALES
 
  OLS ESTIMATION
       24 OBSERVATIONS     DEPENDENT VARIABLE = PROFITS
 ...NOTE..SAMPLE RANGE SET TO:    1,   24
 
  R-SQUARE =    .5155     R-SQUARE ADJUSTED =    .4693
 VARIANCE OF THE ESTIMATE-SIGMA**2 =   .10902E+07
 STANDARD ERROR OF THE ESTIMATE-SIGMA =   1044.1
 SUM OF SQUARED ERRORS-SSE=   .22894E+08
 MEAN OF DEPENDENT VARIABLE =   12839.
 LOG OF THE LIKELIHOOD FUNCTION = -199.275
 
 VARIABLE   ESTIMATED  STANDARD   T-RATIO        PARTIAL STANDARDIZED ELASTICITY
   NAME    COEFFICIENT   ERROR      21 DF   P-VALUE CORR. COEFFICIENT  AT MEANS 
 QD2        1331.4      493.0       2.700      .013  .508      .4109      .0259
 SALES      .39310E-01  .1057E-01   3.717      .001  .630      .5656      .4666
 CONSTANT   6515.6      1623.       4.014      .001  .659      .0000      .5075

back [Back to Top] Home [SHAZAM Guide home]

SHAZAM output


 |_OLS PROFITS QD SALES / NOCONSTANT
 
  OLS ESTIMATION
       24 OBSERVATIONS     DEPENDENT VARIABLE = PROFITS
 ...NOTE..SAMPLE RANGE SET TO:    1,   24
 
  R-SQUARE =    .5255     R-SQUARE ADJUSTED =    .4256
 VARIANCE OF THE ESTIMATE-SIGMA**2 =   .11800E+07
 STANDARD ERROR OF THE ESTIMATE-SIGMA =   1086.3
 SUM OF SQUARED ERRORS-SSE=   .22420E+08
 MEAN OF DEPENDENT VARIABLE =   12839.
 LOG OF THE LIKELIHOOD FUNCTION = -199.023
 RAW MOMENT R-SQUARE =    .9944
 
 VARIABLE   ESTIMATED  STANDARD   T-RATIO        PARTIAL STANDARDIZED ELASTICITY
   NAME    COEFFICIENT   ERROR      19 DF   P-VALUE CORR. COEFFICIENT  AT MEANS 
 QD         6688.4      1711.       3.908      .001  .668     2.0641      .1302
 QD         8011.3      1827.       4.384      .000  .709     2.4724      .1560
 QD         6470.6      1789.       3.617      .002  .639     1.9969      .1260
 QD         6872.2      1892.       3.632      .002  .640     2.1208      .1338
 SALES      .38246E-01  .1148E-01   3.331      .004  .607      .5503      .4539

back [Back to Top] Home [SHAZAM Guide home]