shorth {genefilter}R Documentation

Midpoint of the shorth

Description

Calculate the midpoint of the shorth

Usage

shorth(x, na.rm=FALSE, tie.action="mean", tie.limit=0.05)

Arguments

x Numeric
na.rm Logical. If TRUE, then NA values are ignored.
tie.action Character scalar. See details.
tie.limit Numeric scalar. See details.

Details

The shorth is the shortest interval that covers half of the values in x. Its midpoint is the median of the data values that lie in the shorth and can be used as an estimator of the mode of the distribution that generated x.

If there are multiple shortest intervals, the action specified in ties.action is applied. Allowed values are mean (the default), max and min. For mean, the average value is considered; however, an error is generated if the start indices of the different shortest intervals differ by more than the fraction tie.limit of length(x). For min and max, the left-most or right-most, respectively, of the multiple shortest intervals is considered.

Value

The midpoint of the short of x.

Author(s)

Wolfgang Huber http://www.ebi.ac.uk/huber, Ligia Pedroso Bras

See Also

half.range.mode

Examples

 
  x <- c(rnorm(500), runif(500) * 10)
  res <- c(mean=mean(x), median=median(x), shorth=shorth(x))
  if(interactive()) {
    colors = c(1,2,4)
    hist(x, 40, col="orange")
    abline(v=res, col=colors, lwd=3)
    legend(6, 100, names(res), col=colors, lwd=3) 
  }

[Package genefilter version 1.12.0 Index]