WL203 Model
#
# WL203 Model (Cut-and-Paste code into window above and Run (Cmd-Enter)
#
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]}
require(dse)
require(matlab)
#Measurement Matrix
# N OIL QA GWP P.Wheat. P.Oil. TEMP CO2
#[1,] 0.2845 0.271 0.2821 0.2824 0.236 0.243 0.251 0.2837
#[2,] -0.0161 0.241 0.0985 -0.1413 0.411 0.066 -0.235 -0.0983
#[3,] -0.1112 -0.241 -0.0883 0.0213 0.461 0.712 0.190 -0.0201
# Carbon TotalFootprint Earths WorldGlobal LivingPlanet URBAN
#[1,] 0.2833 0.275 0.279 0.2819 -0.1839 0.2840
#[2,] 0.0925 0.182 0.148 -0.0926 0.7705 -0.0868
#[3,] -0.0955 -0.293 -0.231 -0.0943 -0.0576 -0.0707
#
# Fraction of Variance
# [1] 0.874 0.941 0.973 0.986 0.995 0.998 0.999 0.999 1.000 1.000 1.000
#[12] 1.000 1.000 1.000
#
f <- matrix( c(1.01169571, -0.02519461, -0.09358484, 0.210941578,
-0.01360718, 0.96330129, -0.05250691, -0.003862528,
0.02303607, -0.03631204, 0.93554760, 0.018115378,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
WL203 <- SS(F=f,H=h,K=k,z0=c( 0.210941578, -0.003862528, 0.018115378, 1.0000000000),
output.names=c("W1","W2","W3"))
print(WL203)
is.SS(WL203)
stability(WL203)
# tfplot(simulate(WL203,sampleT=100,start=1950))
WL203.data <- simulate(WL203,sampleT=150,noise=matrix(0,20,3),start=1950)
WL203.f <- forecast(m <- l(WL203,WL203.data),horizon=150)
# tfplot(WL203.f)
AIC(m)
WL20.fx <- merge.forecast(WL203.f)
tfplot(WL20.fx)
#
# Bootstrap Confidence Intervals
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias
# [1,] 0.996281 1.011696 1.027796 0.41 0.59 0.011032 0.00253
# [2,] -0.023932 -0.013607 -0.007148 0.29 0.71 0.006500 1.02938
# [3,] 0.014406 0.023036 0.030886 0.28 0.72 0.007194 0.99241
# [4,] -0.070961 -0.025195 0.016253 0.51 0.49 0.036336 1.03464
# [5,] 0.940930 0.963301 0.989088 0.42 0.58 0.019651 0.05109
# [6,] -0.070752 -0.036312 -0.008523 0.53 0.47 0.025045 1.05212
# [7,] -0.173415 -0.093585 -0.027504 0.32 0.68 0.055408 1.13162
# [8,] -0.106033 -0.052507 -0.008567 0.19 0.81 0.039006 1.09648
# [9,] 0.885856 0.935548 0.976298 0.04 0.96 0.039195 0.13638
#[10,] 0.192503 0.210942 0.232887 0.55 0.45 0.019344 0.79731
#[11,] -0.024368 -0.003863 0.013228 0.32 0.68 0.015423 1.02289
#[12,] -0.008279 0.018115 0.041528 0.34 0.66 0.020164 1.00146
#