CSSM Procedure

Example 14.1 Bivariate Basic Structural Model

This example illustrates how you can use the CSSM procedure to analyze a bivariate time series. The following data set contains two variables, f_KSI and r_KSI, which are measured quarterly, starting the first quarter of 1969. The variable f_KSI represents the quarterly average of the log of the monthly totals of the front-seat passengers killed or seriously injured during the car accidents, and r_KSI represents a similar number for the rear-seat passengers. The data set has been extended at the end with eight missing values, which represent four quarters, to cause the CSSM procedure to produce model forecasts for this span.

data seatBelt;
input f_KSI r_KSI @@;
label f_KSI = "Front Seat Passengers Injured--log scale";
label r_KSI = "Rear Seat Passengers Injured--log scale";
date = intnx( 'quarter', '1jan1969'd, _n_-1 );
format date YYQS.;
datalines;
    6.72417 5.64654  6.81728 6.06123  6.92382 6.18190
    6.92375 6.07763  6.84975 5.78544  6.81836 6.04644
    7.00942 6.30167  7.09329 6.14476  6.78554 5.78212
    6.86323 6.09520  6.99369 6.29507  6.98344 6.06194
    6.81499 5.81249  6.92997 6.10534  6.96356 6.21298
    7.02296 6.15261  6.76466 5.77967  6.95563 6.18993
    7.02016 6.40524  6.87849 6.06308  6.55966 5.66084
    6.73627 6.02395  6.91553 6.25736  6.83576 6.03535
    6.52075 5.76028  6.59860 5.91208  6.70597 6.08029
    6.75110 5.98833  6.53117 5.67676  6.52718 5.90572
    6.65963 6.01003  6.76869 5.93226  6.44483 5.55616
    6.62063 5.82533  6.72938 6.04531  6.82182 5.98277
    6.64134 5.76540  6.66762 5.91378  6.83524 6.13387
    6.81594 5.97907  6.60761 5.66838  6.62985 5.88151
    6.76963 6.06895  6.79927 6.01991  6.52728 5.69113
    6.60666 5.92841  6.72242 6.03111  6.76228 5.93898
    6.54290 5.72538  6.62469 5.92028  6.73415 6.11880
    6.74094 5.98009  6.46418 5.63517  6.61537 5.96040
    6.76185 6.15613  6.79546 6.04152  6.21529 5.70139
    6.27565 5.92508  6.40771 6.13903  6.37293 5.96883
    6.16445 5.77021  6.31242 6.05267  6.44414 6.15806
    6.53678 6.13404 . . . . . . . .
run;

These data have been analyzed in Durbin and Koopman (2012, chap. 8, sec. 3). The analysis presented here is similar. To simplify the illustration, the monthly data have been converted to quarterly data and two predictors (the number of kilometers traveled and the real price of petrol) are excluded from the analysis. You can also use PROC CSSM to carry out the more elaborate analysis in Durbin and Koopman (2012).

One of the original reasons for studying these data was to assess the effect on f_KSI of the enactment of a seat-belt law in February 1983 that compelled the front seat passengers to wear seat belts. A simple graphical inspection of the data (not shown here) reveals that f_KSI and r_KSI do not show a pronounced upward or downward trend but do show seasonal variation, and that these two series seem to move together. Additional inspection also shows that the seasonal effect is relatively stable throughout the data span. These considerations suggest the following model for bold y = (f_KSI, r_KSI):

bold y Subscript t Baseline equals StartBinomialOrMatrix upper X Subscript t Baseline Choose 0 EndBinomialOrMatrix beta plus mu mu Subscript t Baseline plus zeta zeta Subscript t Baseline plus xi xi Subscript t

