Between covid-19 news and announcements of imminent Russia-Ukraine wars I needed a bit of a distraction. Sooo, here it is how to create an n x n autocorrelation matrix based on a correlation rho, with a simple 5 x 5 example in R:
1 2 3 4 |
n <- 5 rho <- 0.9 mat <- diag(n) mat <- rho^abs(row(mat) - col(mat)) |
This produces the following output: A 5 x 5 autocorrelation matrix… Continue reading Creating an n x n autocorrelation matrix