SEASONAL Instruction |
SEASONAL( options ) series start end
Creates a seasonal dummy series. SEASONAL has an older syntax (which is still supported) using two extra parameters. See the description at the end. We would recommend using the newer form.
Wizard
You can use the Data/Graphics—Trend/Seasonals/Dummies Wizard to generate seasonal dummies.
Parameters
|
series |
Series to set as a seasonal dummy. |
|
start, end |
Range of entries to set. This defaults to the range from 1 to the standard workspace length + the seasonal - 1. See the explanation below. |
Options
SPAN=the seasonal span [CALENDAR seasonal]
PERIOD=first period to receive value 1 [last period in year]
SPAN sets the seasonal span, or periodicity, in terms of the number of periods per year (12 for monthly, 4 for quarterly). This defaults to the seasonal defined by the CALENDAR instruction.
PERIOD indicates the first period (between start and end) which is to get the value 1. In other words, this determines the month or quarter represented by the dummy. This defaults to the entry start+SEASONAL-1, that is, the dummy is set up for the last period within the year. See below for details.
CENTERED/[NOCENTERED]
If you use CENTERED, SEASONAL produces a centered seasonal dummy rather than a standard 0–1 dummy. From a standard dummy, subtract 1.0/seasonal from each entry. For instance, a 4th quarter dummy will use the sequence -.25, -.25, -.25, .75. Centered dummies have certain advantages when you use seasonal–1 of them together with a CONSTANT. You need to be careful, however, as a full set of seasonal centered dummies is linearly dependent.
Sample Instructions
cal(m) 1948:1
seasonal(period=1948:12) december 1948:1 2013:12
defines the series december as a seasonal dummy for December (because period=1948:12—the first December in the range).
cal(q) 1947:1
allocate 2013:4
seasonal seasons
defines a 4th quarter dummy (last period of the year) through 2014:3 (one year out less one period).
Using Complete Sets of Dummies
To put a complete set of seasonals in a regression, the simplest procedure is to create a single dummy for the last period of the year and use its leads. That way, you don’t need to create separate dummies for each period. The default for end is larger than the highest entry on ALLOCATE so that all these leads will be defined.
You can use the series created in the second example to cover all four quarters by
linreg . . .
# seasons{-3 to 0} ...
(Use SEASONS{-2 TO 0} if you include the CONSTANT). The only tricky part to this is determining which quarter corresponds to each lead in the regression output. SEASONS, itself, is the 4th quarter dummy. SEASONS{-1} (lead 1) is the third quarter dummy, SEASONS{-2} is the second quarter.
If you define centered seasonals, you should use seasonal-1 of them together with CONSTANT to cover all the seasons, for instance,
seasonal(centered) centered_seas
linreg . . .
# constant centered_seas{-2 to 0} ...
There are two advantages for this versus using uncentered (0–1) dummies:
•The coefficient on CONSTANT has the same basic meaning as in an analogous non-seasonal regression. With 0–1 dummies, the CONSTANT is the intercept for the omitted seasonal.
•The coefficients on the dummies are the difference between each season and the overall average. With 0–1 dummies, they are the difference between each season and the omitted one.
There is, of course, no difference in fit, just in interpretation of the coefficients.
Sometimes, however, you may need a separate series for each period. For quarterly data, it is probably simplest to just do three or four separate SEASONAL instructions. With more periods per year, however, you will probably want to automate the process. Use a vector of series, and define the dummies in a loop:
dec vect[series] seasonals(12)
do i=1,12
seasonal(period=i) seasonals(i) 1947:1 2010:12
end do i
creates a vector of series which have the twelve dummies as its twelve elements. You can then use SEASONALS in a regressor list to add the full set.
SEASONAL with Panel Data
Panel data requires different treatment from standard time series data. Leads and lags are not allowed to cross from one individual to another. Thus, the leads of a single dummy will not work correctly: LINREG will drop entries at the end of each cross-section. With panel data, you will have to create a separate dummy for each quarter or month. The process for doing this is described at the end of the previous segment.
SEASONAL with Daily/Weekly Data
SEASONAL is unlikely to be very helpful with daily, weekly and related frequencies. The only type of useful dummy variable you can create is one for a particular weekday, using as SPAN the number of days per week.
Use SET with logical and date functions to generate other types of calendar dummy variables. For instance,
cal(daily) 1990:1:1
all 2010:12:31
set monday = %weekday(t)==1
This uses the %WEEKDAY function (which returns “1” for Mondays) to create a MONDAY dummy variable.
You can use other date functions, such as %MONTH or %PERIOD as an alternative to SEASONAL for monthly, quarterly and other dummies:
set january = %month(t)==1
creates a January dummy variable (1 for all entries which fall in a January, 0 otherwise).
Example
This is the simplest way to put a full set of seasonals into a regression. With monthly data
seasonal seasons
creates a dummy variable for December. Leads 0 to 10 (written as lags 0 to -10) will cover every month dummy from December to February, leaving out January to avoid the dummy variable trap. If you leave out the CONSTANT, you can use lags 0 to -11 to cover every month.
*
* Harvey, "Forecasting, ..., Kalman Filter"
* Seatbelt data example from pp 391-2
* BSM with seasonal and shift variables, stability test
*
open data seatbelt.prn
calendar(m) 1969
data(format=prn,org=columns) 1969:01 1984:12 drivers front rear kms petrol rate law
*
set drivers = drivers*100.0
*
* Start with estimate on 1, t, seasonal dummies and the two explanatory variables
*
set trend = t
seasonal seasons
*
linreg drivers * 1981:12
# constant trend seasons{0 to -10} kms petrol
In the output, SEASONS{-10} is the February dummy, ..., SEASONS{-1} is November and SEASONS itself is December.
Linear Regression - Estimation by Least Squares
Dependent Variable DRIVERS
Monthly Data From 1969:01 To 1981:12
Usable Observations 156
Degrees of Freedom 141
Centered R^2 0.7459870
R-Bar^2 0.7207659
Uncentered R^2 0.9998973
Mean of Dependent Variable 744.24448718
Std Error of Dependent Variable 15.01807613
Standard Error of Estimate 7.93594327
Sum of Squared Residuals 8880.0665848
Regression F(14,141) 29.5778
Significance Level of F 0.0000000
Log Likelihood -536.6077
Durbin-Watson Statistic 1.3841
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 250.9123437 120.2969318 2.08578 0.03880090
2. TREND -0.2156169 0.0411163 -5.24407 0.00000056
3. SEASONS{-10} -10.0538867 3.1356346 -3.20633 0.00166348
4. SEASONS{-9} -14.8454738 3.6349551 -4.08409 0.00007386
5. SEASONS{-8} -24.1253838 3.9224511 -6.15059 0.00000001
6. SEASONS{-7} -19.3817985 4.6913582 -4.13138 0.00006152
7. SEASONS{-6} -22.8115189 4.8246215 -4.72815 0.00000543
8. SEASONS{-5} -20.6084628 5.6208793 -3.66641 0.00034760
9. SEASONS{-4} -22.2336806 5.9961578 -3.70799 0.00029952
10. SEASONS{-3} -14.8707586 4.7856214 -3.10738 0.00228319
11. SEASONS{-2} -4.5171569 4.1657978 -1.08434 0.28006302
12. SEASONS{-1} 12.2624680 3.3997509 3.60687 0.00042929
13. SEASONS 20.9979371 3.1922579 6.57777 0.00000000
14. KMS 47.2313870 13.5456001 3.48684 0.00065204
15. PETROL -30.2123577 5.9990456 -5.03619 0.00000143
Older Syntax
SEASONAL( options ) series start end seasonal period
Deprecated Parameters
|
seasonal |
This parameter is the older way of handling what's now the SPAN option. |
|
period |
This parameter is the older way of handling what's now the PERIOD option. |
Copyright © 2025 Thomas A. Doan