Spectral analysis is a statistical approach to detecting regular cyclical patterns, or periodicities, in time series data. It can be used to compute periodogram ordinates, plot periodogram ordinates and test the white noise hypothesis.
It can perform the following tasks:
1 Produce periodogram ordinates, calculate spectral density estimates, and plot periokogrames and spectral density estimates.
Spectral analysis is a statistical approach to detecting regular cyclical patterns, or periodicities, in transformed time series data.
1.1 transform the data with a finite Fourier transform, which decomposes the data into a sum of sine and cosine waves. These sine and cosine components can be of varying wavelengths and amplitudes.
1.2 regress time series on the sine and cosine components for varying frequencies.
1.3 calculate the sums of squares for each regression model.
1.4 use the significant sinusoidal components detected by this technique to model the original series.
The periodogram plots the sums of squares from each regression model against the frequencies. You can interpret the ordinates of the periodogram as the amount of variation in Y at each frequency. The regression sums of squares for each model are proportional to the sum of the square sine and cosine coefficients for each model.
The periodogram is an estimate of a theoretical quntity called a spectrum. Because periodograms are rough estimates of true spectra, it is often to use weights to smooth the periodogram. The weighted moving averages of periodogram ordinates are called spectral density estimates.
proc spectra data=failure_grp out=speclead p s adjmean;
var severity;
weights 1 2 3 4;
run;
axis1 width=1 offset=(1 pct) label=(a=90 r=0 'Spectral Density');
axis2 width=1 offset=(1 pct) label=('Period') 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=('') across=2 mode=protect position=(top center inside);
title 'Severity Prediction';
proc gplot data=speclead;
plot s_01*freq/
caxis = BLACK
ctext = BLACK
vaxis = axis1
haxis = axis2
legend= legend1
grid
hminor=0
;
run;
quit;
2 Test the white-noise hypothesis.
Proc Spectra is to test the null hypothesis that a time series is white noise. It provides two test for white noise.
2.1 Fisher-Kappa test is the ratio of the largest periodogram ordinate tot the average of all the ordinates. This test is designed to detect one sinusoidal component buried in white noise. The large first ordinate is excluded from this analysis.
2.2 Bartlett Kolmogorov Smirnov test devides the sum of periodogram ordinates, for each frequency, by the the sum of all periodogram ordinates. It is more power than Fisher-Kappa test to detect departures fromt he white noise hypothesis over the whole range of frequncies.
proc statespace data=failure_grp3 cancorr out=predict_severity lead=74 interval=month;
id failure;
var severity total_claim_cnt;
run;
proc spectra data=predict_severity adjmean whitetest out=resid ;
var res1;
run;
axis1 width=1 offset=(1 pct) label=(a=90 r=0 'Severity');
axis2 width=1 offset=(1 pct) label=('Resid') value=(h=1.25);
symbol1 v=star ci=red height=1 cells interpol=join l=1 w=2;
title 'Periodogram';
proc gplot data=resid;
where (int(period) not in (3,12) ) and period<=20;
plot p_01*period/ overlay
caxis = BLACK
ctext = BLACK
vaxis = axis1
haxis = axis2
legend= legend1
grid
hminor=0
;
run;
quit;
No comments:
Post a Comment