Learn R Programming

simts (version 0.1.1)

gen_ar1: Generate an Autoregressive Order 1 ( AR(1) ) sequence

Description

Generate an Autoregressive Order 1 sequence given \(\phi\) and \(\sigma^2\).

Usage

gen_ar1(N, phi = 0.3, sigma2 = 1)

Arguments

N

An unsigned integer for signal length.

phi

A double that contains autocorrection.

sigma2

A double that contains process variance.

Value

A vec containing the AR(1) process.

Process Definition

The Autoregressive order 1 (AR1) process with non-zero parameter \(\phi \in (-1,+1)\) and \(\sigma^2 \in {\rm I\!R}^{2}\). This process is defined as: $${X_t} = {\phi _1}{X_{t - 1}} + {\varepsilon_t} $$, where $${\varepsilon_t}\mathop \sim \limits^{iid} N\left( {0,\sigma^2} \right)$$ AR(1) processes are sometimes used as an approximation for Bias Instability noises.

Generation Algorithm

The function first generates a vector of White Noise with length \(N+1\) using gen_wn and then obtains the autoregressive values under the above process definition.

The \(X_0\) (first value of \(X_t\)) is discarded.

Details

The function implements a way to generate the AR(1)'s \(x_t\) values without calling the general ARMA function. Thus, the function is able to generate values much faster than gen_arma.