Acf and Pacf Syntax

7
Example (ACF command) ACF VARIABLES = TICKETS /LN /DIFF=1 /SDIFF=1 /PER=12 /MXAUTO=50. This example produces a plot of the autocorrelation function for the series TICKETS after a natural log transformation, differencing, and seasonal differencing have been applied. Along with the plot, the autocorrelation value, standard error, Box-Ljung statistic, and probability are displayed for each lag. LN transforms the data using the natural logarithm (base e) of the series. DIFF differences the series once. SDIFF and PERIOD apply one degree of seasonal differencing with a period of 12. MXAUTO specifies that the maximum number of lags for which output is to be produced is 50. SEASONAL Subcommand (ACF command ) Use the SEASONAL subcommand to focus attention on the seasonal component by displaying and plotting autocorrelations at periodic lags only. There are no additional specifications on SEASONAL. If SEASONAL is specified, values are displayed and plotted at the periodic lags indicated on the PERIOD subcommand. If PERIOD is not specified, the periodicity established on the TSET or DATE command is used (see the PERIOD subcommand). If SEASONAL is not specified, autocorrelations for all lags up to the maximum are displayed and plotted. Example ACF VARIABLES = SALES

description

Acf and Pacf Syntax

Transcript of Acf and Pacf Syntax

Page 1: Acf and Pacf Syntax

Example (ACF command)

ACF VARIABLES = TICKETS

/LN

/DIFF=1

/SDIFF=1

/PER=12

/MXAUTO=50.

• This example produces a plot of the autocorrelation function for the series TICKETS after a natural log transformation, differencing, and seasonal differencing have been applied. Along with the plot, the autocorrelation value, standard error, Box-Ljung statistic, and probability are displayed for each lag.

• LN transforms the data using the natural logarithm (base e) of the series.

• DIFF differences the series once.

• SDIFF and PERIOD apply one degree of seasonal differencing with a period of 12.

• MXAUTO specifies that the maximum number of lags for which output is to be produced is 50.

SEASONAL Subcommand (ACF command)

Use the SEASONAL subcommand to focus attention on the seasonal component by displaying and plotting autocorrelations at periodic lags only.

• There are no additional specifications on SEASONAL.

• If SEASONAL is specified, values are displayed and plotted at the periodic lags indicated on the PERIOD subcommand. If PERIOD is not specified, the periodicity established on the TSET or DATE command is used (see the PERIOD subcommand).

• If SEASONAL is not specified, autocorrelations for all lags up to the maximum are displayed and plotted.

Example

ACF VARIABLES = SALES

/SEASONAL

/PERIOD=12.

• In this example, autocorrelations are displayed only at every 12th lag

DIFF Subcommand (ACF command)

DIFF specifies the degree of differencing used to convert a nonstationary series to a stationary one with a constant mean and variance before the autocorrelations are computed.

Page 2: Acf and Pacf Syntax

• You can specify 0 or any positive integer on DIFF.

• If DIFF is specified without a value, the default is 1.

• The number of values used in the calculations decreases by 1 for each degree−1 of differencing.

Example

ACF VARIABLES = SALES

/DIFF=1.

• In this example, the series SALES will be differenced once before the autocorrelations are computed and plotted

SDIFF Subcommand (ACF command)

If the series exhibits a seasonal or periodic pattern, you can use the SDIFF subcommand to seasonally difference the series before obtaining autocorrelations.

• The specification on SDIFF indicates the degree of seasonal differencing and can be 0 or any positive integer.

• If SDIFF is specified without a value, the degree of seasonal differencing defaults to 1.

• The number of seasons used in the calculations decreases by 1 for each degree of seasonal differencing.

• The length of the period used by SDIFF is specified on the PERIOD subcommand. If the PERIOD subcommand is not specified, the periodicity established on the TSET or DATE command is used (see the PERIOD subcommand).

PERIOD Subcommand (ACF command)

PERIOD indicates the length of the period to be used by the SDIFF or SEASONAL subcommands.

• The specification on PERIOD indicates how many observations are in one period or season and can be any positive integer greater than 1.

• The PERIOD subcommand is ignored if it is used without the SDIFF or SEASONAL subcommands.

• If PERIOD is not specified, the periodicity established on TSET PERIOD is in effect. If TSET PERIOD is not specified, the periodicity established on the DATE command is used. If periodicity was not established anywhere, the SDIFF and SEASONAL subcommands will not be executed.

Example

ACF VARIABLES = SALES

/SDIFF=1M

/PERIOD=12.

• This command applies one degree of seasonal differencing with a periodicity (season) of 12 to the series SALES before autocorrelations are computed.

Page 3: Acf and Pacf Syntax

LN and NOLOG Subcommands (ACF command)

LN transforms the data using the natural logarithm (base e) of the series and is used to remove varying amplitude over time. NOLOG indicates that the data should not be log transformed. NOLOG is the default.

