# Cut-and-Paste Code Below into Window Above and Run
#
# DE18 BAU Model Germany
#
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 # overall-U, N+U, Q-N
# Q N U
#[1,] 0.7160 0.673 -0.185
#[2,] -0.0762 0.338 0.938
#[3,] 0.6939 -0.657 0.294
#
# Fraction of Variance
#[1] 0.646 1.000 1.000
#
f <- matrix( c( 0.9890205004, -0.018085499, 0.2686420, 0.039158333,
0.0498847020, 1.042672779, -0.3701197, 0.021842806,
-0.0003267551, 0.001305037 , 0.9683067, 0.000669039,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment next line
# f[2,2] <- 0.90
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
DE18 <- SS(F=f,H=h,K=k,z0=c(0.039158333, 0.021842806, 0.000669039, 1.0000000000),
output.names=c("DE1","DE2","DE3"))
print(DE18)
is.SS(DE18)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# tfplot(simulate(DE18,sampleT=100))
DE18.data <- simulate(DE18,sampleT=100,noise=matrix(0,100,3),start=1700)
DE18.f <- forecast(l(DE18,DE18.data),horizon=150)
tfplot(DE18.f)
AIC(l(DE18,DE18.data))
shockDecomposition(m)