All the terms on the right-hand side of this equation are assumed to be statistically independent. These terms are as follows:

  • The predictor upper X Subscript t (defined as Q1_83_Shift later in the program) denotes a variable that is 0 before the first quarter of 1983, and 1 thereafter. upper X Subscript t is supposed to affect only f_KSI (the first element of bold y); it represents the enactment of the seat-belt law of 1983.

  • mu mu Subscript t denotes a bivariate random walk. It is supposed to capture the slowly changing level of the vector bold y Subscript t. To capture the fact that f_KSI and r_KSI move together (that is, they are co-integrated), the covariance of the disturbance term of this random walk is assumed to be of lower than full rank.

  • zeta zeta Subscript t denotes a bivariate trigonometric seasonal term. In this model, it is taken to be fixed (that is, the seasonal effects do not change over time).

  • xi xi Subscript t denotes a bivariate white noise term, which captures the residual variation that is unexplained by the other terms in the model.

The preceding model is an example of a (bivariate) basic structural model (BSM). The following statements load the seatBelt data into the table mylib.seatBelt:

data mylib.seatBelt;
  set seatBelt;
run;

The following statements specify and fit this model to f_KSI and r_KSI:

 proc cssm data=mylib.seatBelt stateinfo;
    id date interval=quarter;
    Q1_83_Shift = (date >= '1jan1983'd);
    state error(2) type=WN cov(g) print=cov;
    component wn1 = error[1];
    component wn2 = error[2];
    state level(2) type=RW cov(rank=1)  print=cov;
    component rw1 = level[1];
    component rw2 = level[2];
    state season(2) type=season(length=4);
    component s1 = season[1];
    component s2 = season[2];
    model f_KSI = Q1_83_Shift rw1 s1  wn1 / print=(smooth);
    model r_KSI = rw2 s2 wn2;
    eval f_KSI_sa = rw1 + Q1_83_Shift;
    output out=mylib.For1;
 run;

The PROC CSSM statement specifies the input table, mylib.seatBelt. The use of the STATEINFO option in the PROC CSSM statement produces additional information about the model state vector and its diffuse initial state. The optional ID statement specifies an index variable, date. The INTERVAL=QUARTER option in the ID statement indicates that the measurements were collected on a quarterly basis. Next, a programming statement defines Q1_83_Shift, the predictor that represents the enactment of the seat-belt law of 1983. It is used later in the MODEL statement for f_KSI. Separate STATE statements specify the terms mu mu Subscript t, zeta zeta Subscript t, and xi xi Subscript t because they are statistically independent. Each model that governs them (white noise for xi xi Subscript t, random walk for mu mu Subscript t, and trigonometric seasonal for zeta zeta Subscript t) can be specified by using the TYPE= option of the STATE statement. When you use the TYPE= option, you can use the COV option to specify the information about the disturbance covariance in the state transition equation. The other details, such as the transition matrix specification and the specification of bold upper A 1 in the initial condition, are inferred from the TYPE= option. The use of PRINT=COV in the STATE statement causes the estimated disturbance covariance to be printed. For xi xi Subscript t (a white noise), bold upper A 1 is zero and bold upper Q Subscript t Baseline equals bold upper Q for all t greater-than-or-equal-to 1, where bold upper Q is specified by the COV option. For mu mu Subscript t and zeta zeta Subscript t the initial condition is fully diffuse—that is, bold upper A 1 is an identity matrix of appropriate order and bold upper Q 1 equals 0. The total diffuse dimension of this model, left-parenthesis d plus k right-parenthesis, is 9 equals 8 plus 1 as a result of one predictor, Q1_83_Shift, and two fully diffuse state subsections, mu mu Subscript t and zeta zeta Subscript t. The components in the model are defined by suitable linear combinations of these different state subsections. The program statements define the model as follows:

  • state error(2) type=WN cov(g); defines xi xi Subscript t as a two-dimensional white noise, named error, with the covariance of general form. Then two COMPONENT statements define wn1 and wn2 as the first and second elements of error, respectively.

  • state level(2) type=RW cov(rank=1); defines mu mu Subscript t as a two-dimensional random walk, named level, with covariance of general form whose rank is restricted to 1. Then two COMPONENT statements define rw1 and rw2 as the first and second elements of level, respectively.

  • state season(2) type=season(length=4); defines zeta zeta Subscript t as a two-dimensional trigonometric seasonal of season length 4, named season, with zero covariance—signified by the absence of the COV option. Then two COMPONENT statements define s1 and s2 as appropriate linear combinations of season so that s1 represents the seasonal for f_KSI and s2 represents the seasonal for r_KSI. Because TYPE=SEASON in the STATE statement, the COMPONENT statement appropriately interprets component s1 = season[1]; as s1 being a dot product: left-parenthesis 1 0 0 0 1 0 right-parenthesis asterisk normal s normal e normal a normal s normal o normal n. For more information, see the section Multivariate Season.

  • model f_KSI = Q1_83_Shift rw1 s1 wn1; defines the model for f_KSI, and model r_KSI = rw2 s2 wn2; defines the model for r_KSI.

