Learn R Programming

shotGroups (version 0.7.1)

groupSpread: Precision: Spread measures of a single group of bullet holes

Description

Provides spread measures and their graphical representations for a single group of bullet holes.

Usage

groupSpread(xy, plots = TRUE, CEPlevel = 0.5, CIlevel = 0.95, CEPtype = 'CorrNormal', bootCI = c('basic', 'bca'), dstTarget = 100, conversion = 'm2cm')
"groupSpread"(xy, plots = TRUE, CEPlevel = 0.5, CIlevel = 0.95, CEPtype = 'CorrNormal', bootCI = c('basic', 'bca'), dstTarget = 100, conversion = 'm2cm')
"groupSpread"(xy, plots = TRUE, CEPlevel = 0.5, CIlevel = 0.95, CEPtype = 'CorrNormal', bootCI = c('basic', 'bca'), dstTarget = 100, conversion = 'm2cm')

Arguments

xy
either a numerical (n x 2)-matrix with the (x,y)-coordinates of n points (1 row of coordinates per point), or a data frame with either the variables X, Y or Point.X, Point.Y as well as Aim.X, Aim.Y giving the point of aim. If missing, point of aim is assumed to be in (0,0).
plots
logical: show diagrams?
CEPlevel
a numerical value giving the coverage for the CEP and for the confidence ellipse.
CIlevel
a numerical value giving the level for the confidence intervals (for standard deviations as well as for Rayleigh sigma, RSD, MR).
CEPtype
string indicating which CEP estimate to report from getCEP.
bootCI
a character vector to select which bootstrap confidence interval type to report. Possible types are 'none' (no bootstrap CI), 'norm', 'basic', 'perc', 'bca'. See boot.ci.
dstTarget
a numerical value giving the distance to the target - used in MOA calculation. See getMOA.
conversion
how to convert the measurement unit for distance to target to that of the (x,y)-coordinates - used in MOA calculation. See getMOA.

Value

A list with the results from the numerical analyses and statistical tests.
sdXY
standard deviations of x- and y-coordinates (in original measurement units, MOA, SMOA, milliradian).
sdXci
parametric (chi^2) and bootstrap confidence intervals for the standard deviation of x-coordinates (in original measurement units, MOA, SMOA, milliradian).
sdYci
parametric (chi^2) and bootstrap confidence intervals for the standard deviation of y-coordinates (in original measurement units, MOA, SMOA, milliradian).
sdXYrob
robust standard deviations of x- and y-coordinates (in original measurement units, MOA, SMOA, milliradian).
covXY
covariance matrix of (x,y)-coordinates.
covXYrob
robust estimate of covariance matrix of (x,y)-coordinates.
distToCtr
mean, median and maximum distance from points to their center as well as estimated Rayleigh parameters sigma (precision), radial standard deviation RSD, and mean radius MR (in original measurement units, MOA, SMOA, milliradian).
sigmaCI
parametric (chi^2) and bootstrap confidence intervals for sigma (in original measurement units, MOA, SMOA, milliradian).
RSDci
parametric (chi^2) and bootstrap confidence intervals for radial standard deviation RSD (number of points), in original measurement units, MOA, SMOA, milliradian).
MRci
parametric (chi^2) and bootstrap confidence intervals for mean radius MR (in original measurement units, MOA, SMOA, milliradian).
maxPairDist
maximum pairwise distance between points (center-to-center, = maximum spread, in original measurement units, MOA, SMOA, milliradian).
groupRect
width and height of bounding box with diagonal and figure of merit FoM (average side length, in original measurement units, MOA, SMOA, milliradian).
groupRectMin
width and height of minimum-area bounding box with diagonal and figure of merit FoM (average side length, in original measurement units, MOA, SMOA, milliradian).
minCircleRad
radius for the minimum enclosing circle (in original measurement units, MOA, SMOA, milliradian).
confEll
length of semi-major and semi-minor axis of the confidence ellipse (in original measurement units, MOA, SMOA, milliradian).
confEllRob
length of semi-major and semi-minor axis of the confidence ellipse based on a robust estimate for the covariance matrix (in original measurement units, MOA, SMOA, milliradian).
confEllShape
aspect ratio of the confidence ellipse (square root of condition index kappa), its flattening (1 - inverse aspect ratio) as well as the trace and determinant of the covariance matrix.
confEllShapeRob
aspect ratio and flattening of the confidence ellipse based on a robust estimate for the covariance matrix as well as its trace and determinant.
CEP
estimate(s) for the circular error probable (CEP, in original measurement units, MOA, SMOA, milliradian).

Details

Explanations and formula for many reported precision measures like CEP, sigma, RSD, MR, FoM can be found in the references. Robust estimate for the covariance matrix of (x,y)-coordinates is from covMcd using the MCD algorithm. The number of replicates for the reported bootstrap confidence intervals is at least 1499. If the BCa interval is reported, it is at least the number of points. In addition to the numerical results listed below, this function produces the following diagrams:
  • a scatterplot of the (x,y)-coordinates together with group center, circle with average distance to center, and 100*level%-confidence ellipse - the latter also based on a robust estimate for the covariance matrix
  • a scatterplot of the (x,y)-coordinates together with the bounding box, minimum bounding box, minimum enclosing circle, and maximum group spread
  • a histogram of distances to group center including a fitted Rayleigh distribution as well as a non-parametric kernel density estimate

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

References

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

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

See Also

getDistToCtr, getMaxPairDist, getBoundingBox, getMinBBox, getMinCircle, getConfEll, getCEP, getRayParam, getMOA, hist, boot, boot.ci, kernel, covMcd

Examples

Run this code
# coordinates given by a suitable data frame
res <- groupSpread(DFtalon, CEPtype=c('Grubbs', 'Rayleigh'), CEPlevel=0.5,
                   CIlevel=0.95, bootCI='none', dstTarget=10, conversion='m2mm')
names(res)
res$sdXYrob
res$distToCtr
res$maxPairDist
res$CEP

# coordinates given by a matrix
## Not run: 
# xy <- matrix(round(rnorm(200, 0, 5), 2), ncol=2)
# groupSpread(xy, CEPlevel=0.5, CIlevel=0.95, dstTarget=25, conversion='m2cm')
# ## End(Not run)

Run the code above in your browser using DataLab