# Cut-and-Paste Code Below into Window above and Run
#
# W18 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-T), Q-N, N-L
# Q N L T
#[1,] 0.499 0.500 0.501 -0.501
#[2,] 0.837 -0.491 -0.171 0.171
#[3,] 0.227 0.713 -0.469 0.469
#
# Fraction of Variance
#[1] 0.996 1.000 1.000 1.000
f <- matrix( c( 0.9990146949, 0.04503518, -0.05464643, 0.065548536,
-0.0042486908, 1.04226953, -0.04676536, -0.002528148,
0.0004986095, 0.03266194, 0.95871578, -0.001858812
, 0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment next line
# f[2,2] <- 0.90
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
W18 <- SS(F=f,H=h,K=k,z0=c(0.065548536, -0.002528148, -0.001858812, 1.0000000000),
output.names=c("W1","W2","W3"))
print(W18)
is.SS(W18)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# tfplot(simulate(WL19D,sampleT=100))
W18.data <- simulate(W18,sampleT=100,noise=matrix(0,100,3),start=1700)
W18.f <- forecast(l(W18,W18.data),horizon=150)
tfplot(W18.f)
AIC(l(W18,W18.data))
shockDecomposition(m)