ar1_sim: Simulate from a stationary Gaussian AR(1) process.

Description Usage Arguments Value Examples

Description

Simulate from a stationary Gaussian AR(1) process, either at consecutive or irregular times.

Usage

1
ar1_sim(times, rho, sigma, mu = 0)

Arguments

times

The time points to simulate for. If a single positive integer, then that many consecutive values will be simulated.

rho

A real number strictly less than 1 in absolute value.

sigma

A positive real number.

mu

A vector of expected values with length length(times), or a scalar (default equal to 0).

Value

If length(times) > 1, a vector of length length(times). Else (length(times) == 1 a vector with as many values as the integer times.

Examples

1
2
3
4
5
6
7
times <- c(3, 5:7, 10)
rho <- 0.5
sigma <- 1
mu <- seq_along(times)
ar1_sim(times[1], rho, sigma)
ar1_sim(times, rho, sigma)
ar1_sim(times, rho, sigma, mu)

BenjaK/irregulAR1 documentation built on May 30, 2019, 3:51 p.m.