# Cut-and-Paste Code Below into Window above and Run
#
# RU18 BAU Model Russia
#
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 # overall-XREAL, Q-N, N+XREAL-L
#
# Q N XREAL L
#[1,] 0.496 0.500 -0.502 0.502
#[2,] 0.830 -0.512 0.155 -0.155
#[3,] 0.254 0.698 0.473 -0.473
#
# Fraction of Variance
#[1] 0.99 1.00 1.00 1.00
#
#
f <- matrix( c( 0.9981745742, 0.02786861, -0.05772300, 0.065343602,
-0.0070628173, 1.03900425, -0.07351076, -0.003793081,
0.0003765241, 0.01679889, 0.96282118, -0.001544634,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment next line
# f[2,2] <- 0.90
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
RU18 <- SS(F=f,H=h,K=k,z0=c(0.065343602, -0.003793081, -0.001544634, 1.0000000000),
output.names=c("RU1","RU2","RU3"))
print(RU18)
is.SS(RU18)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# tfplot(simulate(RU18,sampleT=100))
RU18.data <- simulate(RU18,sampleT=100,noise=matrix(0,100,3),start=1700)
RU18.f <- forecast(l(RU18,RU18.data),horizon=150)
tfplot(RU18.f)
AIC(l(RU18,RU18.data))
shockDecomposition(m)