# Cut-and-Paste code below into window above and Run
#
# FR_E20 BAU Model
#
# Measurement Matrix (U-N-HOURS), (Q+N+L-XREAL), (X-XREAL-L)
# Q N U HOURS XREAL X L
#[1,] 0.07936 -0.3177 0.47904 -0.47560 0.3715 0.40091 0.3720
#[2,] 0.71501 0.5396 0.04924 -0.02826 -0.2458 0.09277 0.3541
#[3,] 0.02453 -0.1482 0.05026 -0.14389 -0.6173 0.62087 -0.4332
#
# Fraction of Variance
#[1] 0.6182 0.8866 0.9925 1.0000 1.0000 1.0000 1.0000
#
merge.forecast <- function (fx,n=1) {
#
# Merges a forecast with the outputdata
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( 0.988380071, -0.0002959452, -0.005083523, 0.13813147,
0.069626728, 1.0976612946, 0.148737427, 0.08937210,
-0.005407648, -0.1521641534, 1.00680239,1 -0.07212518,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize
# Uncomment next line
# f[1,1] <- 0.930540217; f[2,2] <- 1.0334263197; f[3,3] <- 0.947884466
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
FR_E20 <- SS(F=f,H=h,K=k,z0=c(0.2749981, 0.1863623, -0.15908724, 1.0000000000),
output.names=c("FR1","FR2","FR3"))
print(FR_E20)
is.SS(FR_E20)
stability(m0 <- SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
FR_E20.data <- simulate(FR_E20,sampleT=50,start=1900)
#FR_E20_GD.data <- simulate(FR_E20,sampleT=50,noise=matrix(0,50,3),start=1900)
FR_E20.f <- forecast(m <- l(FR_E20,FR_E20.data),horizon=150)
tfplot(FR_E20.f)
AIC(m)
shockDecomposition(m0)