rho | R Documentation |
Calculate serial autocorrelation with lag 1.
rho(x)
x |
a vector of values. |
Autocorrelation as a number.
Gives same value as acf(lag=1)
.
In the calculations, the two vectors x[t]
and x[t+1]
are
compared to the same xbar
.
Therefore, the estimated autocorrelation is slightly lower than
cor(x[t], x[t+1])
and also lower than cov(x[t], x[t+1]) /
var(x)
, where x[t]
and x[t+1]
are not compared to a common
mean.
This function serves as a shorthand for acf(x, plot=FALSE,
lag.max=1)$acf[2]
and makes the underlying equation transparent.
noise
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.