# Cut-and-Paste Code Below into Window Above and Run
#
# US19 Model
#
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), (Q+XREAL-N-HOURS), (N-HOURS-L), ( Q-X ), (Q-XREAL), (L-HOURS)
#
# Q N HOURS XREAL X L
#[1,] 0.4091 0.4061 0.4084 0.406 0.4107 0.409
#[2,] 0.3913 -0.4318 -0.4004 0.546 0.2605 -0.366
#[3,] -0.0249 0.8018 -0.4379 0.146 -0.1184 -0.360
#
#[4,] 0.3667 -0.0447 0.1016 0.291 -0.8630 0.154
#[5,] 0.7155 0.0589 0.0895 -0.622 0.0491 -0.295
#[6,] 0.1801 -0.0171 -0.6803 -0.210 0.0470 0.677
#
# Fraction of Variance
#[1] 0.979 0.997 1.000 1.000 1.000 1.000
#
f <- matrix( c(1.029955791, -0.07367613, 0.0322730, 0.081953161,
0.012337159, 1.03101395, -0.0189414, 0.005562881,
0.001150714, 0.02690949, 0.9900611, 0.004165105,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
US19 <- SS(F=f,H=h,K=k,z0=c(0.081953161, 0.005562881, 0.004165105, 1.0000000000),
output.names=c("US1","US2","US3"))
print(US19)
is.SS(US19)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# tfplot(simulate(US19,sampleT=100))
US19.data <- simulate(US19,sampleT=100,noise=matrix(0,100,3),start=1800)
US19.f <- forecast(m1<-l(US19,US19.data),horizon=100)
tfplot(US19.f)
AIC(m1)