#
# ARL20 BAU Model (Cut-and-paste following code into window above and Run (Cmd-Enter))
#
# Measurement Matrix (Growth-EF), (LU+EF-Q), (EF+HDI+CO2-KOF-LU)
#
# EN.ATM.CO2E.KT EG.USE.COMM.KT.OE NY.GDP.MKTP.KD SL.TLF.TOTL.IN
#[1,] 0.344 0.349 0.345 0.35265
#[2,] -0.194 -0.141 -0.178 -0.00772
#[3,] 0.352 -0.124 0.139 0.10226
# SP.POP.TOTL SL.UEM.TOTL.ZS KOF EF HDI
#[1,] 0.350 0.286 0.331 -0.288 0.3457
#[2,] 0.109 0.656 0.323 0.600 0.0583
#[3,] 0.146 -0.238 -0.456 0.559 0.4827
#
# Fraction of Variance
#[1] 0.883 0.968 0.988 0.995 0.997 0.999 0.999 1.000 1.000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c( 1.02363961, -0.01940207, -0.01209545, 0.20427418,
-0.03587959, 1.01618492, 0.07421950, -0.05457570,
-0.01008192, -0.01054417, 0.87855680, 0.01145055,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# Stabilize (un-comment following line
# f[1,1] <- 0.91 ; f[2,2] <- 0.75 ; f[3,3] <- 0.66 # World-System Input
# f[1,1] <- 0.90 ; f[2,2] <- 0.99 ; f[3,3] <- 0.66 # US Input
# f[1,1] <- 0.67 ; f[2,2] <- 0.48 ; f[3,3] <- 0.74 # LAC Input
# f[1,1] <- 0.97 ; f[2,2] <- 0.96 ; f[3,3] <- 0.83 # Steady State
# f[1,1] <- f[2,2] <- f[3,3] <- 1 # Random Walk w/fb drift
#
# f[2,3] <- 0.5 ; f[3,2] <- -0.5 # Improbable Feedback Effects
# f[2,3] <- 0.1534126 ; f[3,2] <- -0.0260649 # Probable Feedback
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
ARL20 <- SS(F=f,H=h,K=k,z0=c( 0.20427418, -0.05457570, 0.01145055, 1.0000000000),
output.names=c("AR1","AR2","AR"))
print(ARL20 )
is.SS(ARL20 )
stability(m0 <- SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3),output.names=c("AR1","AR2","AR3")) )
#
# Uncomment for RW or N(0,1) Error
# tfplot(ARL20.data <- simulate(ARL20 ,sampleT=100, start=1960))
#
# Comment out following line for RW or N(0,1) Error
ARL20.data <- simulate(ARL20 ,sampleT=100,noise=matrix(0,100,3),start=1960)
ARL20.f <- forecast(l(ARL20 ,ARL20.data),horizon=100)
tfplot(ARL20.f)
AIC(m <- l(ARL20 ,ARL20.data))
shockDecomposition(m0)
#
# Bootstrap Confidence Intervals on System Matrix Coefficients
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias
# [1,] 1.0050314 1.02364 1.0446273 0.33 0.67 0.017197 0.003241
# [2,] -0.0523717 -0.03588 -0.0234874 0.53 0.47 0.018435 1.061632
# [3,] -0.0194893 -0.01008 -0.0043789 0.46 0.54 0.006085 1.035892
# [4,] -0.0998499 -0.01940 0.0446680 0.73 0.27 0.066414 1.020095
# [5,] 0.9595890 1.01618 1.0898815 0.24 0.76 0.083708 0.032752
# [6,] -0.0260649 -0.01054 0.0007147 0.38 0.62 0.012116 1.036701
# [7,] -0.1192665 -0.01210 0.0802624 0.41 0.59 0.074696 1.047748
# [8,] 0.0004819 0.07422 0.1534126 0.73 0.27 0.062934 0.911983
# [9,] 0.8056733 0.87856 0.9258109 0.45 0.55 0.045288 0.160712
#[10,] 0.1883736 0.20427 0.2300371 0.54 0.46 0.019603 0.812596
#[11,] -0.0860795 -0.05458 -0.0279077 0.52 0.48 0.029330 1.078579
#[12,] -0.0014950 0.01145 0.0255517 0.57 0.43 0.011638 1.008999
#