3

I'm trying to model AR1 using dlmModReg(). The main purpose is to keep phi a variable so that if phi >1, I know that mean reversion is not occurring.

Below is my code:

buildFun <- function(x) {dlmModReg(e1, addInt = FALSE, dV = exp(x[1]), dW = exp(x[2]))}
fit      <- dlmMLE(e0, parm = c(0,0), buildFun)
dlmRes   <- buildFun(fit$par)  
ResFilt  <- dlmFilter(e, dlmRes)
R        <- unlist(dlmSvd2var(ResFilt$U.R, ResFilt$D.R))
Q        <- R + as.vector(V(dlmRes)) 

"e is some residues from OLS and I'm trying to model e using AR1"

My Question:

  • Is my Q calculated wrongly as I try to built a confidence interval for ResFilt$f and the Q values are at least order 20 bigger than ResFilt$f?
ShinjiOno
  • 61
  • 1

0 Answers0