# Cut-and-Paste Code Below into Window Above and Run
#
# FR19 Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
# Measurement Matrix (Growth), (Q+X-N-HOURS), (XREAL-X-HOURS)
#
# Q N U HOURS XREAL X L
#[1,] 0.3662 0.3834 0.38828 0.3758 0.38482 0.3625 0.38395
#[2,] 0.5633 -0.2781 -0.07562 -0.4070 -0.08613 0.5979 -0.26293
#[3,] 0.1223 -0.1060 0.08535 -0.4924 0.75876 -0.3849 -0.01215
#
#Fraction of Variance
#[1] 0.9451 0.9953 0.9996 0.9999 1.0000 1.0000 1.0000
#
f <- matrix( c(1.007941410, -0.01690067, -0.05130896, 8.419129e-02,
0.013598613, 0.99783430, -0.05297408, -5.194149e-06,
0.007128953, 0.02389778, 1.09549000, 6.987085e-03,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabiize, Uncomment next Line
# f[1,1] <- f[2,2] <- f[3,3] <- 0.9
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
FR19 <- SS(F=f,H=h,K=k,z0=c(8.419129e-02, -5.194149e-06, 6.987085e-03, 1.0000000000),
output.names=c("FR1","FR2","FR3"))
print(FR19)
is.SS(FR19)
stability(m0 <- SS(F=f[1:3,1:3,drop=FALSE],R=eye(3),H=eye(3),Q=eye(3)))
# tfplot(simulate(FR19,sampleT=100))
FR19.data <- simulate(FR19,sampleT=100,noise=matrix(0,100,3),start=1800)
FR19.f <- forecast(m<- l(FR19,FR19.data),horizon=50)
tfplot(FR19.f)
AIC(m)
shockDecomposition(m0)