# Cut-and-Paste Code Below into Window Above and RUN
#
# BE_LM (Late Modern) Model (Belgium)
#
# Measurement Matrix
# Q N U HOURS XREAL X L
#[1,] 0.390585 0.379 0.39054 -0.386 0.385 0.364 0.348
#[2,] 0.000242 0.365 -0.00413 0.220 -0.242 -0.540 0.685
#[3,] 0.162385 -0.196 -0.33818 0.652 0.322 0.420 0.338
#
# Fraction of Variance
#[1] 0.936 1.000 1.000 1.000 1.000 1.000 1.000
#
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)
f <- matrix( c(1.001134557, 0.01309593, -0.1332430, 0.171537934,
-0.034347955, 1.01510230, -0.4299705, -0.008530308,
0.001554447, 0.01517904, 0.8659064, -0.004688827,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize the model, uncomment the next three lines:
# f[1,1] <- 0.991123212;f[2,2] <- 1.00495128; f[3,3] <- 0.8572473
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
BE_LM <- SS(F=f,H=h,K=k,z0=c(0.343783528, -0.021065363, -0.008611747, 1.0000000000),
output.names=c("BE1","BE2","BE3"))
print(BE_LM)
is.SS(BE_LM)
# stability(SS(F=F[1:3,1:3,drop=FALSE],H=eye(3),R=eye(3),Q=eye(3))
stability(BE_LM)
BE_LM.data <- (simulate(BE_LM,sampleT=100,start=1950))
BE_LM.data <- simulate(BE_LM,sampleT=20,noise=matrix(0,20,3),start=1950)
BE_LM.f <- forecast(m <- l(BE_LM,BE_LM.data),horizon=150)
tfplot(BE_LM.f)
AIC(m)
shockDecomposition(m)