Learn R Programming

shotGroups (version 0.7.1)

compareGroups: Compare bullet hole groups

Description

Numerically and graphically compare accuracy, precision, and distribution shape of up to 15 groups of bullet holes.

Usage

compareGroups(DF, plots = TRUE, xyTopLeft = TRUE, ABalt = c('two.sided', 'less', 'greater'), Walt = c('two.sided', 'less', 'greater'), CEPtype = 'CorrNormal', CEPlevel = 0.5, CIlevel = 0.95, conversion = 'm2cm')

Arguments

DF
a data frame containing (at least) these variables: Series (a factor), and either Point.X, Point.Y or X, Y defining the bullet holes. Variables Distance (distance to target), Aim.X, Aim.Y (point of aim) are useful - if they are missing, a warning is given and a default assumed.
plots
logical: show diagrams?
xyTopLeft
logical: is the origin of the absolute coordinate system in the top-left corner? See details.
ABalt
a character string indicating the hypothesis for the Ansari-Bradley-Test for equal variances. Only used when exactly 2 groups are compared.
Walt
a character string indicating the hypothesis for the Wilcoxon-Rank-Sum-Test for equality of average distance to group center (equivalent to the Mann-Whitney-U-Test). Only used when exactly 2 groups are compared.
CEPtype
string indicating which CEP estimate to report from getCEP.
CEPlevel
a numerical value giving the coverage of the confidence ellipse and CEP.
CIlevel
a numerical value giving the level for the confidence intervals (for standard deviations and Rayleigh sigma, MR).
conversion
how to convert the measurement unit for distance to target to that of the (x,y)-coordinates in MOA calculation. See getMOA.

Value

A list with the results from numerical comparisons and statistical tests.
ctr
group center offset from the respective point of aim.
distPOA
distances from group centers to point of aim (in original measurement units, MOA, SMOA, milliradian).
MANOVA
MANOVA result from testing equality of group center offset from the respective point of aim (test statistic is Wilk's lambda).
corXY
group correlation matrices for the (x,y)-coordinates.
sdXY
list with group standard deviations of the x- and y-coordinates (in original measurement units, MOA, SMOA, milliradian).
sdXYci
list with group parametric (chi^2) confidence intervals for the standard deviations of x- and y coordinates (in original measurement units, MOA, SMOA, milliradian).
meanDistToCtr
average distances from points to their respective group center (in original measurement units, MOA, SMOA, milliradian).
maxPairDist
maximum pairwise distance between points for each group (center-to-center, = maximum spread, in original measurement units, MOA, SMOA, milliradian).
bbFoM
minimum-area bounding box figure of merit (average side length) for each group (in original measurement units, MOA, SMOA, milliradian).
bbDiag
minimum-area bounding box diagonal length for each group (in original measurement units, MOA, SMOA, milliradian).
minCircleRad
radius of the minimum enclosing circle for each group (in original measurement units, MOA, SMOA, milliradian).
sigma
estimated Rayleigh parameter sigma (precision) for each group (in original measurement units, MOA, SMOA, milliradian).
MR
estimated Rayleigh mean radius for each group (in original measurement units, MOA, SMOA, milliradian).
sigmaMRci
parametric (chi^2) confidence intervals for Rayleigh sigma and MR (in original measurement units, MOA, SMOA, milliradian).
CEP
Estimate for the circular error probable (CEP) in each group (in original measurement units, MOA, SMOA, milliradian).
AnsariX
Ansari-Bradley-Test result from testing equality of group variances for x-coordinates. When two groups are compared.
AnsariY
Ansari-Bradley-Test result from testing equality of group variances for y-coordinates. When two groups are compared.
Wilcoxon
Wilcoxon-Rank-Sum-Test result from testing equality of average point distances to their respective group center. When two groups are compared.
FlignerX
Fligner-Killeen-Test result from testing equality of group variances for x-coordinates. When more than two groups are compared.
FlignerY
Fligner-Killeen-Test result from testing equality of group variances for y-coordinates. When more than two groups are compared.
Kruskal
Kruskal-Wallis-Test result from testing equality of average point distances to their respective group center. When more than two groups are compared.

Details

By default, OnTarget PC/TDS' 'Export Point Data' places the origin of the absolute coordinate system in the top-left corner. In OnTarget TDS, this setting can be changed by checking the box 'Tools -> Options -> Options tab -> Data Export -> Invert Y-Axis on Export'. In that case, use xyTopLeft=FALSE. If groups appear to be upside-down, xyTopLeft is the setting to change.

OnTarget PC/TDS' Group variable identifies groups just within one file, whereas factor series is taken to number groups also across different original files. If your data was read with readDataOT1, readDataOT2 or readDataMisc, series is added automatically. For data from just one file, you can otherwise copy variable Groups to series in a data frame called shots with shots$series <- shots$Group. If the data is missing information about the point of aim, (0,0) is assumed. If distance to target is missing, 100 is assumed.

In addition to the numerical results listed below, this function produces the following diagrams:

  • a scatterplot showing all groups as well as their respective center and confidence ellipse
  • a scatterplot showing all groups as well as their respective (minimum) bounding box and maximum group spread
  • a scatterplot showing all groups as well as their respective minimum enclosing circle and circle with average distance to center
  • a boxplot for the distances to group center per group
  • a stripchart showing the distances to group center per group together with the estimated Rayleigh mean radius and its confidence interval

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

See Also

analyzeGroup, getDistToCtr, getMaxPairDist, getMinBBox, getMinCircle, getCEP, getMOA, getRayParam, drawEllipse, anova.mlm, ansari_test, fligner_test, wilcox_test, kruskal_test

Examples

Run this code
cmp <- compareGroups(DF300BLKhl, conversion='yd2in')
names(cmp)
cmp$ctr
cmp$meanDistToCtr
cmp$CEP
cmp$Kruskal

Run the code above in your browser using DataLab