#
# AXJ_LM Model cut-and-paste code into window above and Run (Cmd-Enter)
#
#
# Measurement Matrix (Growth), (N-XREAL), (Q-XREAL)
# Q N XREAL
#[1,] 0.5809 0.5736 0.5775
#[2,] -0.2243 0.7949 -0.5638
#[3,] 0.7825 -0.1979 -0.5904
#
# Fraction of Variance
#[1] 0.9857 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(1.032483086, 0.0893329688, 7.3532892, 1.146422e-01,
-0.015620695, 0.9745223725, -6.5969415, 1.761040e-03,
0.000010184, 0.0007955634, 0.8679133, -7.008574e-05,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# Steady-State Asian Growth
# (Uncommment next command)
#
# f[1,1] <- 1
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
AXJLM <- SS(F=f,H=h,K=k,z0=c( 1.146422e-01, 1.761040e-03, -7.008574e-05, 1.0000000000),
output.names=c("AXJ1","AXJ1","AXJ1"))
print(AXJLM)
is.SS(AXJLM)
stability(SS(F=f[1:3,1:3,drop=FALSE],R=eye(3),H=eye(3),Q=eye(3)))
# tfplot(simulate(AXJLM,sampleT=100))
AXJLM.data <- simulate(AXJLM,sampleT=100,noise=matrix(0,100,3))
AXJLM.f <- forecast(l(AXJLM,AXJLM.data),horizon=100)
AXJM.fx <- merge.forecast(AXJLM.f)
tfplot(AXJLM.f)
AIC(l(AXJLM,AXJLM.data))
q <- matrix( c( 0.3075393229, 4.394617e-04, 3.442278e-05,
0.0576136724, 2.775657e-03, -3.088211e-05,
-0.0002702703, 2.256986e-05, 4.062942e-06,
0.00000000, 0.0000000, 0.0000000
),byrow=TRUE,nrow=4,ncol=3)
r <- matrix( c( 0.2951994354, 0.000000e+00, 0.000000e+00,
0.0613396050, 3.005610e-03, 0.000000e+00,
-0.0003710925, 2.324968e-05, 4.681277e-06
),byrow=TRUE,nrow=3,ncol=3)
AXJLM2 <- SS(F=f,H=h,Q=q,R=r,z0=c( 1.146422e-01, 1.761040e-03, -7.008574e-05, 1.0000000000),
output.names=c("AXJ1","AXJ1","AXJ1"))
shockDecomposition(AXJLM2)