UCM Procedure

Example 30.9 Extracting a Business Cycle

The data set (not shown) gdp in this example has two variables: date dates the observations, and lgdp contains the quarterly readings of the US real GDP (in log scale). Pelagatti (2015, Example 3.3, Example 8.2) uses this quarterly time series (lgdp) to illustrate how you can adjust the smoothness of the estimated cycle by changing the order of the cycle in a trend-cycle decomposition,

normal l normal g normal d normal p Subscript t Baseline equals mu Subscript t Baseline plus psi Subscript t Baseline plus epsilon Subscript t

where mu Subscript t is an integrated random walk trend, psi Subscript t is a cycle component, and epsilon Subscript t is an irregular component.


/* Load data into mylib */
data mylib.gdp;
   set gdp;
run;

The following statements fit the model normal l normal g normal d normal p Subscript t Baseline equals mu Subscript t Baseline plus psi Subscript t Baseline plus epsilon Subscript t, where the cycle component has an order of 1 (default):


proc ucm data= mylib.gdp;
    where year(date) >= 1970;
    id date interval=quarter;
    model lgdp;
    irregular;
    level variance=0 noest plot=smooth;
    slope;
    cycle plot=smooth;
    estimate plot=panel;
    forecast plot=decomp outfor= mylib.for1;
run;

The following statements fit the same model, except that the cycle order is 2. Similarly, a model with a cycle order of 4 is also fit (not shown).


proc ucm data=mylib.gdp;
    where year(date) >= 1970;
    id date interval=quarter;
    model lgdp;
    irregular;
    level variance=0 noest plot=smooth;
    slope;
    cycle order=2 plot=smooth;
    estimate plot=panel;
    forecast plot=decomp outfor= mylib.for2;
run;

Output 30.9.1 summarizes the features of the estimated cycles of different orders. The estimated periods of the first-order and second-order cycles, 31.59 and 45.18, are reasonable. However, the period of the fourth-order cycle seems quite unreasonable. Fortunately, Pelagatti (2015, Example 8.2) mentions that cycles of order 3 or higher are rarely needed when you are working with real economic series. Although they are not the same, the parameter estimates that the UCM procedure produces are reasonably close to those reported in Pelagatti (2015, Example 8.2).

Output 30.9.1: Cycles of Orders 1, 2, and 4: Summary

orderperiodFrequencyRhoErrorVar
131.592940.198880.943710.00004873
245.182570.139060.761770.00000956
4388770.000161620.520550.00000856


Output 30.9.2 shows the plot of the first-order cycle, Output 30.9.3 shows the plot of the second-order cycle, and Output 30.9.4 shows the plot of the fourth-order cycle. You can see that although the overall form of the estimated cycle remains the same, the smoothness of the plot of the estimated cycle increases with the order.

Output 30.9.2: Estimated Cycle: Order = 1

Estimated Cycle: Order = 1


Output 30.9.3: Estimated Cycle: Order = 2

Estimated Cycle: Order = 2


Output 30.9.4: Estimated Cycle: Order = 4

Estimated Cycle: Order = 4


Output 30.9.5 shows the three cycle estimates in the same plot. It shows that the estimates do not differ very much.

Output 30.9.5: Estimated Cycles of Orders 1, 2, and 4

Estimated Cycles of Orders 1, 2, and 4


Last updated: November 24, 2025