Skip to contents

Methods for computation of autocorrelations and periodic autocorrelations.

Methods

signature(x = "numeric", maxlag = "ANY", lag_0 = "missing")

signature(x = "PeriodicTimeSeries", maxlag = "ANY", lag_0 = "missing")

signature(x = "PeriodicAutocovariances", maxlag = "ANY", lag_0 = "missing")

signature(x = "SamplePeriodicAutocovariances", maxlag = "ANY", lag_0 = "missing")

signature(x = "VirtualPeriodicAutocovariances", maxlag = "ANY", lag_0 = "missing")

signature(x = "VirtualPeriodicAutocovarianceModel", maxlag = "ANY", lag_0 = "missing")

See also

autocorrelations in package sarima for further details.

autocovariances for autocovariances;

Examples

## periodic ts object => peridic acf
autocorrelations(pcts(AirPassengers), maxlag = 10)
#> An object of class "SamplePeriodicAutocorrelations"
#> Slot "modelCycle":
#> Object from built-in class 'MonthYearCycle'
#> Cycle start: January 
#> 
#> Slot "data":
#> An object of class "Lagged2d"
#> Slot *data*: 
#>     Lag_0     Lag_1     Lag_2     Lag_3     Lag_4     Lag_5     Lag_6     Lag_7
#> Jan     1 0.7625916 0.7615747 0.7411110 0.7590680 0.7611872 0.7466266 0.7554121
#> Feb     1 0.9982465 0.7576557 0.7558500 0.7346974 0.7525411 0.7546380 0.7409393
#> Mar     1 0.9918130 0.9932155 0.7422192 0.7420423 0.7238225 0.7407296 0.7444457
#> Apr     1 0.9915893 0.9947516 0.9959179 0.7576004 0.7559386 0.7351574 0.7506037
#> May     1 0.9982897 0.9947421 0.9950393 0.9968230 0.7534542 0.7523672 0.7330159
#> Jun     1 0.9958044 0.9949104 0.9949229 0.9972964 0.9987000 0.7565890 0.7554144
#> Jul     1 0.9982106 0.9963570 0.9949812 0.9918817 0.9949910 0.9977168 0.7573203
#> Aug     1 0.9977557 0.9976737 0.9952191 0.9923076 0.9948521 0.9959544 0.9974787
#> Sep     1 0.9973339 0.9988078 0.9985273 0.9967242 0.9951878 0.9949687 0.9950109
#> Oct     1 0.9985617 0.9974285 0.9989874 0.9978559 0.9978369 0.9962766 0.9923116
#> Nov     1 0.9985629 0.9984778 0.9971015 0.9973429 0.9971131 0.9966455 0.9928667
#> Dec     1 0.9986007 0.9971084 0.9976800 0.9939314 0.9962021 0.9943744 0.9939361
#>         Lag_8     Lag_9    Lag_10
#> Jan 0.7393576 0.7235248 0.7850520
#> Feb 0.7484447 0.7311993 0.7136811
#> Mar 0.7302015 0.7418925 0.7195945
#> Apr 0.7556423 0.7399045 0.7478320
#> May 0.7491317 0.7550857 0.7387131
#> Jun 0.7356265 0.7536952 0.7550155
#> Jul 0.7573028 0.7381362 0.7556274
#> Aug 0.7561910 0.7577808 0.7385832
#> Sep 0.9963723 0.7490285 0.7485433
#> Oct 0.9964015 0.9979196 0.7520121
#> Nov 0.9943344 0.9944752 0.9956477
#> Dec 0.9906844 0.9906346 0.9910534
#> 
#> Slot "n":
#> [1] 144
#> 
#> Slot "varnames":
#> character(0)
#> 
#> Slot "objectname":
#> [1] "pcts(AirPassengers)"
#> 

