Description Usage Arguments Value Author(s) See Also Examples

The `fanplot()`

function in surveillance wraps functionality of
the dedicated fanplot package, employing a different default style
and optionally adding point predictions and observed values.

1 2 3 4 |

`quantiles` |
a time x |

`probs` |
numeric vector of probabilities with values between 0 and 1. |

`means` |
(optional) numeric vector of point forecasts. |

`observed` |
(optional) numeric vector of observed values. |

`start` |
time index (x-coordinate) of the first prediction. |

`fan.args` |
a list of graphical parameters for the |

`means.args` |
a list of graphical parameters for |

`observed.args` |
a list of graphical parameters for |

`key.args` |
if a list, a color key (in |

`xlim,ylim` |
axis ranges. |

`log` |
a character string specifying which axes are to be logarithmic,
e.g., |

`xlab,ylab` |
axis labels. |

`add` |
logical indicating if the fan plot should be added to an existing plot. |

`...` |
further arguments are passed to |

`NULL`

(invisibly), with the side effect of drawing a fan chart.

Sebastian Meyer

the underlying `fan`

function in package
fanplot.
The function is used in `plot.oneStepAhead`

and
`plot.hhh4sims`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
## artificial data example to illustrate the graphical options
if (requireNamespace("fanplot")) {
means <- c(18, 19, 20, 25, 26, 35, 34, 25, 19)
y <- rlnorm(length(means), log(means), 0.5)
quantiles <- sapply(1:99/100, qlnorm, log(means), seq(.5,.8,length.out=length(means)))
## default style with point predictions, color key and log-scale
fanplot(quantiles = quantiles, probs = 1:99/100, means = means,
observed = y, key.args = list(start = 1, space = .3), log = "y")
## with contour lines instead of a key, and different colors
pal <- colorRampPalette(c("darkgreen", "gray93"))
fanplot(quantiles = quantiles, probs = 1:99/100, observed = y,
fan.args = list(fan.col = pal, ln = c(5,10,25,50,75,90,95)/100),
observed.args = list(type = "b", pch = 19))
}
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.