Learn R Programming

BayesRGMM (version 2.2)

AR1.cor: AR(1) correlation matrix

Description

Generate a correlation matrix for AR(1) model

Usage

AR1.cor(n, rho)

Arguments

n

size of matrix

rho

correlation between -1 to 1

Value

\(n\times n\) AR(1) correlation matrix

Details

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)$$

Examples

Run this code
# NOT RUN {
AR1.cor(5, 0.5)
# }

Run the code above in your browser using DataLab