View source: R/quantileBands.R
quantileBands | R Documentation |
Quantile bands with optional smoothing, e.g. for visualizing simulations
quantileBands(
mat,
x = 1:ncol(mat),
col = rgb(0, 0, 1, alpha = c(0.5, 0.7)),
add = FALSE,
main = "Quantile Bands",
ylab = "",
xlab = "",
probs = 0:4/4,
na.rm = FALSE,
type = 7,
smooth = NA,
medargs = NULL,
meanargs = NULL,
txi,
textargs = NULL,
...
)
mat |
Matrix or data.frame with columns of data |
x |
X-axis positions for each column. DEFAULT: 1:ncol(mat) |
col |
Vector of colors for each quantile group, recycled reversely if necessary. DEFAULT: rgb(0,0,1, alpha=c(0.5, 0.7)) |
add |
Add to existing plot? Allows to add to highly customized plot. DEFAULT: FALSE |
main , xlab , ylab |
plot labels. DEFAULT: "Quantile Bands", "" |
probs |
Probabilities passed to |
na.rm |
Remove NAs before computing |
type |
Which of the 9 |
smooth |
If(!is.na), |
medargs |
List of arguments passed to lines drawing |
meanargs |
List of arguments passed to lines drawing |
txi |
Text x position index (along columns of mat), recycled if necessary. NA to suppress. INTERNAL DEFAULT: middle of the plot for all. |
textargs |
List of arguments passed to |
... |
Further arguments passed to |
Quantiles of each column, invisible. Smoothed if smooth
is given!
This is the first version and is not tested very well yet.
Berry Boessenkool, berry-b@gmx.de, Sept 2014
quantile
, quantileMean
, ciBand
,
polygon
, https://cran.r-project.org/package=fanplot
neff <- t(replicate(n=30, sapply(1:400, function(nn) max(rnorm(nn))) ))
qB <- quantileBands(neff, x=1:400)
qB[,1:9]
quantileBands(neff, smooth=19, meanargs=list(col=2), txi=NA)
library(RColorBrewer)
quantileBands(neff, smooth=35, ylab="max of rnorm(n)",
xlab="sample size (n)", probs=0:10/10, col=brewer.pal(5,"BuGn"),
medargs=list(lwd=2), meanargs=list(col=2, lty=1), txi=c(40,50,60),
main="Maximum is an unsaturated statistic:\n it rises with sample size")
neff2 <- t(replicate(n=50, sapply(1:400, function(nn) mean(rnorm(nn))) ))
quantileBands(neff2, x=1:400, smooth=35, ylab="mean of rnorm(n)",
xlab="sample size (n)", probs=0:10/10, col=brewer.pal(5,"BuGn"),
txi=c(40,50,60), textargs=list(col="yellow"), medargs=list(lwd=2),
meanargs=list(col=2, lty=1), main="Mean converges to true population mean")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.