#
# W_L16 Model (1450-1640) (Cut-and-paste code below into widow above and Run)
#
#
# Measurement Matrix (Growth-T), (Q+T), (Q-N)
# Q N T
#[1,] 0.576 0.5831 -0.573
#[2,] 0.651 0.0971 0.753
#[3,] 0.495 -0.8066 -0.324
#
# Fraction of Variance
#[1] 0.98 1.00 1.00
#
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.9943698154, 0.030771900, 0.3589261, 0.0274095487,
-0.0043335350, 1.022279770, 0.2692689, -0.0030295812,
-0.0001074497, -0.002679999, 0.9905856, 0.0003015236,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
W16 <- SS(F=f,H=h,K=k,z0=c( 0.0274095487, -0.0030295812, 0.0003015236, 1.0000000000),
output.names=c("W1","W2","W3"))
print(W16)
is.SS(W16)
stability(W16)
# tfplot(simulate(W16,sampleT=200))
#W16.data <- simulate(W16,sampleT=200,noise=matrix(0,200,3))
W16.data <- simulate(W16,sampleT=200,start=1450)
W16.f <- forecast(l(W16,W16.data),horizon=200)
W16.fx <- merge.forecast(W16.f)
tfplot(W16.f)
tfplot(W16.fx)
AIC(m <- l(W16,W16.data))
shockDecomposition(toSSChol(m))
#
# UK_L16 Model (1450-1640)
#
#
# Measurement Matrix # Growth-X, U-N, Q-N-X
# Q N U X
#[1,] 0.510 0.503 0.479 -0.508
#[2,] -0.142 -0.426 0.859 0.247
#[3,] 0.450 -0.752 -0.168 -0.452
#
# Fraction of Variance
#[1] 0.96 1.00 1.00 1.00
#
AIC <- function(model) {informationTestsCalculations(model)[3]}
require(dse)
require(matlab)
f <- matrix( c(0.3749532, 0.1757394, -1.0699375, 0.013217902,
0.4970505, 0.0668996, -0.6613563, 0.017665464,
-0.0548479, -0.1301666, 0.6326730, -0.001843322,
0.00000000, 0.0000000, 0.0000000, 1.0000000000
),byrow=TRUE,nrow=4,ncol=4)
h <- eye(3,4)
k <- (f[,1:3,drop=FALSE])
g <- matrix( c(0.70041750 ,-1.1378645, 1.26900651,
-0.60351901, -0.3612391, 0.08764014,
0.05008032, -0.3274105, 0.30999415,
0.00000000, 0.0000000, 0.00000000
),byrow=TRUE,nrow=4,ncol=3)
#
UKL16 <- SS(F=f,H=h,K=k,G=g,z0=c( -2.0777797, 2.0079639, -0.1168527 , 1.0000000000),
output.names=c("UK1","UK2","UK3"))
print(UKL16)
is.SS(UKL16)
stability(UKL16)
UKL16.data <- simulate(UKL16,sampleT=190,input=W16.fx)
data <- TSdata(output=outputData(UKL16.data),input=window(W16.fx,end=1640))
m <- l(UKL16,data)
UKL16.f <- forecast(m,horizon=190)
tfplot(UKL16.f)