# Cut-and-Paste Code Below into Window Above and Run
#
# FR18 BAU Model France
#
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-U, U, N-L, Q-HOURS, Q-N
#
# Q N U HOURS L
#[1,] 0.4719 0.460 -0.3528 0.470 0.470
#[2,] 0.0757 0.315 0.9208 0.153 0.153
#[3,] 0.1284 0.735 -0.1075 -0.465 -0.465
#[4,] 0.4025 -0.179 0.0589 -0.719 0.534
#[5,] 0.7701 -0.342 0.1128 0.150 -0.505
#
# Fraction of Variance
#[1] 0.895 1.000 1.000 1.000 1.000
#
f <- matrix( c( 0.993145772, -0.021037069, -0.1528638, 0.064937629,
0.022886284, 1.049910086, 0.3377458, 0.018390009,
0.000623702, -0.004793843, 0.9569441, -0.001744027,
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])
FR18 <- SS(F=f,H=h,K=k,z0=c(0.064937629, 0.018390009, -0.001744027, 1.0000000000),
output.names=c("FR1","FR2","FR3"))
print(FR18)
is.SS(FR18)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# tfplot(simulate(FR18,sampleT=100))
FR18.data <- simulate(FR18,sampleT=100,noise=matrix(0,100,3),start=1700)
FR18.f <- forecast(l(FR18,FR18.data),horizon=150)
tfplot(FR18.f)
AIC(l(FR18,FR18.data))
shockDecomposition(m)