#
# WL20R MEA Cut an pasted code 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.41395 0.4092 0.4125 0.41635
#[2,] -0.23198 -0.3612 -0.2160 -0.04435
#[3,] 0.05987 -0.6044 0.7081 0.17598
# SP.POP.TOTL SL.UEM.TOTL.ZS
#[1,] 0.41630 0.37998
#[2,] 0.04581 0.87463
#[3,] -0.31247 -0.03361
#
# Fraction of Variance
#[1] 0.9587 0.9955 0.9989 0.9994 0.9999 1.0000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c(1.01389877, 0.013960359, 0.014314423, 0.160971128,
-0.035391585, 1.097936826, -0.00486692,3 -0.023976869,
-0.003813121, -0.009715855 , 0.919184163, 0.005569086,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize Uncomment Next command
# f[2,2] <- 1
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
MEA <- SS(F=f,H=h,K=k,z0=c(0.160971128, -0.023976869, 0.005569086, 1.0000000000),
output.names=c("MEA1","MEA2","MEA3"))
print(MEA)
is.SS(MEA)
stability(MEA)
# tfplot(simulate(MEA,sampleT=100))
MEA.data <- simulate(MEA,sampleT=100,noise=matrix(0,100,3))
MEA.f <- forecast(l(MEA,MEA.data),horizon=100)
tfplot(MEA.f)
AIC(l(MEA,MEA.data))