# Cut-andPaste Code Below into Window Above and Run
#
# DEL19D BAU Model
#
# Measurement Matrix (Growth-P) (LS-P) (P+LS-GD)
#
# Q LS W P N PD G GD
#[1,] 0.40810 0.01687 0.40549 -0.1733 0.40434 0.40637 0.38881 0.3986
#[2,] -0.08042 0.74396 -0.02061 -0.6438 -0.10690 -0.07661 -0.07337 0.0500
#[3,] 0.07865 0.65971 0.12278 0.7173 0.01306 0.11209 0.06332 -0.1107
# Fraction of Variance
#[1] 0.7380 0.9254 0.9737 0.9893 0.9954 0.9985 0.9998 1.0000
#
require(dse)
require(matlab)
AIC <- function(model) {informationTestsCalculations(model)[3]}
f <- matrix( c( 1.00469302, -0.064160984, 0.01610147, 0.24021238,
-0.09378164, 0.784883642, 0.08343431, 0.07238104,
0.01946481, -0.007641104, 0.84078485, 0.02460858,
0.000000000, 0.00000000, 0.0000000, 1.00000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize the System, Uncomment Next line
# f[1,1] <- 0.90
#
h <- eye(3,4)
k <- f[1:4,1:3,drop=FALSE]
DEL19 <- SS(F=f,H=h,K=k,z0=c(0.24021238, 0.07238104, 0.02460858, 1.00000000),
output.names=c("DE1","DE2","DE3"))
stability(SS(F=f[1:3,1:3,drop=FALSE],R=eye(3),Q=eye(3),H=eye(3)))
#tfplot(simulate(DEL19,sampleT=20))
shockDecomposition(toSSChol(DEL19))
DEL19.data <- simulate(DEL19,sampleT=50,start=1872,noise=matrix(0,50,3))
m <- l(DEL19,DEL19.data)
tfplot(m)
AIC(m)
tfplot(forecast(m,horizon=50))
#
# Feedback Components
#
DEL19f <- SS(F=f[2:4,2:4,drop=FALSE],H=eye(2,3),K=f[2:4,2:3,drop=FALSE],
z0=c( 0.03947626, 0.01232109, 1.00000000),
output.names=c("DE2","DE3"))
stability(m <- SS(F=f[2:3,2:3,drop=FALSE],H=eye(2),Q=eye(2),R=eye(2)))
shockDecomposition(m)