The CSSM procedure fits the model and reports the parameter estimates, their approximate standard errors, and the likelihood-based goodness-of-fit measures by default. In order to output the one-step-ahead and full-sample estimates of the components in the model, you can either use the PRINT= options in the MODEL statement and the respective COMPONENT statements or you can specify an output data set in the OUTPUT statement. In addition, you can use the EVAL statement to define specific linear combinations of the underlying state that should also be estimated. The statement eval f_KSI_sa = rw1 + Q1_83_Shift; is an example of one such linear combination. It defines f_KSI_sa, a linear combination that represents the seasonal adjustment of f_KSI. The output data set, mylib.For1 (named in the OUTPUT statement) contains estimates of all the model components in addition to the estimate of f_KSI_sa.

The model summary table, shown in Output 14.1.1, provides basic model information, such as the dimension of the underlying state equation (m equals 10), the diffuse dimension of the model (left-parenthesis d plus k right-parenthesis equals 9), and the number of parameters (5) in the model parameter vector theta theta.

Output 14.1.1: Bivariate Basic Structural Model

Model Summary
Number of Model Equations2
State Dimension10
Dimension of the Diffuse Initial Condition9
Number of Parameters5


Additional details about the role of different components in forming the model state and its diffuse initial condition are shown in Output 14.1.2 and Output 14.1.3. They show that the 10-dimensional model state vector is made up of subsections that are associated with error and level (each of dimension 2) and season (of dimension 6). Similarly, the nine-dimensional diffuse vector in the initial condition is made up of subsections that correspond to level, season, and the regression variable, Q1_83_Shift. Note that error does not contribute to the diffuse initial vector because it has a fully nondiffuse initial state.

Output 14.1.2: Bivariate Basic Structural Model State Vector Summary

State Vector Composition
SubsectionDimension
error2
level2
season6


Output 14.1.3: Bivariate Basic Structural Model Initial Diffuse State Vector Summary

Diffuse Initial State Composition
SubsectionDimension
level2
season6
Q1_83_Shift1


The index variable information is shown in Output 14.1.4.

Output 14.1.4: Index Variable Information

ID Variable Information
NameStartEndMaximum
Delta
Distinct
Values
Type
date1969/11985/41.000068Regular


Output 14.1.5 provides simple summary information about the response variables. It shows that f_KSI and r_KSI have four missing values each and no induced missing values because the predictor in the model, Q1_83_Shift, has no missing values.

Output 14.1.5: Response Variable Summary

Response Variable Information
NameNumber of ObservationsMinimumMaximumMeanStandard
Deviation
TotalMissingInduced
Missing
f_KSI68406.1647.0936.7070.2062
r_KSI68405.5566.4055.9730.1862


The regression coefficient of Q1_83_Shift, shown in Output 14.1.6, is negative and is statistically significant. This is consistent with the expected drop in f_KSI after the enactment of the seat-belt law.

