Description Usage Arguments Details Value Examples
This function computes the residual variance in the forecast interval
1 | compute_score(x, n = 10, erup.i = NULL, skill = NULL)
|
x |
data vector, time series |
n |
length of prediction interval (defaults to 10 years) |
erup.i |
indices in x with eruptions |
skill |
vector of skills of forecast (see details) |
to be written
array of forecast scores
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## set up a time series of pseudo-observations and plot
xx <- rnorm(200)
erup.i <- sort(ceiling(runif(3, min=0, max=length(xx))))
xcolour <- rep(1, length(xx))
before.i <- outer(erup.i, 1:before, '-') ## check whether this is right
after.i <- outer(erup.i, 1:after, '+') ## check whether this is right
xcolour[after.i[after.i > 0 & after.i <= length(xx)]] <- 2
xcolour[before.i[before.i > 0 & before.i <= length(xx)]] <- 3
plot(xx, type='b', xlab='time', ylab='temperature', col=xcolour)
abline(v=erup.i, lty=3)
## compute the scores
fscore <- compute_score(xx, n=10, erup.i=erup.i, skill=skill.init)
vol.i <- outer(erup.i, 1:n, '-')
vol.i <- vol.i[vol.i > 0 & vol.i <= ncol(fscore)]
novol.i <- setdiff(seq(along=xx), vol.i)
novol.i <- novol.i[novol.i > 0 & novol.i <= ncol(fscore)]
hist(fscore[1,novol.i,50], freq=F, col='grey', xlim=range(pretty(fscore[1,,])))
hist(fscore[1,vol.i,], freq=F, add=T, density=15)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.