#
# US_E20 Model (Growth-IMM), (FINN-LU), (IMM-FED)
#
# Measurement Matrix
# L.US.E. L.U. GNP.US. GNP.C. GNP.I. GNP.X. GNP.G. P.US.TBILL.
#[1,] 0.2193 0.0343 0.21805 0.2201 0.1707 0.1955 0.1404 0.195
#[2,] -0.0174 -0.2720 0.00525 0.0650 0.2130 0.1599 -0.0942 -0.139
#[3,] 0.0092 -0.4216 0.14585 0.0515 0.0263 0.0649 0.2549 -0.243
# P.CPAPER. P.FED.FUNDS. P.CPI. P.GDP. P.SP500. V.NYSE.
#[1,] -0.1338 0.0264 0.2070 0.2100 0.1479 0.102
#[2,] 0.3703 0.2991 0.1616 0.1439 0.0171 0.107
#[3,] -0.0333 -0.3847 -0.0685 -0.0167 -0.0910 -0.331
# P.S.P.DPR. P.S.P.EPR. Q.H.Starts. K.US. M1 M2 P.WPI.
#[1,] 0.194 0.0765 0.141 0.2065 0.2074 0.2157 0.1733
#[2,] -0.195 0.3260 0.198 -0.0654 -0.0353 -0.0216 0.2417
#[3,] -0.144 -0.0340 0.124 -0.2174 0.2181 0.1492 0.0686
# Q.A. Q.I. O.B. P.FUELS. P.W.AG. P.W.MFG. Q.OIL. N.US.
#[1,] 0.2131 0.2041 -0.0773 0.1561 0.2040 0.2217 0.215 0.2122
#[2,] -0.0695 -0.0759 0.3980 0.2611 0.0225 0.0201 -0.126 -0.0846
#[3,] 0.0571 0.1577 -0.1691 -0.0666 0.2419 0.0734 -0.021 -0.1495
# IMM.US. U.US.
#[1,] -0.151 0.2107
#[2,] 0.143 -0.0888
#[3,] 0.248 -0.1705
#
# Fraction of Variance
# [1] 0.637 0.774 0.855 0.904 0.937 0.958 0.970 0.978 0.984 0.990 0.993
#[12] 0.996 0.997 0.998 0.998 0.999 0.999 1.000 1.000 1.000 1.000 1.000
#[23] 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c( 1.0276420120, -0.04037731, -0.09367185, 0.324320408,
-0.0008705484, 0.95523103, -0.18831136, 0.059323285,
-0.0038330655, 0.10040247, 0.95814360, 0.009650457,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
US_E20 <- SS(F=f,H=h,K=k,z0=c(0.324320408, 0.059323285, 0.009650457, 1.0000000000),
output.names=c("US1","US2","US3"))
print(US_E20)
is.SS(US_E20)
stability(US_E20)
# tfplot(simulate(US_E20,sampleT=100))
US_E20.data <- simulate(US_E20,sampleT=100,noise=matrix(0,100,3),start=1900)
US_E20.f <- forecast(l(US_E20,US_E20.data),horizon=100)
tfplot(US_E20.f)
AIC(m <- l(US_E20,US_E20.data))
shockDecomposition(m)