# Cut-and-Paste Code Below into Window above and Run
#
# EUL20 Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
#Measurement Matrix (Growth) (CO2+EG -LU) (LU+CO2 -Q-L)
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN
#[1,] 0.316 0.4313 0.433 0.442
#[2,] 0.747 0.2760 -0.223 -0.097
#[3,] 0.352 0.0753 -0.390 -0.342
# SP.POP.TOTL SL.UEM.TOTL.ZS
#[1,] 0.4458 0.364
#[2,] -0.0332 -0.552
#[3,] -0.2131 0.745
#
# Fraction of Variance
#[1] 0.828 0.972 0.996 0.999 1.000 1.000
f <- matrix( c(0.964430034, -7.321276e-05, 0.01413639, 0.1450974567,
-0.053232046, 9.697933e-01, 0.04289553, 0.0008440534,
-0.005985813, 8.425407e-04, 0.93190290, -0.0031522950,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
EUL20 <- SS(F=f,H=h,K=k,z0=c(0.1450974567, 0.000844053,4 -0.0031522950, 1.0000000000),
output.names=c("EU1","EU2","EU3"))
print(EUL20)
is.SS(EUL20)
stability(SS(F=f[1:3,1:3,drop=FALSE],R=eye(3),Q=eye(3,3),H=eye(3,3)))
# tfplot(simulate(EUL20,sampleT=100))
EUL20.data <- simulate(EUL20,sampleT=50,noise=matrix(0,50,3),start=1960)
EUL20.f <- forecast(m <- l(EUL20,EUL20.data),horizon=150)
tfplot(EUL20.f)