# Cut-and-Paste Code Below into Window Above an Run
#
# LA_E20 Model
#
# Measurement Matrix (Growth), (Q-XREAL-X), (N-XREAL-Q)
#
# Q N XREAL X
#[1,] 0.486 0.5062 0.501 0.50591
#[2,] 0.839 -0.0625 -0.453 -0.29580
#[3,] -0.244 0.7872 -0.566 0.00801
#
# Fraction of Variance
#[1] 0.966 0.996 1.000 1.000
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c( 1.06209533, 0.13640308, -0.1213930, 0.161979861,
0.01504293, 0.98769266, 0.2341202, -0.001127714,
-0.01330313, -0.07278229, 1.1405996, -0.011660469,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To create a Stable model, uncomment following line
# f[1,1] <- f[2,2] <- f[3,3] <- 0.9
#
# To create a RWf model, uncomment following line
# f[1,1] <- f[2,2] <- f[3,3] <- 1
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
LA_E20 <- SS(F=f,H=h,K=k,z0=c( 0.161979861, -0.001127714, -0.011660469, 1.0000000000),
output.names=c("LA1","LA2","LA3"))
print(LA_E20)
is.SS(LA_E20)
stability(m0 <- SS(F=f[1:3,1:3,drop=FALSE],Q=eye(3),R=eye(3),H=eye(3)))
# LA_E20.data <- simulate(LA_E20,sampleT=50,start=1900)
LA_E20.data <- simulate(LA_E20,sampleT=50,noise=matrix(0,50,3),start=1900)
LA_E20.f <- forecast(m <- l(LA_E20,LA_E20.data),horizon=50)
tfplot(LA_E20.f)
AIC(m)
shockDecomposition(m0,horizon=10,shock=rep(-1,10))