Autocorrelation function (forced to be decreasing by isotonic regression).

isoacf(x, lagmax = NULL, weave1 = FALSE)

Arguments

x

numeric vector.

lagmax

numeric. The maximal lag of the autocorrelations.

weave1

logical. If set to TRUE isoacf uses the acf.R and pava.blocks function from the original weave package, otherwise R's own acf and isoreg functions are used.

Details

isoacf computes the autocorrelation function (ACF) of x enforcing the ACF to be decreasing by isotonic regression. See also Robertson et al. (1988).

Value

isoacf returns a numeric vector containing the ACF.

References

Lumley T & Heagerty P (1999). “Weighted Empirical Adaptive Variance Estimators for Correlated Data Regression.” Journal of the Royal Statistical Society B, 61, 459--477.

Robertson T, Wright FT, Dykstra RL (1988). Order Restricted Statistical Inference. John Wiley and Sons, New York.

See also

Examples

x <- filter(rnorm(100), 0.9, "recursive")
isoacf(x)
#>   [1]  1.00000000  0.83607856  0.67522910  0.52866639  0.37729032  0.29098700
#>   [7]  0.21391037  0.13691679  0.03162908 -0.03407320 -0.03951841 -0.03951841
#>  [13] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [19] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [25] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [31] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [37] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [43] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [49] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [55] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [61] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [67] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [73] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [79] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [85] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [91] -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841 -0.03951841
#>  [97] -0.03951841 -0.03951841 -0.03951841 -0.03951841
acf(x, plot = FALSE)$acf
#> , , 1
#> 
#>               [,1]
#>  [1,]  1.000000000
#>  [2,]  0.836078563
#>  [3,]  0.675229096
#>  [4,]  0.528666391
#>  [5,]  0.377290320
#>  [6,]  0.290987004
#>  [7,]  0.213910372
#>  [8,]  0.136916787
#>  [9,]  0.031629080
#> [10,] -0.034073198
#> [11,] -0.087291127
#> [12,] -0.126776541
#> [13,] -0.098471268
#> [14,] -0.062312072
#> [15,] -0.017117297
#> [16,]  0.011035167
#> [17,] -0.010138866
#> [18,] -0.007860938
#> [19,] -0.038367467
#> [20,] -0.093829942
#> [21,] -0.100467770
#>