#
# Cut-and-Paste Code Below into Window above and RUN
#
#
# BRL20 BAU Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
# (Growth) (LU+KOF-Q-HDI), (EF+HDI-CO2-Q)
#
# Measurement Matrix
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN
#[1,] 0.339 0.3378 0.3192 0.339
#[2,] 0.339 0.3626 0.5457 -0.284
#[3,] -0.007 0.0608 -0.0215 -0.165
# SP.POP.TOTL SL.UEM.TOTL.ZS EF KOF HDI
#[1,] 0.340 0.309 0.347 0.320 0.347
#[2,] -0.289 -0.358 0.164 -0.331 -0.164
#[3,] -0.120 0.824 0.111 -0.492 -0.145
#
# Fraction of Variance
#[1] 0.899 0.961 0.985 0.997 0.999 1.000 1.000 1.000 1.000
#
f <- matrix( c(0.993238443, 0.00581717, 0.1220870, 0.17435941,
-0.007223105, 0.98308109, 0.2380093, -0.03776851,
-0.020676347, 0.02142871, 1.0216750, -0.01023445
, 0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# Stabilize the (EF+HDI-CO2-Q) Controller, uncomment next line
# f[3,3] <- 0.97
# or Stabilize the System
# f[1,1] <- 0.954100885; f[2,2] <- 0.94434377; f[3,3] <- 0.9814170
#
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
BRL20 <- SS(F=f,H=h,K=k,z0=c(0.17435941, -0.03776851, -0.01023445, 1.0000000000),
output.names=c("BR1","BR2","BR3"))
print(BRL20)
is.SS(BRL20)
stability(m <- SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
# tfplot(simulate(BRL20,sampleT=100),start=1960)
BRL20.data <- simulate(BRL20,sampleT=150,noise=matrix(0,150,3),start=1960)
BRL20.f <- forecast(l(BRL20,BRL20.data),horizon=150)
tfplot(BRL20.f)