#
# Canada CAL20 BAU Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
# Measurement Matrix
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN
#[1,] 0.350 0.357 0.348 0.3584
#[2,] -0.118 -0.033 -0.046 0.0365
#[3,] -0.249 -0.133 -0.263 -0.0381
# SP.POP.TOTL SL.UEM.TOTL.ZS KOF EF HDI
#[1,] 0.3542 0.250 0.3481 0.252 0.3575
#[2,] 0.0358 0.721 0.0389 -0.675 0.0553
#[3,] -0.2076 0.586 0.0118 0.680 -0.0245
#
# Fraction of Variance
#[1] 0.861 0.945 0.984 0.995 0.998 0.999 0.999 1.000 1.000
#
# Steady State Model
#
f <- matrix( c(0.97610884, 0.0256881, -0.1572464, 0.191769302,
0.01457517, 0.7704012, 0.3648380, -0.035614316,
-0.01887314, 0.1050347, 0.7091121, 0.000382655,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# For Techo-Optimist Model set:
# f[1,1] <-1.0
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
CAL20 <- SS(F=f,H=h,K=k,z0=c(0.191769302, -0.035614316, 0.000382655, 1.0000000000),
output.names=c("CA1","CA2","CA3"))
print(CAL20)
is.SS(CAL20)
stability(CAL20)
# tfplot(simulate(CAL20,sampleT=100))
CAL20.data <- simulate(CAL20,sampleT=150,noise=matrix(0,150,3))
CAL20.f <- forecast(l(CAL20,CAL20.data),horizon=150)
tfplot(CAL20.f)
AIC(l(CAL20,CAL20.data))
q = matrix(c( 0.78265692, 0.04710351, -0.04840015,
-0.09070254, 0.28428694, 0.11229643,
0.07173053, -0.10767950, 0.21826335,
0.00000000, 0.00000000, 0.00000000
),byrow=TRUE,nrow=4,ncol=3)
r <- matrix(c(0.8320300, 0.0000000, 0.0000000,
-0.2063402, 0.4741856, 0.0000000,
0.1538634, -0.2220882, 0.3077981
),byrow=TRUE,nrow=3,ncol=3)
CAL20c <- SS(F=f,H=h,Q=q,R=r,z0=c(0.191769302, -0.035614316, 0.000382655, 1.0000000000),
output.names=c("CA1","CA2","CA3"))
shockDecomposition(CAL20c)
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev.
#[1,] 0.959684 0.9761088 0.990595 0.48 0.52 0.012681
# [2,] 0.002381 0.0145752 0.025398 0.39 0.61 0.009155
# [3,] -0.025319 -0.0188731 -0.012976 0.80 0.20 0.005779
# [4,] -0.036468 0.0256881 0.106931 0.50 0.50 0.056624
# [5,] 0.623513 0.7704012 0.881133 0.41 0.59 0.103001
#[6,] 0.033611 0.1050347 0.183158 0.41 0.59 0.057488
# [7,] -0.217945 -0.1572464 -0.104008 0.65 0.35 0.051238
# [8,] 0.199149 0.3648380 0.548766 0.39 0.61 0.138285
# [9,] 0.588804 0.7091121 0.812585 0.65 0.35 0.085508
#[10,] 0.172611 0.1917693 0.208455 0.58 0.42 0.015698
#[11,] -0.095942 -0.0356143 0.007601 0.62 0.38 0.041927
#[12,] -0.022177 0.0003827 0.031586 0.41 0.59 0.021791
#