# Cut-and-Paste Code Below into Window Above and Run
#
# W_LM (Late Modern) Model
#
# Measurement Matrix
# Q N XREAL X L T
#[1,] 0.4343 0.433 0.418 0.424 0.357 0.375
#[2,] 0.0827 0.122 -0.291 -0.244 0.815 -0.413
#[3,] -0.1689 -0.162 -0.386 -0.226 0.254 0.825
#
# 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.00713465, 0.1136613, -0.3071767, 0.15009523,
-0.03424590, 0.9703990, 0.3867074, -0.02887742,
-0.03421009, 0.2132679, 0.3331558, -0.00712312,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize the model, uncomment the next three lines:
# f[1,1] <- 0.92932816
# f[2,2] <- 0.8954306
# f[3,3] <- 0.3074178
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
W_LM <- SS(F=f,H=h,K=k,z0=c(0.15009523, -0.02887742, -0.0071231, 1.0000000000),
output.names=c("W1","W2","W3"))
print(W_LM)
is.SS(W_LM)
stability(W_LM)
W_LM.data <- (simulate(W_LM,sampleT=100,start=1950))
W_LM.data <- simulate(W_LM,sampleT=20,noise=matrix(0,20,3),start=1950)
W_LM.f <- forecast(m <- l(W_LM,W_LM.data),horizon=150)
tfplot(W_LM.f)
AIC(m)
shockDecomposition(m)