TSA (version 1.3)

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

Description

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

Usage

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

Value

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

Details

The quadratic AR(1) model specifies that $$Y_t = \mathrm{const}+\phi_0 Y_{t-1}+\phi_1 Y^2_{t-1}+e_t$$ where \(e_t\) are iid normally distributed with zero mean and standard deviation \(\sigma\). If \(\sigma=0\), the model is deterministic.

See Also

tar.sim

Examples

Run this code
# NOT RUN {
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='')
# }

Run the code above in your browser using DataCamp Workspace