multiecdf {geneplotter} | R Documentation

## Multiple empirical cumulative distribution functions (ecdf) and densities

### Description

Plot multiple empirical cumulative distribution functions (ecdf) and densities with user interface similar to that of `boxplot`.

### Usage

    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),
                 ...)

### Arguments

`formula` | a formula, such as `y ~ grp`, where `y` is a numeric vector of data values to be split into groups according to the grouping variable `grp` (usually a factor).
`data` | a data.frame (or list) from which the variables in `formula` should be taken.
`na.action` | a function which indicates what should happen when the data contain `NA`s. The default is to ignore missing values in either the response or the group.
`x` | a list of numeric vectors.
`bw` | the smoothing bandwidth, see the manual page for `density`. If `bw` is a character string specifying a rule to choose the bandwidth, this rule is applied to `x[[1]]` and then the same numerical value of `bw` is used throughout.
`xlim` | Range of the x axis. If missing, the data range is used.
`ylim` | Range of the y axis. If missing, the range of the density estimates is used.
`col, lty` | Line colors and line type.
`main` | Plot title.
`xlab` | x-axis label.
`do.points` | logical; if `TRUE`, also draw points at the knot locations.
`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 `x` with more than that number of observations. If logical and `TRUE`, a value of 1000 is used for the subsample size.
`legend` | a list of arguments that is passed to the function `legend`.
`...` | Further arguments that get passed on to the `plot` functions.

### Details

The usefulness of `multidensity` can vary, depending on the data and because of smoothing artifacts. `multiecdf` will in many cases be preferable.

### Value

For the `multidensity` functions, a list of `density` objects.

### Author(s)

Wolfgang Huber http://www.ebi.ac.uk/huber

### See Also

`boxplot`, `ecdf`, `density`

### Examples

      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)

[Package geneplotter version 1.22.0 Index]