AR1 {codadiags} | R Documentation

## Generate auto-regressive order 1 sequence

### Description

Generate auto-regressive order 1 sequence

### Usage

      AR1(length = 1000, mean = 0, sd = 1, rho = 0.1,
        rand = function() {     rnorm(1) })

### Arguments

`length` | size of the sequence
`mean` | mean value of the sequence μ
`sd` | standard deviation of the sequence σ
`rho` | auto-correlation factor
`rand` | function to generate one random step

### Value

Auto Regressive ("AR") sequence

X=μ * ≤ft\{ x_n \right\}_{1 ≤q n ≤q N}, x_1 = σ * u_1 / √{1-ρ^2}, x_n=ρ * x_{n-1} + σ * u_n

### Examples

    x = AR1()
    plot(x,type='l',col=rgb(.5,0,0,.5))

[Package codadiags version 1.0 Index]