config-i1 / smooth

The set of functions used for time series analysis and in forecasting.
89 stars 19 forks source link

vcov method for es(), ssarima(), msarima(), ces() and gum() #185

Closed config-i1 closed 1 year ago

config-i1 commented 3 years ago

Develop a proper vcov for the three. Some parts of this do not work. An example:

require("smooth")
set.seed(123)
y <- ts(diffinv(diffinv(arima.sim(n=400, model=list(ar=c(0.6,-0.4,0,0.3), ma=c(-0.3,0,5)))),4), frequency=4)
#this returns the covariance matrix
res1 <- msarima(y=y, orders=list(ar=c(2,1),i=c(1,1),ma=c(2,0)),lags=c(1,4), h=18, silent=FALSE, FI=TRUE)
res1$FI

#when xreg is not NULL, this gives an error
xreg <- cbind(xregA=rnorm(length(y)+18))
res2 <- msarima(y=y, orders=list(ar=c(2,1),i=c(1,1),ma=c(2,0)),lags=c(1,4), h=18, silent=FALSE, xreg=xreg, FI=TRUE)
#Error in costfuncARIMA(ar.orders, ma.orders, i.orders, lags, nComponents,  :
#  copy into submatrix: incompatible matrix dimensions: 12x1 and 11x1
config-i1 commented 1 year ago

vcov() now works for the new es() and msarima(). This is because it works for adam(). Nobody cares about the other functions, so there's no point in keeping this issue.