# Cut-and-paste text below into window above and Run
#
# UK19D World Input Model
#
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)
#
# Measurement Matrix # overall, X-U-N, XREAL+Q-X-L-U Export-led growth
#
# Q N U HOURS XREAL X L
#[1,] 0.378 0.378 0.378 0.378 0.379 0.376 0.379
#[2,] -0.265 -0.290 -0.464 0.276 0.213 0.695 -0.162
#[3,] 0.316 0.138 -0.338 -0.261 0.725 -0.245 -0.337
#
# Fraction of Variance
#[1] 0.995 1.000 1.000 1.000 1.000 1.000 1.000
#
f <- matrix( c(0.9829784746, 0.12195456, -0.07352879, 0.232572955,
-0.0143996650, 1.06038401, -0.02118443, -0.006691086,
0.0002142174, 0.04862518, 0.95817519, -0.004001837,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize the Model, uncomment next line
# f[2,2] <- 0.90
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
UKL19D <- SS(F=f,H=h,K=k,z0=c(0.232572955, -0.006691086, -0.004001837, 1.0000000000),
output.names=c("UK1","UK2","UK3"))
print(UKL19D)
is.SS(UKL19D)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
shockDecomposition(m)
# tfplot(simulate(UKL19D,sampleT=150))
UKL19D.data <- simulate(UKL19D,sampleT=150,noise=matrix(0,150,3))
UKL19D.f <- forecast(l(UKL19D,UKL19D.data),horizon=150)
tfplot(UKL19D.f)
AIC(l(UKL19D,UKL19D.data))