Proc Forecast procedure is based on extrapolation of data and the forecast for a series is solely a function of the time and the past values of the series. It is a one-step method to automatically generate forecasts for hurndres of series at a time.
A time series plot is able to visually identify the presence of three possible components: level, trend, and seasonality.
First, the plot may be flat, showing only random fluctuation about some constant level.
Second, the plot may show an upward (or downward) trend over time.
Third, the plot may show some obvious seasonality.
trend= option specifies the effects of different values.:
trend=1 specifies single exponential smoothing (a constant model).
trend=2 specifies double exponential smoothing (a linear trend model).
trend=3 specifies triple exponential smoothing (a quadratic trend model).
There are three main exponential smoothing methods:
First, single exponential for level component.
Second, double exponential for trend component.
Third, stepar/winters/addwinters for seasonal component.
method=expo forecasts based on an exponential smoothing model.In fitting the trend, the parameters are allowed to change gradually over time, and earlier observations are given exponentially declining weights. It works for long-term, deterministic change.
method=stepar forecasts based on a stepwise autoregressive model. It combines time trend regression with an autoregressive model and used a stepwise method to select the lags to use for the autoregressive process. It works for short-term fluctuation.
method=winters forecasts based on a multiplicative seasonal exponential smoothing model.It combines a time trend with multiplicative seasonal factors to account for regular seasonal fluctuations in a series. It works for regular seasonal fluctuations.
method=addwinters forecasts based on an additive seasonal exponential smoothing model. It combines a time trend with additive seasonal factors to account for regular seasonal fluctuations in a series. It works for regular seasonal fluctuations.
If unspecified, the weight defaults to 1-.8^(1/trend), where trend is the value of the Trend=option.
weight=.2 for trend=1.
weight=.10557 for trend=2.
weight=.07168 for trend=3.
Single exponential smoothing and arima(0,1,1) are parallel when the moving average parameter set to smoothing constant. Because the smoothed values of St and St-1 are forecasts of Yt+1 and Yt respectively.
Double exponential smoothing and arima(0,2,2) are parallel. Proc arima constructs forecasts with the estimation suppressed and used the MA=option equals to 1-weight, 0.89442719099991 for default, in proc forecast if trend=2.
Triple exponential smoothing and arima(0,3,3) are also parallel.
proc forecast data=predicted_series interval=month method=expo trend=2 lead=70 out=predict_severity1 outfull outest=est;
id failure_date;
var severity;
run;
data severity1;
set predict_severity1;
if _type_='FORECAST';
pred1= severity;
run;
proc sort data=severity1;
by failure_date;
run;
*replicate the first observation;
data predicted_series2;
set predicted_series ;
if _n_=1 then do;
failure_date=intnx('month', failure_date,-1);
output;
failure_date=intnx('month', failure_date,1);
end;
output;
run;
*1-weight for MA;
proc arima data=predicted_series2 ;
identify var=severity(1,1) noprint;
estimate q=(1) (1) noconstant noest
ma=0.89442719099991 0.89442719099991;
forecast lead=60 interval=month id=failure_date out=predict_severity2 noprint;
run;
data severity2 ;
set predict_severity2 ;
pred2=forecast;
obs=severity;
keep failure_date pred2 obs;
run;
proc sort data=predict_severity2;
by failure_date;
run;
data mergedata;
merge severity1 severity2;
by failure_date;
run;
proc compare data=mergedata MAXPRINT=200;
var pred1;
with pred2;
id failure_date;
run;
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=dot 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;
legend1 label=('') across=3 mode=protect position=(top center inside);
title 'Severity Prediction';
proc gplot data=mergedata;
format failure_date monyy. ;
plot (pred1 pred2 obs)*failure_date/ overlay
caxis = BLACK
ctext = BLACK
vaxis = axis1
haxis = axis2
legend= legend1
grid
hminor=0
;
run;
quit;
No comments:
Post a Comment