#
# Cut-and-Paste Code Below Into Window Above
#
require(dse)
require(matlab)
merge.forecast <- function (fx,n=1) {
x <- splice(fx$pred,fx$forecast[[n]])
colnames(x) <- seriesNames(fx$data$output)
return(x)
}
AIC <- function(model) {informationTestsCalculations(model)[3]}
#
# Measurement Matrix Overall, (CO2+EF+EG-KOF-HDI), (LU+N-Q-CO2-EG-HDI)
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN SP.POP.TOTL
#[1,] 0.240 0.280 0.290 0.4014 0.4071
#[2,] 0.495 0.460 -0.371 -0.0100 -0.0226
#[3,] -0.302 -0.202 -0.565 0.0771 0.2151
# SL.UEM.TOTL.ZS HDI EF KOF
#[1,] 0.351 0.373 0.253 0.356
#[2,] -0.134 -0.251 0.482 -0.302
#[3,] 0.655 -0.223 0.134 -0.018
#
# Fraction of Variance
#[1] 0.639 0.910 0.968 0.986 0.993 0.996 0.999 1.000 1.000
#
f <- matrix( c(1.000000000, 0.000000000, 0.000000000, 0.00000000,
0.151211639, 0.961683570, -0.004311081, -0.04877107,
-0.008054082, -0.054258972, 0.982431858, -0.10736782,
-0.038543403, -0.004660288, 0.066848157, 1.01307392
),byrow=TRUE,nrow=4,ncol=4)
h <- matrix( c(0 , 1, 0 , 0,
0, 0, 1, 0,
0, 0, 0, 1
),byrow=TRUE,nrow=3,ncol=4)
k <- matrix(c(0.000000000, 0.00000000, 0.000000000,
0.961683570, -0.05425897, -0.004660288,
-0.004311081, 0.98243186, 0.066848157,
-0.048771071, -0.10736782, 1.013073916
),byrow=TRUE,nrow=4,ncol=3)
PL20 <- SS(F=f,H=h,K=k,z0=c(1.0000000, -5.2878119, -1.5293484, 0.2923368),
output.names=c("PL1","PL2","PL3"))
print(PL20)
is.SS(PL20)
stability(PL20)
# tfplot(simulate(PL20,sampleT=150))
PL20.data <- simulate(PL20,sampleT=150,noise=matrix(0,150,3))
PL20.f <- forecast(l(PL20,PL20.data),horizon=150)
tfplot(PL20.f)
AIC(l(PL20,PL20.data))