Last data update: 2014.03.03

R: Median scaled difference probabilities and quantiles
pmsd R Documentation

Median scaled difference probabilities and quantiles

Description

Cumulative lower tail probability and quantile for median of scaled differences.

Usage

	pmsd(q, n, sd=1, scale=TRUE)
	qmsd(p, n, sd=1, scale=TRUE)

Arguments

q

Vector of quantiles.

p

Vector of probabilities.

n

Scalar: number of observations from which msd was calculated.

sd

Standard deviation, used to scale q.

scale

If scale is TRUE, sd is divided by sqrt(2) prior to calculating p or q.

Details

pmsd and qmsd implement exact (for even n) or approximate (odd n) probabilities and quantiles for the median scaled difference applied to a single observation in a normal distribution.

n is the number of observations in the data set of interest and not the degrees of freedom or number of differences (msd for a value x[i] in a set of n observations involves n-1 scaled differences).

The probabilities are calculated using quadrature integration over a distribution of an order statistic, and may be quite slow (seconds for a vector of several hundred 100 values of q on an Intel x86 machine running at 1GHz). qmsd is obtained even more slowly by root-finding from pmsd using uniroot.

Note that both functions are appropriate for the distribution of single values. If seeking an outlier test, adjust p for n comparisons before applying qmsd.

Value

A vector of length length(p) or length(q) of quantiles or probabilities respectively.

Author(s)

S Ellison s.ellison@lgc.co.uk

See Also

msd.

Examples


  data(Pb)
  msd(Pb$value)          # Uses mad(Pb$value) as scale estimate
  msd(Pb$value, Pb$u)    # Scales differences using standard uncertainties

Results