Skip to contents

Load package

Set arguments

time <- 1000L
burn_in <- 200L
constant <- 2
coef <- c(0.5, -0.3)
sd <- 0.1
p <- length(coef)

Generate data

set.seed(42)
y <- SimAR(
  time = time,
  burn_in = burn_in,
  constant = constant,
  coef = coef,
  sd = sd
)

Plot

plot(x = 1:time, y = y[, 1], type = "b", xlab = "time")

Estimate parameters

yx <- YX(data = y, p = p)
Y = yx$Y
X = yx$X
simAutoReg:::.FitVAROLS(Y = Y, X = X)
#>          [,1]      [,2]       [,3]
#> [1,] 2.207371 0.4631797 -0.3517268