# Cut-and-paste code below into window above and Run
#
# Russia (RU) Model (1950-2000)
#
#
# Measurement Matrix (Growth), (L+Q-X), (Q-L-X)
# Q N XREAL X L
#[1,] 0.426 0.499 0.481 0.436 0.384
#[2,] 0.501 -0.148 -0.322 -0.502 0.609
#[3,] 0.578 0.242 0.116 -0.380 -0.670
#
# Fraction of Variance
#[1] 0.778 0.965 1.000 1.000 1.000
#
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.965721491, 0.09701327, 0.02827611, 0.09664265,
-0.061814596, 1.09932370, 0.01687737, -0.05077295,
-0.005273331, -0.09700021, 1.03531507, 0.03912558,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
#
# To stabilize model, uncomment the following line
# f[1,1] <- 0.918391529; f[2,2] <- 1.04544590; f[3,3] <- 0.98457433
#
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
RU_LM <- SS(F=f,H=h,K=k,z0=c(0.09664265, -0.05077295, 0.03912558, 1.0000000000),
output.names=c("RU1","RU2","RU3"))
print(RU_LM)
is.SS(RU_LM)
stability(RU_LM)
RU_LM.data <- simulate(RU_LM,sampleT=100,start=1950)
#RU_LM.data <- simulate(RU_LM,sampleT=100,noise=matrix(0,100,3),start=1950)
RU_LM.f <- forecast(l(RU_LM,RU_LM.data),horizon=150)
RU_LM.fx <- merge.forecast(RU_LM.f)
tfplot(RU_LM.f)
AIC(m <- l(RU_LM,RU_LM.data))
RU_LMx <- SS(F=f,H=h,Q=eye(4,3),R=eye(3,3),z0=c(0.329380291, 0.032283718, -0.006625928, 1.0000000000),
output.names=c("RU1","RU2","RU3"))
shockDecomposition(RU_LMx)
#
# LCI Parameter UCI P>=T[1] P< T[1] Std. Dev. Bias Bias-z
# [1,] 0.95418 0.965721 0.977383 0.35 0.65 0.01082 0.004502 0.4162
# [2,] -0.07619 -0.061815 -0.052261 0.40 0.60 0.01115 1.032161 92.5910
# [3,] -0.01582 -0.005273 0.006368 0.51 0.49 0.01021 0.970595 95.0490
# [4,] 0.07158 0.097013 0.126753 0.37 0.63 0.02531 0.873117 34.5002
# [5,] 1.05286 1.099324 1.163530 0.32 0.68 0.05513 -0.123951 -2.2482
# [6,] -0.14704 -0.097000 -0.062640 0.61 0.39 0.03802 1.064341 27.9974
# [7,] -0.04768 0.028276 0.098497 0.55 0.45 0.05614 0.934901 16.6530
# [8,] -0.07677 0.016877 0.112283 0.62 0.38 0.08108 0.930348 11.4743
# [9,] 0.97406 1.035315 1.111009 0.28 0.72 0.05432 -0.044889 -0.8263
#[10,] 0.07374 0.096643 0.118256 0.56 0.44 0.01938 0.866906 44.7228
#[11,] -0.08598 -0.050773 -0.024734 0.51 0.49 0.02829 1.020412 36.0723
#[12,] 0.02062 0.039126 0.061089 0.51 0.49 0.01827 0.922969 50.5248
#