#
# Cut-and-Paste Code Below into Window above and Run
#
# WL20 World Model (1900-2000)
#
# Measurement Matrix (Growth), (T-L), (X-L-T)
# Q N XREAL X L T
#[1,] 0.432 0.431 0.4204 0.409 0.389 0.363
#[2,] -0.167 -0.234 0.0724 0.295 -0.589 0.691
#[3,] 0.121 -0.037 0.4175 0.467 -0.459 -0.618
#
# Fraction of Variance
#[1] 0.878 0.940 0.996 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(1.022834544, -0.1791380, 0.1203947, 0.076706674,
0.009670073, 0.7435336, 0.2947428, 0.006866763,
0.030723389, 0.2760873, 0.8028409, 0.015964891,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, uncomment next two lines
# f[1,1] <- .9
# f[2,2] <- f[3,3] <- .7
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
WL20 <- SS(F=f,H=h,K=k,z0=c( 0.076706674, 0.006866763, 0.015964891, 1.0000000000),
output.names=c("W1","W2","W3"))
print(WL20)
is.SS(WL20)
stability(WL20)
tfplot(WL20.data <- simulate(WL20,sampleT=150,start=1900))
#WL20.data <- simulate(WL20,sampleT=150,noise=matrix(0,150,3),start=1900)
WL20.f <- forecast(m <- l(WL20,WL20.data),horizon=150)
tfplot(WL20.f)
AIC(m)
shockDecomposition(toSSChol(m))