sluacf: Computes autocorrelations (ACF) for a time series

Description Usage Arguments Details Value Examples

Description

This function computes autocorrelations for various lags of a time series.

Usage

1
sluacf(series, lags = 1, maxlag = NULL, ndiff = 0, sdiff = 0)

Arguments

series

a time series object

lags

a multiplier for the lag. For example, use lag=12 for monthly data.

maxlag

maximum number of lags to compute

ndiff

number of regular differences to take before finding the ACF

sdiff

number of seasonal differences (with seasonal period specified by lags)

Details

This is is a wrapper for the acf function which allows for specifying regular (ndiff) and seasonal (sdiff) differences. The lags parameter specifies the seasonal lag and adjusts the default lags in the returned acf object to go 1, 2, ..., rather than showing fractional lags (for example, 1/12, 2/12, ... for monthly data). The lag 0 autocorrelation is set to NA (rather than 1) so that it won;t show when acf is plotted.

Value

An object of class "acf"

Examples

1
2
3
4
5
6
7
8
9
data(SeaIce)
ExtentY=ts(SeaIce$Extent,start=1979)
sluacf(ExtentY)
sluacf(ExtentY, maxlag=8,ndiff=1)

data(Inflation)
CPIts=ts(Inflation$CPI,start=c(2009,1),frequency=12)
CPIacf=sluacf(CPIts,maxlag=36,lags=12)
plot(CPIacf,lwd=2,ci.type="ma",xlim=c(1,36),xaxp=c(0,36,6),main="")

Stat2Data documentation built on May 2, 2019, 7:25 a.m.