#
# UKL20 Model
#
require(dse)
require(matlab)
# Measurement Matrix # Overall-(CO2+LU),(EF+CO2+EG- L),(LU+L+N+EF - KOF)
#
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN SP.POP.TOTL
#[1,] -0.3191 0.2111 0.41693 0.3147 0.40422
#[2,] 0.3919 0.5579 0.02489 -0.3210 -0.02218
#[3,] -0.1267 0.2253 0.04727 0.4173 0.31838
# SL.UEM.TOTL.ZS KOF EF HDI
#[1,] -0.3243 0.38640 0.01132 0.40349
#[2,] -0.1260 0.06557 0.63561 0.08302
#[3,] 0.7125 -0.22818 0.28185 -0.12800
# Fraction of Variance
#[1] 0.6343 0.8797 0.9344 0.9766 0.9890 0.9969 0.9990 0.9998 1.0000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
f <- matrix( c(1.00000000, 0.000000000, 0.0000000000, 0.000000000,
0.15156250, 1.018572111, 0.0002269249, 0.005172694,
-0.06983131, -0.126397980, 1.0576660915, -0.275455949,
0.04382693, -0.001373313, -0.0298119308 , 0.926069637
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize System, uncomment next line
# f[2,2] <- f[3,3] <- f[4,4]
h <- matrix(c(0, 1, 0 , 0,
0, 0, 1, 0,
0, 0, 0 , 1
),byrow=TRUE,nrow=3,ncol=4)
k <- f[1:4,2:4,drop=FALSE]
UK <- SS(F=f,H=h,K=k,z0=c( 1.000000, -3.185388, -2.514388, -1.465725),
output.names=c("UK1","UK2","UK3"))
UK;
stability(SS(F=f[2:4,2:4],H=eye(3), R=eye(3),Q=eye(3)))
shockDecomposition(toSSChol(UK))
#tfplot(simulate(UK,sampleT=50,start=1))
UK.data <- simulate(UK,sampleT=50,noise=matrix(0,50,2),start=1)
m <- l(UK,UK.data)
#tfplot(m)
UK.f <- forecast(m,horizon=50)
tfplot(UK.f)
AIC(m)