#
# Malthus Theoretical Model
#
require(dse)
require(matlab)
# Measurement Matrix
# K L Q QA
#[1,] 0.505 0.504 0.500 0.491
#[2,] -0.105 -0.213 -0.499 0.834
#
#Fraction of Variance
#[1] 0.98 1.00 1.00 1.00
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
f <- matrix( c( 1.04107567, -0.02550578, 0.177750815,
-0.02440285, 1.02300087, -0.005601134,
0.0000000, 0.0000000, 1.0000000
),byrow=TRUE,nrow=3,ncol=3)
h <- eye(2,3)
k <- f[1:3,1:2,drop=FALSE]
Malthus <- SS(F=f,H=h,K=k,z0=c( 0.177750815, -0.005601134, 1.0000000),
output.names=c("Growth","QA-Q-L"))
stability(Malthus)
shockDecomposition(toSSChol(Malthus))
#tfplot(simulate(Malthus,sampleT=50,noise=matrix(0,50,2),start=1))
Malthus.data <- simulate(Malthus,sampleT=50,start=1)
m <- l(Malthus,Malthus.data)
#tfplot(m)
Malthus.f <- forecast(m,horizon=50)
tfplot(Malthus.f)
AIC(m)