#
# Schumpeter Creative Destruction (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 Overall-LU, K-L, LU+L
# K L LU Q
#[1,] 0.4994 0.493 -0.494 0.5138
#[2,] 0.5887 -0.520 0.481 0.3890
#[3,] -0.0457 0.683 0.724 0.0863
#
# Fraction of Variance
#[1] 0.905 0.974 0.999 1.000
#
f <- matrix( c(0.96659450, 0.8879447, -0.5765285, -0.02149930,
-0.05150088, 1.0468559, -0.1200482, -0.04436213,
0.01647038, 0.1103709, 0.9180243, -0.01022407,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize Model, Uncomment following Line
# f[2,2] <- 0.95
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
Schumpeter <- SS(F=f,H=h,K=k,z0=c(-0.02149930, -0.04436213, -0.01022407, 1.0000000000),
output.names=c("CD1","CD2","CD3"))
print(Schumpeter)
is.SS(Schumpeter)
stability(SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
# tfplot(simulate(Schumpeter,sampleT=100))
Schumpeter.data <- simulate(Schumpeter,sampleT=100,noise=matrix(0,100,3))
Schumpeter.f <- forecast(l(Schumpeter,Schumpeter.data),horizon=150)
tfplot(Schumpeter.f)
AIC(l(Schumpeter,Schumpeter.data))