#
# UKLMA World Model Late Middle Ages (1300-1450)
# Cut and Paste code below into window above and Run
#
# Measurement Matrix (Growth), (Q-U-N), (U-N)
# Q N U
#[1,] 0.547 0.601 0.583
#[2,] 0.820 -0.243 -0.518
#[3,] 0.170 -0.761 0.626
#
# Fraction of Variance
#[1] 0.905 0.999 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.0139123518, 0.002726748, -0.07513867, 0.040558883,
0.0150222549, 1.008272561, -0.11367798,0.002817065,
-0.0005243428, 0.004309132, 0.97588421, 0.001081704,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
UKLMA <- SS(F=f,H=h,K=k,z0=c( 0.040558883, 0.002817065, 0.001081704, 1.0000000000),
output.names=c("UK1","UK2","UK3"))
print(UKLMA)
is.SS(UKLMA)
stability(UKLMA)
# tfplot(simulate(UKLMA,sampleT=150))
#UKLMA.data <- simulate(UKLMA,sampleT=150,noise=matrix(0,150,3))
UKLMA.data <- simulate(UKLMA,sampleT=150)
UKLMA.f <- forecast(l(UKLMA,UKLMA.data),horizon=150)
tfplot(UKLMA.f)
AIC(m <- l(UKLMA,UKLMA.data))
shockDecomposition(toSSChol(m))