# Cut-and-Paste Code Below into Window above and Run
#
# AT18 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 (growth-X) (Q-HOURS) (Q-N) (Growth cycles)
# Q N HOURS XREAL X
#
#[1,] 0.461 0.4815 0.3016 -0.4818 -0.4818
#[2,] 0.341 0.0149 -0.9248 -0.1188 -0.1188
#[3,] 0.656 -0.7195 0.2240 0.0249 0.0249
#[4,] 0.490 0.5002 0.0595 0.5031 0.5031
#
# Fraction of Variance
#[1] 0.853 0.996 1.000 1.000 1.000
#
#
f <- matrix( c( 1.0109013858, -0.02042457, -0.02561897, 0.077221280,
-0.0398013001, 1.07932875, 0.18324794, -0.028891235,
0.0002803577, -0.01590629, 0.98814680, 0.004360747,
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.90
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
AT18 <- SS(F=f,H=h,K=k,z0=c(0.077221280, -0.028891235, 0.004360747, 1.0000000000),
output.names=c("AT1","AT2","AT3"))
print(AT18)
is.SS(AT18)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# tfplot(simulate(AT18,sampleT=100))
AT18.data <- simulate(AT18,sampleT=100,noise=matrix(0,100,3),start=1700)
AT18.f <- forecast(l(AT18,AT18.data),horizon=150)
tfplot(AT18.f)
AIC(l(AT18,AT18.data))
shockDecomposition(m)