# Cut-and-Paste Code Below into Window above and Run
#
# AT18 TECH Model (Austria)
#
#
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.9776632, 0.03680768,
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.03680768, 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)
#
# AT18 TECH Model
#
# Measurement Matrix (growth-X) (Q-HOURS) (Q-N) (Growth cycles)
# Q N HOURS XREAL X
#
#[1,] 0.461 0.4815 0.3016 -0.4818 -0.4818
#[2,] 0.341 0.0149 -0.9248 -0.1188 -0.1188
#[3,] 0.656 -0.7195 0.2240 0.0249 0.0249
#[4,] 0.490 0.5002 0.0595 0.5031 0.5031
#
# Fraction of Variance
#[1] 0.853 0.996 1.000 1.000 1.000
#
#
f <- matrix( c( 0.5962098, -0.5460035, -1.7605179, -7.164482,
1.1553749, 2.5940915, 5.1833731, 20.842309,
-0.3068621, -0.4051778, -0.2968109, -5.359227,
0.0000000, 0.0000000, 0.0000000, 1.000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment Following Line
# f[2,1] <- f[2,2] <- f[2,3] <- 0.90; f[1,3] <- -0.5
#
g <- matrix(c( 5.086151,
-14.658715,
3.767072,
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]
AT18 <- SS(F=f,H=h,K=k,G=g,z0=c(-2.112917, 6.283273, -1.617772, 1.0),
output.names=c("AT1","AT2","AT3"),input.names= c("TECH"))
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
AT18.data <- simulate(AT18,sampleT=100,noise=matrix(0,100,3),start=1700,input=TECH.fx)
AT18.f <- forecast(l(ES18,ES18.data),conditioning.inputs=TECH.fx)
tfplot(AT18.f)