## for "ts" or "numeric" objects the default is non-periodic acf
autocorrelations(AirPassengers, maxlag = 10) 
#> An object of class "SampleAutocorrelations"
#>     Lag_0     Lag_1     Lag_2     Lag_3     Lag_4     Lag_5     Lag_6     Lag_7 
#> 1.0000000 0.9480473 0.8755748 0.8066812 0.7526254 0.7137700 0.6817336 0.6629044 
#>     Lag_8     Lag_9    Lag_10 
#> 0.6556105 0.6709483 0.7027199 
#> Slot n:
#> [1] 144
#> Slot varnames:   <not set>
#> Slot objectname:  x
autocorrelations(as.numeric(AirPassengers))
#> An object of class "SampleAutocorrelations"
#>     Lag_0     Lag_1     Lag_2     Lag_3     Lag_4     Lag_5     Lag_6     Lag_7 
#> 1.0000000 0.9480473 0.8755748 0.8066812 0.7526254 0.7137700 0.6817336 0.6629044 
#>     Lag_8     Lag_9    Lag_10    Lag_11    Lag_12    Lag_13    Lag_14    Lag_15 
#> 0.6556105 0.6709483 0.7027199 0.7432402 0.7603950 0.7126609 0.6463423 0.5859234 
#>    Lag_16    Lag_17    Lag_18    Lag_19    Lag_20    Lag_21 
#> 0.5379552 0.4997475 0.4687340 0.4498707 0.4416288 0.4572238 
#> Slot n:
#> [1] 144
#> Slot varnames:   <not set>
#> Slot objectname:  x
## argument 'nseasons' forces periodic acf
autocorrelations(AirPassengers, maxlag = 10, nseasons = 12)
#> An object of class "SampleAutocorrelations"
#>     Lag_0     Lag_1     Lag_2     Lag_3     Lag_4     Lag_5     Lag_6     Lag_7 
#> 1.0000000 0.9480473 0.8755748 0.8066812 0.7526254 0.7137700 0.6817336 0.6629044 
#>     Lag_8     Lag_9    Lag_10 
#> 0.6556105 0.6709483 0.7027199 
#> Slot n:
#> [1] 144
#> Slot varnames:   <not set>
#> Slot objectname:  x
autocorrelations(as.numeric(AirPassengers), maxlag = 10, nseasons = 12)
#> An object of class "SamplePeriodicAutocorrelations"
#> Slot "modelCycle":
#> Object from class 'BareCycle'
#> Number of seasons:  
#> 
#> Slot "data":
#> An object of class "Lagged2d"
#> Slot *data*: 
#>     Lag_0     Lag_1     Lag_2     Lag_3     Lag_4     Lag_5     Lag_6     Lag_7
#> S1      1 0.7625916 0.7615747 0.7411110 0.7590680 0.7611872 0.7466266 0.7554121
#> S2      1 0.9982465 0.7576557 0.7558500 0.7346974 0.7525411 0.7546380 0.7409393
#> S3      1 0.9918130 0.9932155 0.7422192 0.7420423 0.7238225 0.7407296 0.7444457
#> S4      1 0.9915893 0.9947516 0.9959179 0.7576004 0.7559386 0.7351574 0.7506037
#> S5      1 0.9982897 0.9947421 0.9950393 0.9968230 0.7534542 0.7523672 0.7330159
#> S6      1 0.9958044 0.9949104 0.9949229 0.9972964 0.9987000 0.7565890 0.7554144
#> S7      1 0.9982106 0.9963570 0.9949812 0.9918817 0.9949910 0.9977168 0.7573203
#> S8      1 0.9977557 0.9976737 0.9952191 0.9923076 0.9948521 0.9959544 0.9974787
#> S9      1 0.9973339 0.9988078 0.9985273 0.9967242 0.9951878 0.9949687 0.9950109
#> S10     1 0.9985617 0.9974285 0.9989874 0.9978559 0.9978369 0.9962766 0.9923116
#> S11     1 0.9985629 0.9984778 0.9971015 0.9973429 0.9971131 0.9966455 0.9928667
#> S12     1 0.9986007 0.9971084 0.9976800 0.9939314 0.9962021 0.9943744 0.9939361
#>         Lag_8     Lag_9    Lag_10
#> S1  0.7393576 0.7235248 0.7850520
#> S2  0.7484447 0.7311993 0.7136811
#> S3  0.7302015 0.7418925 0.7195945
#> S4  0.7556423 0.7399045 0.7478320
#> S5  0.7491317 0.7550857 0.7387131
#> S6  0.7356265 0.7536952 0.7550155
#> S7  0.7573028 0.7381362 0.7556274
#> S8  0.7561910 0.7577808 0.7385832
#> S9  0.9963723 0.7490285 0.7485433
#> S10 0.9964015 0.9979196 0.7520121
#> S11 0.9943344 0.9944752 0.9956477
#> S12 0.9906844 0.9906346 0.9910534
#> 
#> Slot "n":
#> [1] 144
#> 
#> Slot "varnames":
#> character(0)
#> 
#> Slot "objectname":
#> [1] "as.numeric(AirPassengers)"
#>