Learn R Programming

shotGroups (version 0.8.2)

rangeStat: Distribution of range statistics

Description

Approximate cumulative distribution function, quantile function and random deviates of range statistics based on a lookup table generated by simulations. Includes extreme spread (ES), figure of merit (FoM), bounding box diagonal (D). This function assumes a circular bivariate normal shot distribution with 0 mean.

Usage

pRangeStat(q, sigma = 1, nPerGroup = 5, nGroups = 1, stat = c("ES", "FoM", "D"),
           lower.tail = TRUE, loUp)
qRangeStat(p, sigma = 1, nPerGroup = 5, nGroups = 1, stat = c("ES", "FoM", "D"),
           method = c("linear", "spline"), lower.tail = TRUE)
rRangeStat(n, sigma = 1, nPerGroup = 5, nGroups = 1, stat = c("ES", "FoM", "D"))

Value

pRangeStat gives the cumulative distribution function, qRangeStat gives the quantile function, rRangeStat generates random deviates.

Arguments

q

vector of quantiles.

p

vector of probabilities. Must be within [0.005, 0.995].

n

number of observations. Must be <= 100. If length(n) > 1, the length is taken to be the number required.

stat

character string indicating the range statistic. One of "ES" (extreme spread), "FoM" (figure of merit), or "D" (bounding box diagonal).

nPerGroup

integer between 2 and 100. Number of shots in each group.

nGroups

integer between 1 and 10. Number of groups. For nGroups > 1, the quantile of the average range statistic is returned.

sigma

numeric value > 0 indicating the Rayleigh scale parameter (common standard deviation of the underlying normal distribution of each 2D-coordinate). See Rayleigh.

lower.tail

logical. If TRUE (default), probabilities are \(P[X \le x]\) otherwise, \(P[X > x]\).

method

method for bivariate interpolation if both, p and nPerGroup, are missing from the lookup table. "linear" for bilinear interpolation (requires installing package interp), "spline" for bivariate spline approximation (requires installing package MBA).

loUp

search interval for numerical root finding. A vector with the lower and upper interval boundary. See details.

Details

Based on the lookup table DFdistr with results form a Monte Carlo simulation. If the value either for p or for nPerGroup is missing from the lookup table, a monotone spline interpolation between the neighboring simulated values is used.

pRangeStat is implemented through numerical root finding of qRangeStat. If no search interval for uniroot is provided, whole interval of probabilities available in DFdistr is used. NA is returned for quantiles corresponding to probabilities outside of the available range.

References

http://ballistipedia.com/index.php?title=Range_Statistics

See Also

DFdistr, range2sigma, Rayleigh, interp, mba.surf,

Examples

Run this code
(q45 <- pRangeStat(c(4, 5), sigma=1.5, n=5, nGroups=3, stat="ES"))

# should be the 4 and 5
qRangeStat(q45, sigma=1.5, n=5, nGroups=3, stat="ES")

rRangeStat(5, sigma=2, nPerGroup=5, nGroups=3, stat="D")

Run the code above in your browser using DataLab