# WBC BAU Model (BCE -20,000BC - 0 BC)
# Cut-and-Paste code below into window above and Run
#
require(dse)
require(matlab)
#
# Measurement Matrix
# Growth, (Growth-T) (Q-N)
#
# N Q T
#[1,] 0.605 0.605 5.17e-01
#[2,] 0.366 0.366 -8.56e-01
#[3,] -0.707 0.707 3.20e-06
#
# Fraction of Variance
#[1] 0.858 1.000 1.000
#
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]}
#
f <- matrix( c(1.041460e+00, 6.816948e-02, -3156.594970, 8.219978e-02,
3.598635e-02 ,1.045861e+00, -6739.885907, 1.857457e-02,
3.057330e-07, 8.048318e-07, 1.111575 ,1.517281e-07,
0.000000e+00, 0.000000e+00, 0.000000, 1.000000e+00
),byrow=TRUE,nrow=4,ncol=4)
#
# To Stabilize, Uncomment Next Line
# f[1,1] <- f[2,2] <- f[3,3] <- 0.9
#
# To Eliminate Malthusian Controller, Uncomment Next line
# f[1,3] <- f[2,3] <- 0
#
h <- eye(3,4)
k <- f[1:4,1:3,drop=FALSE]
WBC <- SS(F=f,H=h,K=k,z0=c(8.219978e-02, 1.857457e-02, 1.517281e-07, 1.0000000),
output.names=c("W1","W2","W3"))
stability(WBC)
shockDecomposition(toSSChol(WBC))
#tfplot(simulate(WBC,sampleT=50,noise=matrix(0,50,2),start=1))
WBC.data <- simulate(WBC,sampleT=50,start=1)
m <- l(WBC,WBC.data)
#tfplot(m)
WBC.f <- forecast(m,horizon=50)
tfplot(WBC.f)
AIC(m)