# Cut-and-Paste Code Below into Window Above and Run
#
# WL20 World Model
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
#
# Measurement Matrix (Growth-LP) (LP + P.Wheat + OIL) (P.OIL. + P.Wheat. - EF)
#
# N OIL QA GWP P.Wheat. P.Oil. TEMP CO2 Carbon
#[1,] 0.2845 0.271 0.2821 0.2824 0.236 0.243 0.251 0.2837 0.2833
#[2,] -0.0161 0.241 0.0985 -0.1413 0.411 0.066 -0.235 -0.0983 0.0925
#[3,] -0.1112 -0.241 -0.0883 0.0213 0.461 0.712 0.190 -0.0201 -0.0955
# TotalFootprint Earths WorldGlobal LivingPlanet URBAN
#[1,] 0.275 0.279 0.2819 -0.1839 0.2840
#[2,] 0.182 0.148 -0.0926 0.7705 -0.0868
#[3,] -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 1.000
#[13] 1.000 1.000
#
f <- matrix( c(1.000000000, 0.00000000, 0.00000000, 0.00000000,
0.210941578, 1.01169571, -0.02519461, -0.09358484,
-0.003862528, -0.01360718, 0.96330129, -0.05250691,
0.018115378, 0.02303607, -0.03631204, 0.935547600
),byrow=TRUE,nrow=4,ncol=4)
h <- matrix(c(0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
),byrow=TRUE,nrow=3,ncol=4)
k <- (f[1:4,2:4,drop=FALSE])
WL20 <- SS(F=f,H=h,K=k,z0=c(1.0000000, -5.3541066, -0.7239263, 0.7703831),
output.names=c("W1","W2","W3"))
print(WL20)
is.SS(WL20)
stability(SS(F=f[2:4,2:4,drop=FALSE],R=eye(3),Q=eye(3),H=eye(3)))
# tfplot(simulate(WL20,sampleT=100))
WL20.data <- simulate(WL20,sampleT=50,noise=matrix(0,50,3),start=1950)
WL20.f <- forecast(l(WL20,WL20.data),horizon=150)
tfplot(WL20.f)
AIC(l(WL20,WL20.data))