how to omit lag 0 in act() function

Hi, Sir

I am a beginner. I want to plot the ACF and PACF of a series. If I directly use the acf() function, It will give me something that includes lag 0. I only need lag 1 to lag 10.

Is there anyone who can advise me?

Kind Regards,

ZZZ

1 Like

The return value of acf is an acf object with an accompanying plot. Plotting can be suppressed, then the acf object subset with your lags of interest and (re)plotted. see below

myacf <- acf(lh, plot = FALSE)
myacf <- myacf[1:10]
plot(myacf)

disclaimer: I have no experience with time series objects. I found most of this info by checking help at ?acf

1 Like

Hi ZZZ,
The function Acf() in the forecast package excludes 0, and you can set the upper limit of lags with the lag.max argument:

library(forecast)
    #> Registered S3 method overwritten by 'quantmod':
    #>   method            from
    #>   as.zoo.data.frame zoo

Acf(wineind, lag.max = 10)

Thanks for your help. ^ ^ it works.

Thanks. This package is pretty good.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.