Learn R Programming

irregulAR1 (version 1.0.0)

ar1_prec_consecutive: Sparse precision matrix for a stationary Gaussian AR(1) process, observed at consecutive timepoints.

Description

Creates the precision (inverse covariance) matrix of an AR(1) process with parameters rho and sigma, observed at n consecutive time points. The process is assumed to be in stationarity and to have Gaussian errors. The matrix is a tridiagonal band matrix and thus sparse.

Usage

ar1_prec_consecutive(n, rho, sigma)

Arguments

n

An integer greater than or equal to 1.

rho

A real number strictly less than 1 in absolute value.

sigma

A positive real number.

Value

A matrix with n rows and n columns.

Examples

Run this code
# NOT RUN {
library(Matrix)
n <- 5
rho <- 0.5
sigma <- 1
ar1_prec_consecutive(n, rho, sigma)
# }

Run the code above in your browser using DataLab