\HeaderA{multiecdf}{Multiple empirical cumulative distribution functions (ecdf) and densities}{multiecdf}
\aliasA{multidensity}{multiecdf}{multidensity}
\methaliasA{multidensity.formula}{multiecdf}{multidensity.formula}
\methaliasA{multidensity.list}{multiecdf}{multidensity.list}
\methaliasA{multidensity.matrix}{multiecdf}{multidensity.matrix}
\methaliasA{multiecdf.formula}{multiecdf}{multiecdf.formula}
\methaliasA{multiecdf.list}{multiecdf}{multiecdf.list}
\methaliasA{multiecdf.matrix}{multiecdf}{multiecdf.matrix}
\keyword{hplot}{multiecdf}
\begin{Description}\relax
Plot multiple empirical cumulative distribution functions (ecdf)
and densities with user interface similar to that of \code{\LinkA{boxplot}{boxplot}}.
\end{Description}
\begin{Usage}
\begin{verbatim}
multiecdf(x, ...)
## S3 method for class 'formula':
multiecdf(formula, data = NULL, xlab, na.action = NULL, ...)
## S3 method for class 'matrix':
multiecdf(x, xlab, ...) 
## S3 method for class 'list':
multiecdf(x,
          xlim,
          col = brewer.pal(9, "Set1"),
          main = "ecdf",
          xlab,
          do.points = FALSE,
          subsample = 1000L,
          legend = list(
            x = "right",
            legend = if(is.null(names(x))) paste(seq(along=x)) else names(x),
            fill = col),
          ...)

multidensity(x, ...)
## S3 method for class 'formula':
multidensity(formula, data = NULL, xlab, na.action = NULL, ...)
## S3 method for class 'matrix':
multidensity(x, xlab, ...) 
## S3 method for class 'list':
multidensity(x,
             bw = "nrd0",
             xlim,
             ylim,
             col  = brewer.pal(9, "Set1"),
             main = if(length(x)==1) "density" else "densities",
             xlab,
             lty  = 1L,
             legend = list(
               x = "topright",
               legend = if(is.null(names(x))) paste(seq(along=x)) else names(x),
               fill = col),
             ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{formula}] a formula, such as \code{y \textasciitilde{} grp}, where \code{y} is a
numeric vector of data values to be split into groups according to
the grouping variable \code{grp} (usually a factor).
\item[\code{data}] a data.frame (or list) from which the variables in
\code{formula} should be taken.
\item[\code{na.action}] a function which indicates what should happen
when the data contain \code{NA}s.  The default is to ignore missing
values in either the response or the group.
\item[\code{x}] a list of numeric vectors.
\item[\code{bw}] the smoothing bandwidth, see the manual page for
\code{\LinkA{density}{density}}. If \code{bw} is a character string specifying a rule to choose
the bandwidth, this rule is applied to \code{x[[1]]} and then
the same numerical value of \code{bw} is used throughout.
\item[\code{xlim}] Range of the x axis. If missing, the data range is used.
\item[\code{ylim}] Range of the y axis. If missing, the range of the density
estimates is used.
\item[\code{col, lty}] Line colors and line type.
\item[\code{main}] Plot title.
\item[\code{xlab}] x-axis label.
\item[\code{do.points}] logical; if \code{TRUE}, also draw points at the knot
locations.
\item[\code{subsample}] numeric or logical of length 1. If numeric, and
larger than 0, subsamples of that size are used to compute and plot
the ecdf for those elements of \code{x} with more than that number of
observations. If logical and \code{TRUE}, a value of 1000 is used for
the subsample size.
\item[\code{legend}] a list of arguments that is passed to the function \code{\LinkA{legend}{legend}}.
\item[\code{...}] Further arguments that get passed on to the \code{plot} functions.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The usefulness of \code{multidensity} can vary,
depending on the data and because of smoothing
artifacts. \code{multiecdf} will in many cases be preferable.
\end{Details}
\begin{Value}
For the \code{multidensity} functions, a list of \code{\LinkA{density}{density}} objects.
\end{Value}
\begin{Author}\relax
Wolfgang Huber \url{http://www.ebi.ac.uk/huber}
\end{Author}
\begin{SeeAlso}\relax
\code{\LinkA{boxplot}{boxplot}},
\code{\LinkA{ecdf}{ecdf}},
\code{\LinkA{density}{density}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  words = strsplit(packageDescription("geneplotter")$Description, " ")[[1]]
  factr = factor(sample(words, 2000, replace = TRUE))
  x = rnorm(length(factr), mean=as.integer(factr))
  
  multiecdf(x ~ factr)
  multidensity(x ~ factr)
\end{ExampleCode}
\end{Examples}

