#
# Leibenstein Controller Model (Cut an paste code in window above and Run (Cmd-Enter)
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
# Measurement Matrix
# I II III IV -I
#[1,] 0.390 -0.552 0.293 0.552 -0.390
#[2,] 0.522 0.208 -0.608 -0.208 -0.522
#[3,] 0.274 0.390 0.738 -0.390 -0.274
#
# Fraction of Variance
#[1] 0.599 0.998 1.000 1.000 1.000#
f <- matrix( c( 0.85607762, -0.02092552, -0.3234873, 0.274825740,
-0.20393218, 1.13860151, -0.6416047, -0.105147205,
0.01733743 , 0.01928882, 0.7730030, -0.009853891,
0.00000000, 0.00000000, 0.0000000, 1.000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
LMc <- SS(F=f,H=h,K=k,z0=c( 0.274825740, -0.105147205, -0.009853891, 1.000000000),
output.names=c("LM1","LM2","LM3"))
print(LMc)
is.SS(LMc)
stability(LMc)
n <- 20
LMc.data <- simulate(LMc,sampleT=n,noise=matrix(0,n,3),start=1)
LMc.data2 <- simulate(LMc,sampleT=n,start=1)
tfplot(LMc.data)
AIC(l(LMc,LMc.data))
tfplot(LMc.data2)
AIC(l(LMc,LMc.data2))
shockDecomposition(toSSChol(LMc))