Wednesday, November 9, 2011

Proc UCM

Proc UCM used structure models to analyzes and forecasts the response series by decomposing into components such as trend, seasonal, cycles, and the regression effects due to predictor series.

ods graphics on;
proc ucm data=predict_series;
id failure interval=month;
model severity;
irregular;
level variance=0 noest;
slope variance=0 noest;
season length=12 type=trig;
cycle plot=smooth;
estimate back=1 plot=(residual normal acf);
forecast back=1 lead=72 outfor=predict_severity;
run;
ods graphics off;

ID option is used to specify a date variable.
Model option specify the response series.
Irregular option is specified using error term.
Trend is specified by the level and slope statements. If the variance are set to zero to create a model with a fixed linear trend. A noest option is included to fix the values of the model parameters.
Season statement is used to specify the seasonality, e.g., 12 for monthly seasonality and is of the tri-genometric type.
In cycle statement, plot= option used to plot the smoothed estimate of the cycle component.
The estimate statement can be used to specify the span of data used in parameter estimation. back= option is to specify a hold out sample, which are omitted from the estimation.
The forecast statement requests the printing of the smoothed trend plus seasonal component. back=12 option is to begin the multi-step forecast 12 observations back form the end of the historical data.

*Plot the forecast series with confidence interval;
axis1 width=1 offset=(1 pct) label=(a=90 r=0 'Severity');
axis2 width=1 offset=(1 pct) label=('Failure Date') value=(h=1.25);
symbol1 v=star ci=red height=1 cells interpol=join l=1 w=2;
symbol2 v=dot ci=green height=1 cells interpol=join l=2 w=2;
symbol3 v=dot ci=blue height=1 cells interpol=join l=2 w=2;
symbol4 v=dot ci=blue height=1 cells interpol=join l=2 w=2;
legend1 label=('') value=('Actual Claim Severity' 'Predicted Claim Severity') across=2 mode=protect position=(top center inside);
title 'Severity Prediction';
proc gplot data=predict_severity;
format failure monyy. severity dollar.;
plot severity*failure forecast*failure LCL*failure UCL*failure/ overlay
caxis = BLACK
ctext = BLACK
vaxis = axis1
haxis = axis2
legend= legend1
grid
hminor=0
;
run;
quit

No comments:

Post a Comment

Blog Archive