Time Series Analysis Package

ACF Method

  • rc = TSA.ACF (y, nlag, <lags>, <df>, <mu>, <acov>, <acf>, <acfstd>, <acf2std>, <acfnorm>, <acfprob> <acflprob>);

The ACF function computes autocorrelation and autocovariance for a time series array.

Required Arguments

You must specify the following arguments, separated by a comma:

y

specifies the times series array.

nlag

specifies the number of the lag to use in the calculation.

Returned Values

The ACF 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

returns the numbers of the lags that were used in the calculation.

df

returns the number of observations used to compute acov and acf.

mu

returns the mean estimate.

acov

returns an array of covariance estimates, with nlag + 1 entries.

acf

returns an array of autocorrelation estimates, with nlag + 1 entries.

acfstd

returns an array of standard errors, with nlag + 1 entries.

acf2std

returns an array of twice standard errors, with nlag + 1 entries.

acfnorm

returns an array of normalized autocorrelation, with nlag + 1 entries.

acfprob

returns an array of autocorrelation probabilities, with nlag + 1 entries.

acflprob

returns an array of autocorrelation log probabilities, with nlag + 1 entries.

Example

This example uses the TSMODEL procedure to compute the autocorrelation of lag 3 of the time series Air:

proc tsmodel data=mylib.air outscalar=mylib.outscalars
              outarray=mylib.outarray;
   id date interval=month;
   var air;
   outscalars mu;
   outarrays acf acov lags df acfstd;
   require tsa;
   submit;
   declare object TSA(tsa);
   rc=TSA.ACF(air, 3, lags, df, mu, acov, acf, acfstd, , , , );
   endsubmit;
run;
Last updated: July 09, 2026