#
# CN_21 Model (Cut-and-paste code below into window above and Run (Cmd-Enter))
#
# Measurement Matrix
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN
#[1,] 0.339 0.3378 0.3192 0.339
#[2,] 0.339 0.3626 0.5457 -0.284
#[3,] -0.007 0.0608 -0.0215 -0.165
# SP.POP.TOTL SL.UEM.TOTL.ZS EF KOF HDI
#[1,] 0.340 0.309 0.347 0.320 0.347
#[2,] -0.289 -0.358 0.164 -0.331 -0.164
#[3,] -0.120 0.824 0.111 -0.492 -0.145
#
#Fraction of Variance
#1] 0.899 0.961 0.985 0.997 0.999 1.000 1.000 1.000 1.000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c(1.010974244, -0.03430989, -0.1324633, 0.18404826,
0.053244800, 1.10297379, 0.1145191, 0.03947626,
0.003813592, 0.06123891, 0.8051962, 0.0123210,
0.000000000, 0.00000000, 0.0000000, 1.00000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
CN21 <- SS(F=f,H=h,K=k,z0=c(0.18404826, 0.03947626, 0.01232109, 1.00000000),
output.names=c("CN1","CN2","CN3"))
print(CN21)
is.SS(CN21)
stability(CN21)
# tfplot(simulate(CN21,sampleT=100))
CN21.data <- simulate(CN21,sampleT=100,noise=matrix(0,100,3),start=1960)
CN21.f <- forecast(l(CN21,CN21.data),horizon=100)
tfplot(CN21.f)
AIC(l(CN21,CN21.data))