# Cut-and-Paste Code Below into Window above and Run
#
# ES18 TECH 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)
#
f <- matrix( c( 0.9791874, 0.02952622,
0.00000000, 1.0000000000
),byrow=TRUE,nrow=2,ncol=2)
h <- matrix(c(1,0
),byrow=TRUE,nrow=1,ncol=2)
k <- (f[,1,drop=FALSE])
TECH <- SS(F=f,H=h,K=k,z0=c(0.02952622, 1.0000000000),
output.names=c("TECH1"))
TECH.data <- simulate(TECH,sampleT=100,noise=matrix(0,100,1),start=1700)
TECH.f <- forecast(l(TECH,TECH.data),horizon=150)
tfplot(TECH.f)
TECH.fx <- merge.forecast(TECH.f)
#
# ES18 TECH Model
#
# Measurement Matrix # overall-X, Q-U, U-HOURS, Q-N, N-U, X-XREAL
#
# Q N U HOURS XREAL X
#[1,] 0.40525 0.44332 0.3813 3.53e-01 -0.4297 -0.4297
#[2,] 0.44612 -0.00431 -0.5123 -6.23e-01 -0.2748 -0.2748
#[3,] -0.07459 0.19228 0.6831 -6.91e-01 0.0834 0.0834
#
#[4,] 0.79330 -0.25152 0.1743 1.05e-01 0.3647 0.3647
#[5,] 0.04260 0.82894 -0.3050 -1.67e-16 0.4193 0.2055
#[6,] 0.00652 0.12678 -0.0466 1.94e-16 -0.6512 0.7468
#
# Fraction of Variance
#[1] 0.845 0.984 1.000 1.000 1.000 1.000
#
#
f <- matrix( c( 1.06439868, 0.08061579, -0.03364978, 1.065997,
-0.10312907, 0.88053739, 0.04298715, -1.596631,
-0.08525747, -0.14243939, 1.07278149, -1.922265,
0, 0, 0, 1.000000e+00
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment Following Line
# f[1,1] <- f[3,3] <- 0.90
#
g <- matrix(c(-0.7975656,
1.2871072,
1.5510104,
0.0000000
),byrow=TRUE,nrow=4,ncol=1)
h <- matrix(c( 1 , 0, 0 , 0,
0 , 1, 0, 0,
0, 0, 1, 0
),byrow=TRUE,nrow=3,ncol=4)
k <- f[,1:3,drop=FALSE]
ES18 <- SS(F=f,H=h,K=k,G=g,z0=c(0.3481876, -0.4382346, -0.5263561, 1.0),
output.names=c("ES1","ES2","ES3"),input.names= c("TECH"))
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
ES18.data <- simulate(ES18,sampleT=100,noise=matrix(0,100,3),start=1700,input=TECH.fx)
ES18.f <- forecast(l(ES18,ES18.data),conditioning.inputs=TECH.fx)
tfplot(ES18.f)