# Cut-and-Paste Code Below
#
# DE19 BAU Model
#
merge.forecast <- function (fx,n=1) {
x <- splice(fx$pred,fx$forecast[[n]])
colnames(x) <- seriesNames(fx$data$output)
return(x)
}
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
# Measurement Matrix (Growth), (Q-U-HOURS-L+XREAL+X), (Q+HOURS+L-N-U-X)
#
# Q N U HOURS XREAL X L
#[1,] 0.376 0.388 0.372 0.377 0.378 0.373 0.382
#[2,] 0.409 -0.112 -0.466 -0.408 0.394 0.457 -0.270
#[3,] 0.386 -0.237 -0.553 0.252 -0.138 -0.288 0.569
#
# Fraction of Variance
#[1] 0.944 0.995 0.999 1.000 1.000 1.000 1.000
#
f <- matrix( c( 0, 0, 0, -0.823937588, -0.19247006, -0.116445611, 0.0000000000,
0 , 0, 0, 0.002696692, -0.95486673, 0.015811282, 0.0000000000,
0 , 0, 0, -0.028537252, 0.01428176, -0.942571878, 0.0000000000,
1, 0, 0, 1.824708974, 0.18241398, 0.110781933, 0.0157366535,
0, 1, 0, -0.002335829, 1.95045344, -0.001940828, 0.0003990191,
0, 0, 1, 0.027998800, -0.01336957, 1.934435602, -0.0025691520,
0, 0, 0, 0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=7,ncol=7)
h <- matrix(c(0, 0, 0, 1, 0, 0, 0,
0 , 0 , 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 1, 0
),byrow=TRUE,nrow=3,ncol=7)
k <- (f[,4:6,drop=FALSE])
DE19 <- SS(F=f,H=h,K=k,z0=c(0, 0, 0, 0.0157366535, 0.0003990191, -0.0025691520, 1.0000000000),
output.names=c("DE1","DE2","DE3"))
print(DE19)
is.SS(DE19)
stability(m <- SS(F=f[1:6,1:6,drop=FALSE],Q=eye(6,3),R=eye(3),H=h[,1:6,drop=FALSE]))
# tfplot(simulate(DE19,sampleT=100))
DE19.data <- simulate(DE19,sampleT=100,noise=matrix(0,100,3))
DE19.f <- forecast(m1<-l(DE19,DE19.data),horizon=100)
tfplot(DE19.f)
AIC(m1)