#
# Marx Steady State (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 (L+K+KU-i-R) (i+KU-K-R) (Growth)
# K i LU R KU
#[1,] 0.427 -0.416 0.4947 -0.435 0.459
#[2,] -0.528 0.561 0.1465 -0.500 0.368
#[3,] 0.480 0.578 0.0987 0.488 0.432
#
# Fraction of Variance
#[1] 0.798 0.968 0.986 0.999 1.000
#
f <- matrix( c(0.96953603, -0.08816104, 0.2053904, 0.13952039,
0.07085047, 0.91633408, -0.3942239, -0.03678521,
-0.02344302 , 0.09912290, 0.6630393, 0.03192651,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
Marx <- SS(F=f,H=h,K=k,z0=c(.13952039, -0.03678521, 0.03192651, 1.0000000000),
output.names=c("Marx1","Marx2","Marx3"))
print(Marx)
is.SS(Marx)
stability(SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
# tfplot(simulate(Marx,sampleT=100))
Marx.data <- simulate(Marx,sampleT=100,noise=matrix(0,100,3))
Marx.f <- forecast(l(Marx,Marx.data),horizon=150)
tfplot(Marx.f)
AIC(l(Marx,Marx.data))