Output 14.1.6: Regression Coefficient of Q1_83_Shift

Regression Parameter Estimates
ResponseRegressorEstimateStandard
Error
t ValuePr > |t|
f_KSIQ1_83_Shift-0.40840.0259-15.74<.0001


Output 14.1.7 shows the estimates of the elements of theta theta. The five parameters in theta theta correspond to unknown elements that are associated with the covariance matrices in the specifications of error and level. Whenever a covariance specification is of a general form and is not defined by a user-specified variable list, it is internally parameterized as a product of its Cholesky root: normal upper C normal o normal v equals normal upper R normal o normal o normal t normal upper R normal o normal o normal t Superscript prime. This ensures that the resulting covariance is positive semidefinite. The Cholesky root is constrained to be lower triangular, with positive diagonal elements. If rank constraints (such as the rank-one constraint on the covariance in the specification of level) are imposed, the number of free parameters in the Cholesky factor is reduced appropriately. For more information, see the section Covariance Parameterization. In view of these considerations, the five parameters in theta theta are a result of three parameters from the Cholesky root of error and two parameters that are associated with the Cholesky root of level.

Output 14.1.7: Parameter Estimates

Model Parameter Estimates
ComponentTypeParameterEstimateStandard
Error
t Value
errorDisturbance CovarianceRootCov[1, 1]0.03610.00744.91
errorDisturbance CovarianceRootCov[2, 1]0.03380.01132.99
errorDisturbance CovarianceRootCov[2, 2]0.04620.00479.84
levelDisturbance CovarianceRootCov[1, 1]0.03750.00844.45
levelDisturbance CovarianceRootCov[2, 1]0.02230.00573.92


Output 14.1.8 shows the resulting covariance estimate of error after multiplying the Cholesky factors.

Output 14.1.8: White Noise Covariance Estimate

Disturbance Covariance for
error
 Col1Col2
Row10.001310.00122
Row20.001220.00328


Similarly, Output 14.1.9 shows the covariance estimate of level disturbance. Note that because of the rank-one constraint, the determinant of this matrix is 0.

Output 14.1.9: Covariance Estimate of the Random Walk Disturbance

Disturbance Covariance for
level
 Col1Col2
Row10.001410.000837
Row20.0008370.000497


Output 14.1.10 shows the likelihood computation summary. This table is produced by using the fitted model to carry out the filtering operation on the data. For more information, see the section Likelihood Computation and Model-Fitting Phase.

Output 14.1.10: Likelihood Computation Summary of the Fitted Model

Likelihood Computation Summary
Nonmissing Response Values Used128
Estimated Parameters5
Initialized Diffuse State Elements9
Normalized Residual Sum of Squares119.0000
Diffuse Log Likelihood166.1575
Profile Log Likelihood199.9116


The output data set, mylib.For1, specified in the OUTPUT statement contains one-step-ahead and full-sample estimates of all the model components and the user-specified components (defined by the EVAL statement). Their standard errors and the upper and lower confidence limits (by default, 95%) are also produced.

The following statements use the mylib.For1 data set to produce a time series plot of the seasonally adjusted f_KSI:

 proc sgplot data=mylib.For1;
    title "Seasonally Adjusted f_KSI with 95% Confidence Band";
    band x=date lower=smoothed_lower_f_KSI_sa
       upper=smoothed_upper_f_KSI_sa ;
    series x=date y=smoothed_f_KSI_sa;
    refline '1jan1985'd / axis=x lineattrs=(pattern=shortdash)
       LEGENDLABEL= "Start of Multistep Forecasts"
       name="Forecast Reference Line";
    scatter x=date y=f_KSI ;
 run;

The generated plot is shown in Output 14.1.11.

Output 14.1.11: Plot of Seasonally Adjusted f_KSI

Plot of Seasonally Adjusted


Last updated: July 09, 2026