efficiency: Estimate number of required groups for given CI level and...

View source: R/efficiency.R

efficiencyR Documentation

Estimate number of required groups for given CI level and width

Description

Estimates the approximate number of required groups for a given number of shots per group, confidence interval (CI) level and CI width - when using the Rayleigh sigma estimator based on (x,y)-coordinates, or a range statistic such as extreme spread, figure of merit, or the bounding box diagonal. The function may also be used to obtain the estimated CI width when the number of shots per group and the number of groups is given. This functions assumes a circular bivariate normal shot distribution with 0 mean.

Usage

efficiency(n, nGroups, CIlevel=0.95, CIwidth,
           stat=c("Rayleigh", "ES", "FoM", "D"))

Arguments

n

a vector of integers between 2 and 100. Number of shots in each group.

nGroups

integer between 1 and 10. Number of groups over which individually-measured statistics will be averaged - when given, CIwidth must be missing, and the estimated CI width that can be achieved with the given n, nGroups and chosen statistic is returned.

CIlevel

confidence level - coverage probability of the CI.

CIwidth

CI width as a fraction of the mean of the chosen statistic for given n and nGroups. In other sources (see details) CIwidth/2 is also called E - the width as a fraction of the mean on either side. When given, nGroups must be missing, and the estimated required number of groups to achieve the desired CI width for the CI coverage probability CIlevel is returned.

stat

a character vector with elements "Rayleigh" (Rayleigh sigma), "ES" (extreme spread), "FoM" (figure of merit), or "D" (bounding box diagonal) indicating which statistic would be measured.

Details

Based on the lookup table DFdistr with results form a Monte Carlo simulation. If the value of n is not among those simulated (but is less than 100), a spline interpolation between the neighboring simulated values of the statistic's coefficient of variation is used.

The number of required groups is approximate as the calculation assumes a normal distribution for the mean statistic. Details for the calculation can be found under

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

http://www.geoffrey-kolbe.com/articles/rimfire_accuracy/group_statistics.htm

http://ballistipedia.com/images/3/32/Sitton_1990.pdf

If package shiny is installed, an interactive web app for this functionality can be run with runGUI("range").

Value

When CIwidth is given, a data frame with the estimated number of required groups and total shots to achieve the given CIlevel.

n

Number of shots per group.

nGroupsReq

Number of required groups - as calculated (fractional number).

nGroupsReqCeil

Number of required groups - rounded upwards to a whole number.

nShotsReq

Total number of required shots - using nGroupsReq as calculated (fractional number).

nShotsReqCeil

Total number of required shots - using nGroupsReq rounded upwards to a whole number.

CIlevel

The CI level

CIwidth

The CI width

When nGroups is given, a data frame with the estimated CI width required to achieve the desired CIlevel.

n

Number of shots per group.

nGroups

Number of groups that will be averaged over.

nShots

The total number of shots

CIlevel

The CI level

CIwidth

Required CI width as a fraction of the mean statistic.

See Also

DFdistr, range2sigma, getRayParam, getMaxPairDist, getBoundingBox

Examples

# get required number of shots to achieve 90% CI with
# a CI width of 20% of the mean (10% on either side)
# using 10 shots per group and measuring extreme spread
efficiency(n=10, CIlevel=0.9, CIwidth=0.2, stat="ES")

# as above, but using Rayleigh sigma
efficiency(n=10, CIlevel=0.9, CIwidth=0.2, stat="Rayleigh")

# check that the result for ES is about right
# -> 5% quantile with 10 groups is about 10% below the mean
# -> 95% quantile with 10 groups is about 10% above the mean
with(subset(DFdistr, (n == 10L) & (nGroups == 10L)),
     c(ES_Q050/ES_M, ES_Q950/ES_M))

# get achievable 90% CI width with 10 groups of 5 shots each
# using extreme spread
efficiency(n=5, nGroups=10, CIlevel=0.9, stat="ES")

dwoll/shotGroups documentation built on Feb. 16, 2024, 2:21 p.m.