#
# W_TEHCP Model
#
require(dse)
require(matlab)
#
# Measurement Matrix (Growth) (CO2-L-EG) (GDP-EG)
#
# CO2/N ENERGY/N GDP/N L/N
#[1,] 0.4700 0.510 0.505 0.514
#[2,] 0.8741 -0.257 -0.173 -0.374
#[3,] -0.0726 -0.584 0.797 -0.137
#
#Fraction of Variance
#[1] 0.910 0.974 0.999 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(0.96817312, -0.060960789, 0.02575199, 0.111676894,
0.03370081, 0.885425689, -0.08346997, -0.016321163,
0.01168767, 0.006258998, 0.97696007, -0.003205371,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To Destabilize, Uncomment Next Line
# f[1,1] <- 1.0
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
W_TECHP <- SS(F=f,H=h,K=k,z0=c( 0.111676894, -0.016321163, -0.003205371, 1.0000000000),
output.names=c("W_TECHP1","W_TECHP2","W_TECHP3"))
print(W_TECHP)
is.SS(W_TECHP)
stability(m0 <- SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
# tfplot(simulate(W_TECHP,sampleT=100))
W_TECHP.data <- simulate(W_TECHP,sampleT=150,noise=matrix(0,150,3))
W_TECHP.f <- forecast(l(W_TECHP,W_TECHP.data),horizon=150)
tfplot(W_TECHP.f)
AIC(l(W_TECHP,W_TECHP.data))
#
# Bootstrap Confidence Intervals (for Counterfactuals)
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias
# [1,] 0.946511 0.968173 0.9845117 0.54 0.46 0.020403 0.004475
# [2,] 0.019622 0.033701 0.0560111 0.40 0.60 0.016038 0.932319
# [3,] 0.007776 0.011688 0.0152782 0.66 0.34 0.004399 0.954454
# [4,] -0.142479 -0.060961 -0.0009618 0.45 0.55 0.060476 1.034557
# [5,] 0.810880 0.885426 0.9337396 0.25 0.75 0.048327 0.116487
# [6,] -0.011876 0.006259 0.0203304 0.63 0.37 0.013057 0.961116
# [7,] -0.047311 0.025752 0.0781469 0.61 0.39 0.063464 0.924585
# [8,] -0.164619 -0.083470 -0.0312767 0.60 0.40 0.060100 1.055828
# [9,] 0.958953 0.976960 1.0000620 0.31 0.69 0.017894 -0.004245
#[10,] 0.097031 0.111677 0.1287000 0.53 0.47 0.017757 0.850930
#[11,] -0.040915 -0.016321 -0.0020797 0.58 0.42 0.015734 0.987401
#[12,] -0.008881 -0.003205 0.0030451 0.62 0.38 0.005412 0.970550
#
#
#
# W_TEHCE Model
#
require(dse)
require(matlab)
#
# Measurement Matrix # (L/N+GDP/L -CO2/EG) (EG/GDP - GDP/L - CO2-EG) (Growth)
# CO2/EG ENERGY/GDP GDP/L L/N
#[1,] -0.557 0.119 0.554 0.607
#[2,] -0.333 0.851 -0.390 -0.117
#[3,] 0.747 0.409 0.100 0.514
#
# Fraction of Variance
#[1] 0.646 0.973 0.997 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(0.87076812, -0.06501580, 0.10773054, 0.12675405,
-0.12038820, 0.93048034, 0.06171777, 0.02963129,
0.05959062, 0.06260574, 0.74239631, -0.01976526,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
W_TECHE <- SS(F=f,H=h,K=k,z0=c( 0.111676894, -0.016321163, -0.003205371, 1.0000000000),
output.names=c("W_TECHE1","W_TECHE2","W_TECHE3"))
print(W_TECHE)
is.SS(W_TECHE)
stability(m0 <- SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
# tfplot(simulate(W_TECHE,sampleT=100))
W_TECHE.data <- simulate(W_TECHE,sampleT=150,noise=matrix(0,150,3))
W_TECHE.f <- forecast(l(W_TECHE,W_TECHE.data),horizon=150)
tfplot(W_TECHE.f)
AIC(l(W_TECHE,W_TECHE.data))
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias Bias-z
# [1,] 0.806350 0.87077 0.916420 0.62 0.38 0.04186 -0.002905 -0.0694
# [2,] -0.165486 -0.12039 -0.081967 0.61 0.39 0.03509 0.988353 28.1639
# [3,] 0.036269 0.05959 0.087764 0.24 0.76 0.02064 0.821009 39.7786
# [4,] -0.117343 -0.06502 -0.024545 0.65 0.35 0.03903 0.931869 23.8774
# [5,] 0.886157 0.93048 0.964741 0.65 0.35 0.03097 -0.063678 -2.0564
# [6,] 0.038565 0.06261 0.089118 0.32 0.68 0.01964 0.814284 41.4622
# [7,] -0.138722 0.10773 0.370639 0.42 0.58 0.19636 0.793212 4.0397
# [8,] -0.123740 0.06172 0.273157 0.38 0.62 0.16209 0.841100 5.1891
# [9,] 0.580240 0.74240 0.860852 0.57 0.43 0.09317 0.111890 1.2009
#[10,] 0.102366 0.12675 0.151908 0.46 0.54 0.02108 0.743994 35.2936
#[11,] 0.006862 0.02963 0.056730 0.33 0.67 0.02003 0.847545 42.3052
#[12,] -0.035067 -0.01977 -0.007933 0.72 0.28 0.01107 0.886298 80.0921
#