#
# Smith Small Country (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)
#
f <- matrix( c( -5.507190e-15, 0, 0, 0.51,
-4.130392e-15, 0, 0 ,0.52,
-6.883987e-15, 0, 0 ,0.53,
0.00000000, 0.0000000, 0, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# For Random Walk, Uncomment following line
# f <- eye(4)
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
Smith <- SS(F=f,H=h,K=k,z0=c(0.51, 0.52 ,0.53, 1.0000000000),
output.names=c("Smith1","Smith2","Smith3"))
print(Smith)
is.SS(Smith)
stability(SS(F=f[1:3,1:3,drop=FALSE],H=eye(3),Q=eye(3),R=eye(3)))
#
#
Smith.data <- simulate(Smith,sampleT=100,start=1)
Smith.f <- forecast(l(Smith,Smith.data),horizon=150)
tfplot(Smith.f)
AIC(l(Smith,Smith.data))