Learn R Programming

CoSMoS (version 2.2.0)

AR1: Autoregressive model of order 1

Description

Generates a Gaussian time series from a first-order autoregressive (AR(1)) model with specified lag-1 autocorrelation, mean, and standard deviation.

Usage

AR1(n, alpha, mean = 0, sd = 1)

Value

A numeric vector of length n.

Arguments

n

Positive integer. Number of values to generate.

alpha

Numeric in \((-1, 1)\). Lag-1 autocorrelation coefficient.

mean

Numeric. Process mean. Default 0.

sd

Positive numeric. Process standard deviation. Default 1.