Time Series Analysis Package
CCF Method
rc = TSA.CCF (y, x, nlag, <lags>, <df>, <ymu> , <xmu>, <ccov>, <ccf>, <ccfstd>, <ccf2std>, <ccfnorm>, <ccfprob>, <ccflprob>, <adjscale>);
The CCF function computes the cross-correlation and cross-covariance for two time series arrays.
Required Arguments
You must specify the following arguments, separated by commas:
- y
specifies one times series array.
- x
specifies the other time series array.
- nlag
specifies the number of the lag to compute.
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.
- adjscale
-
specifies adjscale, which controls the normalization of the cross-covariance and cross-correlation. You can specify the following numeric values:
- 0
specifies the default normalization.
- 1
specifies the unbiased normalization.
- 2
specifies the biased normalization.
For more information, see Table 6.
Returned Values
The CCF function returns the following values:
- rc
-
returns one of the following scalar return codes:
rc Termination Reason 0 Success < 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.
- lags
- df
returns an array of number of products for which to compute the cross-correlation, with
entries.
- ymu
returns the mean estimate of input time series y.
- xmu
returns the mean estimate of input time series x.
- ccov
returns an array of cross-covariance estimates, with
entries.
- ccf
returns an array of cross-correlation estimates, with
entries.
- ccfstd
- ccf2std
- ccfnorm
returns an array of normalized cross-correlation, with
entries.
- ccfprob
- ccflprob
Example
This example uses the TSMODEL procedure to compute the cross-correlation and cross-covariance of two time series arrays (Price and Sale) with lag 20:
data mylib.pricedata (replace=yes);
set Sashelp.pricedata;
run;
proc tsmodel data=mylib.pricedata outarray=mylib.ccf_array
outscalar=mylib.ccf_scalar;
id date interval=month;
var price sale;
by region line product;
outscalars ymu xmu;
outarrays lags df ccov ccf ccfstd ccf2std ccfnorm ccfprob ccflprob;
require tsa;
submit;
declare object TSA(tsa);
rc=TSA.CCF(price, sale, 20, lags, df, ymu, xmu, ccov, ccf,
ccfstd, ccf2std, ccfnorm, ccfprob, ccflprob);
endsubmit;
run;