Cumulative lower tail probability and quantile for median of scaled differences.
1 2 3 4 5 6 7
Vector of quantiles.
Vector of probabilities.
Number of observations from which msd was calculated. Unused (and can be missing)
logical; if TRUE (the default), probabilities are P[X <= x]; otherwise, P[X > x].
Calculation method. See details.
qmsd return probabilities, densities and quantiles, respectively,
for the median scaled difference applied to a single observation in a standard normal
distribution, where otehr values are also IID normal.
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-1 scaled differences).
q are recycled to the length of the longest, as necessary.
method determines the method of calculation.
method="fast", probabilities are calculated using monotonic spline
interpolation on precalculated probabilities.
method="fast" is obtained
by root-finding on the corresponding spline function using
uniroot, and densities are
estimated from the first derivative of the interpolating spline. This provides fast
calculation, and values for most practical probabilities are within 10^-6 of exact calculations.
For high probabilites and for low quantiles (below 0.48) at high
n, fast quantile accuracy
is poorer due to the very low function gradients in this regions, but is still guaranteed
method="exact", probabilities and densities are calculated using quadrature
integration for an order statistic. For odd
n, this requires a double integral. Values for
n accordingly take about an order of magnitude longer to obtain than for even
This can be slow (seconds for a vector of several hundred values of
q on an Intel x86
machine running at 1-2GHz).
method="exact" is obtained by root-finding from
pmsd(..., method="excat") using
uniroot, and is over an order of magnitude slower than
method="exact", asymptotic (large n) probabilities, densities and quantiles are
n is unused and can be missing.
max.odd are replaced with the next lower
even value. This provides a fair approximation for
n above 30 (though the fast method is better)
and a good approximation above the default of 199. Values of
max.odd above 199 are not recommended
as integration can become unstable at high odd
n; a warning is issued if
max.odd > 199.
method="even", an exact calculation is performed with any odd
n replaced with the
next lower even value. This is equivalent to setting
This is provided for interest only; the
method="fast" method provides a substantially better
approximation for odd
method="even" and is faster.
Note that these functions are appropriate for the distribution of single values. If
seeking an outlier test in a data set of size N, either adjust
p for N
comparisons before applying
qmsd to find a critical value, or adjust the returned
p-values using, for example, Holm adjustment.
A vector of length
length(q) (or, if longer,
cumulative probabilities, densities or quantiles respectively.
S Ellison firstname.lastname@example.org
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.