#
# Cut-and-paste the following code into the window above and run.
#
# Measurement Matrix
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN SP.POP.TOTL SL.UEM.TOTL.ZS HDI
# 0.2821 0.406 0.334 0.4343 0.372 0.189 0.4340
# -0.4399 -0.220 -0.136 0.1328 0.227 0.497 0.0341
# 0.0643 -0.145 0.594 0.0494 -0.394 -0.337 0.2254
# EF KOF
# 0.235 0.195
# -0.395 0.516
# -0.488 0.247
#
#Fraction of Variance
#[1] 0.549 0.848 0.968 0.981 0.992 0.997 0.999 1.000 1.000
#
#
# RUL20 Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c(0.976658001, 0.02127754, 0.2249071, 0.161990376,
-0.008392259, 0.97543675, -0.2319674, 0.001666581,
-0.005587383, 0.09718186, 1.0312754, 0.035854885,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
q <- matrix(c (0.682049320, -0.01707696, 0.02524081,
-0.007342717, 0.29746432, -0.02603316,
-0.048151460, -0.07841107, 0.11573766,
0.000000000, 0.0000000, 0.00000000
),byrow=TRUE,nrow=4,ncol=3)
r <- matrix(c(0.70821972, 0.0000000, 0.0000000,
-0.01137065, 0.2805858, 0.0000000,
-0.04178258, -0.1024740, 0.1122277
),byrow=TRUE,nrow=3,ncol=3)
RUL20 <- SS(F=f,H=h,K=k,z0=c(0.161990376, 0.001666581, 0.035854885, 1.0000000000),
output.names=c("RU1","RU2","RU3"))
RUL20x <- SS(F=f,H=h,Q=q,R=r,z0=c(0.161990376, 0.001666581, 0.035854885, 1.0000000000),
output.names=c("RU1","RU2","RU3"))
print(RUL20)
is.SS(RUL20)
stability(RUL20)
# tfplot(simulate(RUL20,sampleT=100))
RUL20.data <- simulate(RUL20,sampleT=100,noise=matrix(0,100,3))
RUL20.f <- forecast(l(RUL20,RUL20.data),horizon=100)
tfplot(RUL20.f)
AIC(l(RUL20,RUL20.data))
shockDecomposition(RUL20x)