Proc Statespace is useful for automatic modeling and forecasting of several interrelated multiple time series with or without a feedback relationship, also called Kalman filtering.
Proc statespace performs the following steps in its analysis of multivariate time series data:
1 It fits a sequence of multivariate auto-regressive models for lags 0 to 10. For each model, AIC is calculated. The minimum AIC value is used to determine the order of auto-regressive model used in further analysis.
2 It tries to improve the fit of the selected AR model by adding moving averages(MA) terms and removing some of the AR terms. The best-fitting revised model is assessed by means of another of AIC.
3 It estimates the parameters of the final model, using the estimated co-variance matrix and a maximum likelihood estimation method..
Note that Proc staespace provides valid analysis only for stationary series. If the data are not stationary, need to make the data stationary before use proc statespace.
proc sql;
create table failure_grp4 as
select
year(repair_visit_dt) as failure_year,
month(repair_visit_dt)as failure_month,
mdy(month(min(repair_visit_dt)),1,year(min(repair_visit_dt))) as failure,
count(*) as total_claim_cnt,
sum(repair_gross_amt)/count(*) as severity
from claim_grp4
group by 1,2
order by 1,2;
quit;
proc statespace data=failure_grp4 cancorr out=predict_severity lead=74 interval=month;
id failure;
var severity total_claim_cnt;
run;
Option cancorr prints the sequence of canonical correlations during model selection.
Output from proc statespace includes AIC for the sequence of auto-regressive models, a schematic representation of the auto-correlation matrices, an schematic representation of t the partial auto-regression matrices, Yule-Walker estimates for the minimum AIC, and a canonical correlations analysis for each state vector (obtained with the cancorr option).
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=1 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. FOR1 dollar.;
plot severity*failure FOR1*failure/ overlay
caxis = BLACK
ctext = BLACK
vaxis = axis1
haxis = axis2
legend= legend1
grid
hminor=0
;
run;
quit;
1 It fits a sequence of multivariate auto-regressive models for lags 0 to 10. For each model, AIC is calculated. The minimum AIC value is used to determine the order of auto-regressive model used in further analysis.
2 It tries to improve the fit of the selected AR model by adding moving averages(MA) terms and removing some of the AR terms. The best-fitting revised model is assessed by means of another of AIC.
3 It estimates the parameters of the final model, using the estimated co-variance matrix and a maximum likelihood estimation method..
Note that Proc staespace provides valid analysis only for stationary series. If the data are not stationary, need to make the data stationary before use proc statespace.
proc sql;
create table failure_grp4 as
select
year(repair_visit_dt) as failure_year,
month(repair_visit_dt)as failure_month,
mdy(month(min(repair_visit_dt)),1,year(min(repair_visit_dt))) as failure,
count(*) as total_claim_cnt,
sum(repair_gross_amt)/count(*) as severity
from claim_grp4
group by 1,2
order by 1,2;
quit;
proc statespace data=failure_grp4 cancorr out=predict_severity lead=74 interval=month;
id failure;
var severity total_claim_cnt;
run;
Option cancorr prints the sequence of canonical correlations during model selection.
Output from proc statespace includes AIC for the sequence of auto-regressive models, a schematic representation of the auto-correlation matrices, an schematic representation of t the partial auto-regression matrices, Yule-Walker estimates for the minimum AIC, and a canonical correlations analysis for each state vector (obtained with the cancorr option).
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=1 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. FOR1 dollar.;
plot severity*failure FOR1*failure/ overlay
caxis = BLACK
ctext = BLACK
vaxis = axis1
haxis = axis2
legend= legend1
grid
hminor=0
;
run;
quit;
No comments:
Post a Comment