Learn R Programming

quantspec (version 1.2-4)

ts-models-AR1: Simulation of an AR(1) time series.

Description

Returns a simulated time series \((Y_t)\) that fulfills the following equation: $$Y_t = a Y_{t-1} + \epsilon_t,$$ where \(a\) is a parameter and \(\epsilon_t\) is independent white noise with marginal distribution specified by the parameter innov.

Usage

AR1(n, a, overhead = 500, innov = rnorm)

Value

Returns an AR(1) time series with specified parameters.

Arguments

n

length of the time series to be returned

a

parameter of the model

overhead

an integer specifying the ``warmup'' period to reach an approximate stationary start for the times series

innov

a function that generates a random number each time innov(1) is called; used to specify the distribution of the innovations; rnorm by default

Examples

Run this code
plot(AR1(100, a=-0.7), type="l")

Run the code above in your browser using DataLab