Learn R Programming

corTESTsrd (version 1.0-0)

rankacf: Estimator of Spearman autocorrelations

Description

Computes Spearman-autocorrelations when the observations contain NAs. If the observations do not contain NAs, the function is consistent with the function acf applied to ranks.

Usage

rankacf(x,lag.max=length(x)-2)

Value

Estimated spearman autocorrelation up to lag.max.

Arguments

x

numeric input vector.

lag.max

maximum lag for which acf is estimated, automatically limited to one less than number of observations, should be positive integer.

Examples

Run this code
x = rnorm(10)
rankacf(x)
acf(rank(x),plot=FALSE,lag.max = length(x)-2)$acf[-1,,1]

Run the code above in your browser using DataLab