• If you specify LN on an ACF command, any differencing requested on that command will be done on the log-transformed series.

• There are no additional specifications on LN or NOLOG.

• Only the last LN or NOLOG subcommand on an ACF command is executed.

• If a natural log transformation is requested when there are values in the series that are less than or equal to zero, the ACF will not be produced for that series because nonpositive values cannot be log transformed.

• NOLOG is generally used with an APPLY subcommand to turn off a previous LN specification.

Example

ACF VARIABLES = SALES

/LN.

• This command transforms the series SALES using the natural log transformation and then computes and plots autocorrelations.

SEASONAL Subcommand (ACF command)

Use the SEASONAL subcommand to focus attention on the seasonal component by displaying and plotting autocorrelations at periodic lags only.

• There are no additional specifications on SEASONAL.

• If SEASONAL is specified, values are displayed and plotted at the periodic lags indicated on the PERIOD subcommand. If PERIOD is not specified, the periodicity established on the TSET or DATE command is used (see the PERIOD subcommand).

• If SEASONAL is not specified, autocorrelations for all lags up to the maximum are displayed and plotted.

Example

ACF VARIABLES = SALES

/SEASONAL

/PERIOD=12.

• In this example, autocorrelations are displayed only at every 12th lag.

Page 4: Acf and Pacf Syntax

MXAUTO Subcommand (ACF command)

MXAUTO specifies the maximum number of lags for a series.

• The specification on MXAUTO must be a positive integer.

• If MXAUTO is not specified, the default number of lags is the value set on TSET MXAUTO. If TSET MXAUTO is not specified, the default is 16.

• The value on MXAUTO overrides the value set on TSET MXAUTO.

Example

ACF VARIABLES = SALES

/MXAUTO=14.

• This command sets the maximum number of autocorrelations to be displayed for the series SALES to 14.

SERROR Subcommand (ACF command)

SERROR specifies the method of calculating the standard errors for the autocorrelations.

• You must specify either the keyword IND or MA on SERROR.

• The method specified on SERROR overrides the method specified on the TSET ACFSE command.

• If SERROR is not specified, the method indicated on TSET ACFSE is used. If TSET ACFSE is not specified, the default is IND.

IND Independence model. The method of calculating the standard errors assumes that the underlying process is white noise.

MA MA model. The method of calculating the standard errors is based on Bartlett’s approximation. With this method, appropriate where the true MA order of the process is k–1, standard errors grow at increased lags (Pankratz, 1983).

Example

ACF VARIABLES = SALES

/SERROR=MA.

• In this example, the standard errors of the autocorrelations are computed using the MA method.

Page 5: Acf and Pacf Syntax

PACF Subcommand (ACF command)

Use the PACF subcommand to display and plot sample partial autocorrelations as well as autocorrelations for each series named on the ACF command.

• There are no additional specifications on PACF.

• PACF also displays the standard errors of the partial autocorrelations and indicates the bounds of two standard errors on the plot.

• With the exception of SERROR, all other subcommands specified on that ACF command apply to both the partial autocorrelations and the autocorrelations.

Example

ACF VARIABLES = SALES

/DIFFERENCE=1

/PACF.

• This command requests both autocorrelations and partial autocorrelations for the series SALES after it has been differenced once.

APPLY Subcommand (ACF command)

APPLY allows you to use a previously defined ACF model without having to repeat the specifications.

• The only specification on APPLY is the name of a previous model in quotation marks. If a model name is not specified, the model specified on the previous ACF command is used.

• To change one or more model specifications, specify the subcommands of only those portions you want to change after the APPLY subcommand.

• If no series are specified on the ACF command, the series that were originally specified with the model being reapplied are used.

• To change the series used with the model, enter new series names before or after the APPLY subcommand.

Example

ACF VARIABLES = TICKETS

/LN

/DIFF=1

/SDIFF=1

/PERIOD=12

/MXAUTO=50.

ACF VARIABLES = ROUNDTRP

/APPLY.

ACF APPLY

Page 6: Acf and Pacf Syntax

/NOLOG.

ACF APPLY 'MOD_2'

/PERIOD=6.

• The first command requests a maximum of 50 autocorrelations for the series TICKETS after a natural log transformation, differencing, and one degree of seasonal differencing with a periodicity of 12 have been applied. This model is assigned the default name MOD_1.

• The second command displays and plots the autocorrelation function for the series ROUNDTRP using the same model that was used for the series TICKETS. This model is assigned the name MOD_2.

• The third command requests another autocorrelation function of the series ROUNDTRP using the same model but without the natural log transformation. Note that when APPLY is the first specification after the ACF command, the slash (/) before it is not necessary. This model is assigned the name MOD_3.

• The fourth command reapplies MOD_2, autocorrelations for the series ROUNDTRP with the natural log and differencing specifications, but this time with a periodicity of 6. This model is assigned the name MOD_4. It differs from MOD_2 only in the periodicity.