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

set.seed(1)
x <- filter(rnorm(100), 0.9, "recursive")
isoacf(x)
#>   [1]  1.00000000  0.75620784  0.52668286  0.31877074  0.17874234  0.10451987
#>   [7]  0.07597397  0.07597397  0.07054562  0.03324149 -0.02266489 -0.02266489
#>  [13] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [19] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [25] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [31] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [37] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [43] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [49] -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489 -0.02266489
#>  [55] -0.03242424 -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610
#>  [61] -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610
#>  [67] -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610
#>  [73] -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610
#>  [79] -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610
#>  [85] -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03500610 -0.03924011
#>  [91] -0.03924011 -0.03924011 -0.03924011 -0.03924011 -0.03924011 -0.03924011
#>  [97] -0.03924011 -0.03924011 -0.03924011 -0.03924011
acf(x, plot = FALSE)$acf
#> , , 1
#> 
#>              [,1]
#>  [1,]  1.00000000
#>  [2,]  0.75620784
#>  [3,]  0.52668286
#>  [4,]  0.31877074
#>  [5,]  0.17874234
#>  [6,]  0.10451987
#>  [7,]  0.06774750
#>  [8,]  0.08420043
#>  [9,]  0.07054562
#> [10,]  0.03324149
#> [11,] -0.02547696
#> [12,] -0.08386780
#> [13,] -0.12702588
#> [14,] -0.15733924
#> [15,] -0.22570274
#> [16,] -0.27858103
#> [17,] -0.32634007
#> [18,] -0.31457877
#> [19,] -0.32132555
#> [20,] -0.32323138
#> [21,] -0.28412580
#>