powered by
Generate a correlation matrix for AR(1) model
AR1.cor(n, rho)
size of matrix
correlation between -1 to 1
\(n\times n\) AR(1) correlation matrix
The correlation matrix is created as $$ \left(\begin{array}{ccccc} 1 & \rho & \rho^2 & \cdots & \rho^{n-1}\\ \rho & 1 & \rho & \cdots & \rho^{n-2}\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ \rho^2 & \rho & 1 & \cdots & \rho^{n-3} \end{array}\right)$$
# NOT RUN { AR1.cor(5, 0.5) # }
Run the code above in your browser using DataLab