# Cut-and-paste code below into window above and Run
#
# Eastern Europe (EE) Model (1950-2000)
#
#
# Measurement Matrix # overall, L-X, X-XREAL
# Q N XREAL X L
#[1,] 0.470 0.4731 0.457 0.421 0.411
#[2,] 0.165 0.0617 -0.303 -0.614 0.707
#[3,] -0.226 -0.1098 -0.600 0.659 0.377
#
# Fraction of Variance
#[1] 0.891 0.986 1.000 1.000 1.000
#
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]}
require(dse)
require(matlab)
f <- matrix( c( 0.978846422, 0.03014765, -0.07763416, 0.13492482,
-0.046537842, 1.11215805, -0.08280240, -0.03875519,
0.001016303, 0.08022084, 1.00623730, -0.02054166,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize model, uncomment next line
# f[1,1] <- 0.94; f[2,2] <- 1.06; f[3,3] <- 0.97
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
EE_LM <- SS(F=f,H=h,K=k,z0=c( 0.13492482, -0.03875519, -0.02054166, 1.0000000000),
output.names=c("EE1","EE2","EE3"))
print(EE_LM)
is.SS(EE_LM)
stability(EE_LM)
EE_LM.data <- simulate(EE_LM,sampleT=100,start=1950)
#EE_LM.data <- simulate(EE_LM,sampleT=100,noise=matrix(0,100,3),start=1950)
EE_LM.f <- forecast(l(EE_LM,EE_LM.data),horizon=150)
EE_LM.fx <- merge.forecast(EE_LM.f)
tfplot(EE_LM.f)
AIC(m <- l(EE_LM,EE_LM.data))
EE_LMx <- SS(F=f,H=h,Q=eye(4,3),R=eye(3,3),z0=c(0.37540690, -0.04072951, -0.04504546, 1.0000000000),
output.names=c("EE1","EE2","EE3"))
shockDecomposition(EE_LMx)
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias Bias-z
# [1,] 0.969085 0.978846 0.988803 0.53 0.47 0.009049 0.0004096 0.04527
# [2,] -0.059899 -0.046538 -0.036713 0.54 0.46 0.011176 1.0258173 91.78908
# [3,] -0.006255 0.001016 0.006445 0.60 0.40 0.005996 0.9776192 163.03849
# [4,] 0.006525 0.030148 0.059080 0.62 0.38 0.022787 0.9448814 41.46609
#[5,] 1.052710 1.112158 1.180858 0.26 0.74 0.067202 -0.1134875 -1.68874
# [6,] 0.053608 0.080221 0.108354 0.31 0.69 0.028556 0.9026048 31.60776
# [7,] -0.165802 -0.077634 0.005787 0.56 0.44 0.076752 1.0506428 13.68871
# [8,] -0.168961 -0.082802 0.020274 0.22 0.78 0.083640 1.1071794 13.23741
# [9,] 0.961693 1.006237 1.043247 0.14 0.86 0.034685 -0.0007920 -0.02283
#[10,] 0.125240 0.134925 0.146570 0.58 0.42 0.009778 0.8409310 86.00040
#[11,] -0.063313 -0.038755 -0.016103 0.50 0.50 0.021623 1.0205371 47.19760
#[12,] -0.032327 -0.020542 -0.010655 0.58 0.42 0.009857 0.9991622 101.36216
#