#
# RULM Model (Cut-and-paste the following code into the window above and run (Cmd-Enter)
#
#
# Measurement Matrix
# Q N XREAL X L
#[1,] 0.426 0.499 0.481 0.436 0.384
#[2,] 0.501 -0.148 -0.322 -0.502 0.609
#[3,] 0.578 0.242 0.116 -0.380 -0.670
#
# Fraction of Variance
#[1] 0.778 0.965 1.000 1.000 1.000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c(0.965721491, 0.09701327, 0.02827611, 0.09664265,
-0.061814596, 1.09932370, 0.01687737, -0.05077295,
-0.005273331, -0.09700021, 1.03531507, 0.03912558,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
q <- matrix(c (.52365970, 7.389778e-05, 0.0007070467,
0.08694423, 5.699617e-0, 0.0004220200,
0.08966113, -1.711095e-02, 0.0258881436,
0.000000000, 0.0000000, 0.00000000
),byrow=TRUE,nrow=4,ncol=3)
r <- matrix(c(.52856083, 0.000000000, 0.00000000,
0.10728441, 0.005430581, 0.00000000,
0.09934659, -0.016018490, 0.02500509
),byrow=TRUE,nrow=3,ncol=3)
RULM <- SS(F=f,H=h,K=k,z0=c(0.09664265, -0.05077295, 0.03912558, 1.0000000000),
output.names=c("RU1","RU2","RU3"))
RULMx <- SS(F=f,H=h,Q=q,R=r,z0=c(0.09664265, -0.05077295, 0.03912558, 1.0000000000),
output.names=c("RU","RU","RU"))
print(RULM)
is.SS(RULM)
stability(RULM)
# tfplot(simulate(RULM,sampleT=100),start=1950)
RULM.data <- simulate(RULM,sampleT=50,noise=matrix(0,100,3),start=1950)
RULM.f <- forecast(m <- l(RULM,RULM.data),horizon=100)
tfplot(RULM.f)
AIC(m)
shockDecomposition(RULMx)