# Cut-and-paste code below into window above and Run
#
# Western Europe (WE) Model (1950-2000)
#
#
# Measurement Matrix # Growth-HOURS, (L+N-X), (X+HOURS-N)
#
# Q N U HOURS XREAL X L
#[1,] 0.3855 0.376 0.3864 -0.373 0.380 0.370 0.376
#[2,] 0.1885 0.455 0.1367 0.423 -0.363 -0.468 0.457
#[3,] 0.0505 -0.187 -0.0123 0.646 -0.106 0.702 0.205
#
# Fraction of Variance
#
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( 1.0112882659, -0.01805751, 0.02142231, 0.18672325,
-0.0290870228, 1.05626768, -0.1048439,7 -0.01830366,
0.0007159374, 0.09543996, 0.94687040, -0.02230875,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize model, uncomment next line
# f[1,1] <- 1.0011753832; f[2,2] <- 1.04570500; f[3,3] <- 0.93740170
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
WE_LM <- SS(F=f,H=h,K=k,z0=c(0.18672325, -0.01830366, -0.02230875, 1.0000000000),
output.names=c("WE1","WE2","WE3"))
print(WE_LM)
is.SS(WE_LM)
stability(WE_LM)
WE_LM.data <- simulate(WE_LM,sampleT=100,start=1950)
#WE_LM.data <- simulate(WE_LM,sampleT=100,noise=matrix(0,100,3),start=1950)
WE_LM.f <- forecast(l(WE_LM,WE_LM.data),horizon=150)
WE_LM.fx <- merge.forecast(WE_LM.f)
tfplot(WE_LM.f)
AIC(m <- l(WE_LM,WE_LM.data))
WE_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("WE1","WE2","WE3"))
shockDecomposition(WE_LMx)
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias Bias-z
#[1,] 0.993167 1.0112883 1.029060 0.39 0.61 0.014103 0.002954 0.2095
# [2,] -0.038779 -0.0290870 -0.022908 0.59 0.41 0.006198 1.040862 167.9452
# [3,] -0.005773 0.0007159 0.007693 0.53 0.47 0.005643 1.010178 179.0100
# [4,] -0.093956 -0.0180575 0.050034 0.61 0.39 0.058321 1.017555 17.4476
# [5,] 1.018742 1.0562677 1.100521 0.26 0.74 0.035129 -0.028428 -0.8093
# [6,] 0.071993 0.0954400 0.114216 0.45 0.55 0.016471 0.918011 55.7353
# [7,] -0.132756 0.0214223 0.203621 0.62 0.38 0.137037 0.946353 6.9058
# [8,] -0.165661 -0.1048440 -0.060598 0.33 0.67 0.043168 1.135773 26.3107
# [9,] 0.889539 0.9468704 0.996140 0.31 0.69 0.044667 0.086222 1.9303
#[10,] 0.170864 0.1867233 0.205960 0.70 0.30 0.014354 0.817093 56.9244
#[11,] -0.040922 -0.0183037 -0.002514 0.56 0.44 0.014669 1.029731 70.1990
#[12,] -0.031639 -0.0223087 -0.012474 0.51 0.49 0.007816 1.034494 132.3475
#