# Cut-and-Paste Code below into window above and Run
#
# LA_RE Latin Model Ro Americaman Empire (RE)
#
# Measurement Matrix
# Q N
#[1,] 0.707 0.707
#[2,] 0.707 -0.707
#
# Fraction of Variance
#[1] 1 1
#
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)
f <- matrix( c( 0.9970863167, 0.1270588, -8.995648e-03,
-0.0001328661, 1.0004016, 5.296195e-06,
0.000000000, 0.00000000, 1.0000000000)
,byrow=TRUE,nrow=3,ncol=3)
# To create Malthusian Random Walk uncomment next line
# f[2,2] <- 1
h <- eye(2,3)
k <- (f[,1:2,drop=FALSE])
LA_RE <- SS(F=f,H=h,K=k,z0=c(-8.995648e-03, 5.296195e-06, 1.0000000000),
output.names=c("LA1","LA2"))
print(LA_RE)
is.SS(LA_RE)
stability(LA_RE)
tfplot(LA_RE.data <- simulate(LA_RE,sampleT=250,start=0))
#LA_RE.data <- simulate(LA_RE,sampleT=20,noise=matrix(0,20,2))
LA_RE.f <- forecast(m <- l(LA_RE,LA_RE.data),horizon=500)
tfplot(LA_RE.f)
AIC(m)
shockDecomposition(toSSChol(m))