#
# VE20 World Input Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
#
# Measurement Matrix
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE SL.TLF.TOTL.IN SP.POP.TOTL
#[1,] 0.3356 0.3346 0.3476 0.3495
#[2,] 0.0463 0.0144 -0.1485 -0.0859
#[3,] -0.4995 -0.3229 -0.0869 -0.0911
# SL.UEM.TOTL.ZS NY.GDP.MKTP.KD KOF EF HDI
#[1,] 0.297 0.331 0.332 0.333 0.337
#[2,] 0.791 -0.479 0.141 0.106 -0.287
#[3,] 0.182 0.114 -0.259 0.608 0.384
#
#Fraction of Variance
#[1] 0.902 0.951 0.976 0.989 0.996 0.999 0.999 1.000 1.000
#
f <- matrix( c(0.999861788, -0.015893040, 0.08759642, 0.168215354,
-0.007373528, 0.919408815, 0.11661879, -0.036413151,
-0.008284316, -0.004304076, 0.92326951, 0.002922896,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
q <- matrix(c(0.62495905, -0.008842351, 0.01477463,
-0.07326680, 0.269249747, 0.01966974,
0.04293942, -0.044435252, 0.15572510,
0.00000000, 0.000000000, 0.00000000
),byrow=TRUE,nrow=4,ncol=3)
r = matrix(c(0.61922542, 0.00000000, 0.000000,
-0.08127875, 0.29877891, 0.000000,
0.05168528, -0.0467353, 0.168667
),byrow=TRUE,nrow=3,ncol=3)
VE20 <- SS(F=f,H=h,K=k,z0=c(0.168215354, -0.036413151, 0.002922896, 1.0000000000),
output.names=c("VE1","VE2","VE3"))
VE20x <- SS(F=f,H=h,Q=q,R=r,z0=c(0.168215354, -0.036413151, 0.002922896, 1.0000000000),
output.names=c("VE1","VE2","VE3"))
print(VE20)
is.SS(VE20)
stability(VE20)
n <- 100
# tfplot(simulate(VE20,sampleT=n))
VE20.data <- simulate(VE20,sampleT=n,noise=matrix(n),start=1960)
VE20.f <- forecast(m <-l(VE20x,VE20.data),horizon=n)
tfplot(VE20.f)
shockDecomposition(m)