#
# FRL17 World Model (1640-1815)
#
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 (Q+N-U), U, (Q-N)
# Q N U
#[1,] 0.7047 0.692 -0.156
#[2,] 0.0296 0.191 0.981
#[3,] 0.7089 -0.696 0.114
# Fraction of Variance
#[1] 0.669 0.998 1.000
#
# Fraction of Variance
#[1] 0.987 0.995 0.999 1.000
#
f <- matrix( c(1.002716204, -0.0056439659, 0.1624389, 0.021539840,
0.018199696, 1.0287901927, -0.6625305, 0.028976135,
-0.002063291, 0.0001907678, 0.9864639, 0.000511435,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment next line
# f[1,1] <- f[2,2] <- 0.98
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
FRL17 <- SS(F=f,H=h,K=k,z0=c(0.021539840, 0.028976135, 0.000511435, 1.0000000000),
output.names=c("FR1","FR2","FR3"))
print(FRL17)
is.SS(FRL17)
stability(FRL17)
FRL17.data <- (simulate(FRL17,sampleT=100))
#FRL17.data <- simulate(WL17,sampleT=150,noise=matrix(0,150,3))
FRL17.f <- forecast(l(FRL17,FRL17.data),horizon=150)
tfplot(FRL17.f)
AIC(m <- l(FRL17,FRL17.data))
shockDecomposition(toSSChol(m))