Time Series Analysis Package
INTERMITTENCYTEST Method
rc = TSA.INTERMITTENCYTEST (y, <base>, <threshold>, <med>);
The INTERMITTENCYTEST function tests for intermittency of a univariate time series by computing the median of the length of contiguous constant periods (demand intervals).
Required Arguments
You must specify the following arguments, separated by commas:
- y
specifies the times series array to test. The test is applied to the last 100 values.
Optional Arguments
You can also specify the following arguments, separated by commas. If you want to use a default value for any of these arguments, enter a space for it.
- base
-
takes a numeric Value that specifies the base demand level. If you specify a missing value, the dependent series is analyzed to determine whether the base demand level can be set to one of the following values:
0
the minimum value of the dependent series
the maximum value of the dependent series
the median value of the dependent series
First, the analysis determines whether the series is nearly constant by applying a threshold to the maximum (
) norm of the nonmissing observations of the series. For nearly constant series, the base demand level is set to 0. Otherwise, analysis proceeds to compute the minimum, maximum, and median values of the series and assigns a score to each of those values. The score of a value in this context is the number of observations that are sufficiently close to that value. If the number of missing values in the dependent series is higher than the scores for the minimum, maximum, and median, then the base demand level is set to 0. If scores for the minimum, maximum, and median are identical, then the base demand level is set to 0. Otherwise, the base demand level is set to the value that has the highest score among the minimum, maximum, and median.
- threshold
specifies the threshold value for intermittency. A value of 1 forces all series to be identified as intermittent, whereas a value of
.I(positive infinity) forces all series to be identified as nonintermittent. The default value is 2.
Returned Values
The INTERMITTENCYTEST function returns the following values:
- rc
-
returns one of the following scalar return codes:
rc Termination Reason 0 Time series is not intermittent 1 Time series is intermittent < 0 Computational failure
Optional Returned Values
You can also specify the following arguments, separated by commas, to request additional returned values. If you do not want the value to be returned, enter a space for it.
- med
returns the median length of the contiguous constant periods.
Example
This example uses the TSMODEL procedure to test the intermittency on the time series array Air:
proc tsmodel data=mylib.air outscalar=mylib.outscalars;
id date interval=month;
var air;
outscalars intermittent;
require tsa;
submit;
declare object TSA(tsa);
intermittent=0;
rc=TSA.INTERMITTENCYTEST(air, 0, 2, med);
if rc>0 then intermittent= 1;
endsubmit;
run;