cbplot function

Plot a function together with its confidence/credible bands

Plot a function together with its confidence/credible bands

This routine typically plots a function together with its confidence or credible bands. The credible band can be indicated either by additional lines or by a shaded region or by both.

cbplot(x, y, low, upp, type=c("l", "s"), band.type=c("ls", "s", "l"), add=FALSE, col="darkblue", lty=1, lwd=2, cbcol=col, cblty=4, cblwd=lwd, scol=rainbow_hcl(1, start=180, end=180), slwd=5, xlim, ylim, xlab, ylab, main="", sub="", cex.lab=1, cex.axis=1, ...)

Arguments

  • x: a numeric vector with x coordinates corresponding to y, low, upp.
  • y: a numeric vector with y coordinates of the function to plot.
  • low: a numeric vector with y coordinates of the lower limit of the credible band.
  • upp: a numeric vector with y coordinates of the upper limit of the credible band.
  • type: argument with the same meaning as type in plot.default.
  • band.type: a character which specifies the graphical way to show the credible band, ls stands for line and shaded region, s stands for shaded region only and l stands for line only.
  • add: if TRUE then everything is added to the current plot.
  • col, lty, lwd: graphical paramters to draw the x-y line.
  • cbcol, cblty, cblwd: graphical parameters to draw the x-low and x-upp lines.
  • scol, slwd: graphical parameters for the shaded region between the credible/confidence bounds.
  • xlim, ylim, xlab, ylab, main, sub, cex.lab, cex.axis: other graphical parameters.
  • ...: additional arguments passed to the plot function.

Returns

invisible(x)

Author(s)

Arnošt Komárek arnost.komarek@mff.cuni.cz

Examples

### Artificial credible bands around the CDF's of N(100, 15*15) ### and N(80, 10*10) iq <- seq(55, 145, length=100) Fiq <- pnorm(iq, 100, 15) low <- Fiq - 0.1 upp <- Fiq + 0.1 iq2 <- seq(35, 125, length=100) Fiq2 <- pnorm(iq, 80, 10) low2 <- Fiq2 - 0.1 upp2 <- Fiq2 + 0.1 cbplot(iq, Fiq, low, upp, xlim=c(35, 145)) cbplot(iq2, Fiq2, low2, upp2, add=TRUE, col="red4", scol=rainbow_hcl(1, start=20, end=20))