summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--R/estpoly.R6
1 files changed, 3 insertions, 3 deletions
diff --git a/R/estpoly.R b/R/estpoly.R
index 38bac39..ddfaf93 100644
--- a/R/estpoly.R
+++ b/R/estpoly.R
@@ -263,9 +263,9 @@ armax <- function(x,order=c(0,1,1,0),options=optimOptions()){
# Initial Parameter Estimates
mod_arx <- iv4(x,c(na,nb,nk)) # fitting ARX model
eps_init <- matrix(resid(mod_arx))
- mod_ar <- ar(eps_init,aic=F,order=nc)
- e_init <- matrix(mod_ar$resid); e_init[is.na(e_init)] <- 0
- theta0 <- matrix(c(mod_arx$sys$A[-1],mod_arx$sys$B,-mod_ar$ar))
+ mod_ma <- arima(eps_init,order=c(0,0,1),include.mean = F)
+ e_init <- matrix(mod_ar$residuals); e_init[is.na(e_init)] <- 0
+ theta0 <- matrix(c(mod_arx$sys$A[-1],mod_arx$sys$B,mod_ar$coef))
l <- levbmqdt(yout,uout,order,e_init,obj=armaxGrad,
theta0=theta0,N=N,opt=options)