qar.sim: Simulate a first-order quadratic AR model

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/qar.sim.R

Description

Simulates a first-order quadratic AR model with normally distributed noise.

Usage

1
qar.sim(const = 0, phi0 = 0, phi1 = 0.5, sigma = 1, n = 20, init = 0)

Arguments

const

intercept

phi0

coefficient of the lag 1

phi1

coefficient of the squared lag 1

sigma

noise standard deviation

n

sample size

init

number of burn-in values

Details

The quadratic AR(1) model specifies that

Y_t = \mathrm{const}+φ_0 Y_{t-1}+φ_1 Y^2_{t-1}+e_t

where e_t are iid normally distributed with zero mean and standard deviation σ. If σ=0, the model is deterministic.

Value

A simulated series from the quadratic AR(1) model, as a vector

Author(s)

Kung-Sik Chan

See Also

tar.sim

Examples

1
2
3
4
5
set.seed(1234567)
plot(y=qar.sim(n=15,phi1=.5,sigma=1),x=1:15,type='l',ylab=expression(Y[t]),xlab='t')
y=qar.sim(n=100,const=0.0,phi0=3.97, phi1=-3.97,sigma=0,init=.377)
plot(y,x=1:100,type='l',ylab=expression(Y[t]),xlab='t')
acf(y,main='')

TSA documentation built on July 2, 2018, 1:04 a.m.