#
# CAL20 BAU Model (CANADA)
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
# Measurement Matrix (Growth-LU) (LU) (CO2+EG-Q-L-N)
#
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN
#[1,] 0.43643 0.43882 0.44188 0.4443
#[2,] 0.07086 0.04899 0.02476 0.1189
#[3,] 0.57112 0.51224 -0.49087 -0.2381
# SP.POP.TOTL SL.UEM.TOTL.ZS
#[1,] 0.4442 -0.164207
#[2,] 0.1020 0.983576
#[3,] -0.3372 0.009451
#
# Fraction of Variance
#[1] 0.8237 0.9730 0.9943 0.9988 0.9999 1.0000
#
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)
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(SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3,3),R=eye(3,3),H=eye(3,3)))
# tfplot(simulate(CAL20,sampleT=100))
CAL20.data <- simulate(CAL20,sampleT=50,noise=matrix(0,50,3))
CAL20.f <- forecast(l(CAL20,CAL20.data),horizon=50)
tfplot(CAL20.f)
AIC(l(CAL20,CAL20.data))
shockDecomposition(toSSChol(CAL20))