spec = arfimaspec( mean.model = list(armaOrder = c(2,2), include.mean = TRUE,
arfima = FALSE), distribution.model = "norm", fixed.pars = list(ar1=0.6,
ar2=0.21, ma1=-0.7, ma2=0.3, mu = 0.02, sigma = 0.02))
dist = arfimadistribution(spec, n.sim = 2000, n.start = 100, m.sim = 100,
recursive = TRUE, recursive.length = 10000, recursive.window = 1000)
# slots:
slotNames(dist)
# methods:
# summary
show(dist)
# as.data.frame(...., window, which=c("rmse", "stats", "coef", "coefse"))
# default
as.data.frame(dist)
as.data.frame(dist, window = 1, which = "rmse")
as.data.frame(dist, window = 1, which = "stats")
as.data.frame(dist, window = 1, which = "coef")
as.data.frame(dist, window = 1, which = "coefse")
as.data.frame(dist, window = 8, which = "rmse")
as.data.frame(dist, window = 8, which = "stats")
as.data.frame(dist, window = 8, which = "coef")
as.data.frame(dist, window = 8, which = "coefse")
# create some plots
#
nwindows = dist@dist$details$nwindows
# 2000/3000/4000/5000/6000/7000/8000/9000/10000
# expected reduction factor in RMSE for sqrt(N) consistency
expexcted.rmsegr = sqrt(2000/seq(3000,10000,by=1000))
# actual RMSE reduction
actual.rmsegr = matrix(NA, ncol = 8, nrow = 6)
rownames(actual.rmsegr) = c("mu", "ar1", "ar2", "ma2", "ma2", "sigma")
# start at 2000 (window 1)
rmse.start = as.data.frame(dist, window = 1, which = "rmse")
for(i in 2:nwindows) actual.rmsegr[,i-1] = as.numeric(as.data.frame(dist,
window = i, which = "rmse")/rmse.start)
par(mfrow = c(2,3))
for(i in 1:6){
plot(seq(3000,10000,by=1000),actual.rmsegr[i,], type = "l", lty = 2,
ylab = "RMSE Reduction", xlab = "N (sim)",main = rownames(actual.rmsegr)[i])
lines(seq(3000,10000,by=1000), expexcted.rmsegr, col = 2)
legend("topright", legend = c("Actual", "Expected"), col = 1:2, bty = "m",
lty = c(2,1))
}
Run the code above in your browser using DataLab