#
# W_L16 Model (1450-1640) (Cut-and-Paste Code into window above and Run (Cmd-Enter))
#
#
# Measurement Matrix (Growth-T), (Q+T), (Q-N)
# Q N T
#[1,] 0.576 0.5831 -0.573
#[2,] 0.651 0.0971 0.753
#[3,] 0.495 -0.8066 -0.324
#
# Fraction of Variance
#[1] 0.98 1.00 1.00
#
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(0.9943698154, 0.030771900, 0.3589261, 0.0274095487,
-0.0043335350, 1.022279770, 0.2692689, -0.0030295812,
-0.0001074497, -0.002679999, 0.9905856, 0.0003015236,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize, uncomment next command
#
# f[2,2]=.90
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
W16 <- SS(F=f,H=h,K=k,z0=c( 0.0274095487, -0.0030295812, 0.0003015236, 1.0000000000),
output.names=c("W1","W2","W3"))
print(W16)
is.SS(W16)
stability(W16)
# tfplot(simulate(W16,sampleT=100))
W16.data <- simulate(W16,sampleT=200,start=1450)
#W16.data <- simulate(W16,sampleT=200,noise=matrix(0,200,3),start=1450)
W16.f <- forecast(l(W16,W16.data),horizon=200)
tfplot(W16.f)
W16.fx <- merge.forecast(W16.f)
tfplot(W16.fx)
AIC(m <- l(W16,W16.data))
shockDecomposition(toSSChol(m))