generate AR(1) correlation matrices

ARgenerate(n, rho)

Arguments

n

number of columns/rows

rho

correlation parameter

Value

Toeplitz \(n \times n\) matrix with 1 on the diagonal and \(rho^k\) on the other diagonals, where \(k\) is distance from the main diagonal. Used internally but it is useful for generating your own random matrices.

Examples

ARgenerate(6, .9)
#>         [,1]   [,2]  [,3]  [,4]   [,5]    [,6]
#> [1,] 1.00000 0.9000 0.810 0.729 0.6561 0.59049
#> [2,] 0.90000 1.0000 0.900 0.810 0.7290 0.65610
#> [3,] 0.81000 0.9000 1.000 0.900 0.8100 0.72900
#> [4,] 0.72900 0.8100 0.900 1.000 0.9000 0.81000
#> [5,] 0.65610 0.7290 0.810 0.900 1.0000 0.90000
#> [6,] 0.59049 0.6561 0.729 0.810 0.9000 1.00000