groupShape {shotGroups}R Documentation

Shape analysis for a single group of bullet holes

Description

Assesses shape of a single group of bullet holes: Outlier analysis as well as numerical and graphical normality checks for a set of (x,y)-coordinates.

Usage

groupShape(xy, center = FALSE, plots = TRUE, bandW = 0.5,
           outlier = c('mcd', 'pca'), dstTarget, conversion, ...)

## S3 method for class 'data.frame'
groupShape(xy, center = FALSE, plots = TRUE, bandW = 0.5,
           outlier=c('mcd', 'pca'), dstTarget, conversion, ...)

## Default S3 method:
groupShape(xy, center = FALSE, plots = TRUE, bandW = 0.5,
           outlier=c('mcd', 'pca'), dstTarget, conversion, ...)

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).

center

logical: center groups to mean (0,0) first? If variable series does not exist, all shots are treated as belonging to the same group. Only available in method groupShape.data.frame().

plots

logical: show diagrams?

bandW

for argument bandwith of smoothScatter.

outlier

method for outlier identification: mcd uses robust Mahalanobis distances (see aq.plot), pca uses robust principal components analysis (see pcout). Requires installing package mvoutlier.

dstTarget

a numerical value giving the distance to the target - used in MOA calculation. Acts as override if variable distance is already included in xy. See getMOA.

conversion

how to convert the measurement unit for distance to target to that of the (x,y)-coordinates in MOA calculation. Acts as override if variables dist.unit and point.unit are already included in xy. Example 'm2cm'. See getMOA.

...

additional arguments passed to pcout with outlier='pca' - final sensitivity can be adjusted with option outbound, a sensible candidate value seems to be around 0.45.

Details

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

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

Value

A list with the results from the numerical analyses and statistical tests.

corXY

correlation matrix of (x,y)-coordinates.

corXYrob

robust estimate of correlation matrix of (x,y)-coordinates.

Outliers

a vector of row indices for observations identified as outliers - only if package mvoutlier is installed.

ShapiroX

Shapiro-Wilk-Test result for normality of x-coordinates. Only for at most 5000 points. For more than 5000 points, replaced by Kolmogorov-Smirnov-Test in ksX.

ShapiroY

Shapiro-Wilk-Test result for normality of y-coordinates. Only for at most 5000 points. For more than 5000 points, replaced by Kolmogorov-Smirnov-Test in ksY.

multNorm

E-statistic-Test result for multivariate normality of (x,y)-coordinates - only available if package energy is installed.

Note

The chi-square distribution is only strictly valid for squared Mahalanobis distances if the true center and the true covariance matrix are used in calculation. The goodness of approximation for situations where sample estimates are used should be sufficient here.

See Also

qqnorm, smoothScatter, hist, kernel, covMcd, shapiro.test, ks.test, mvnorm.etest, chisq.plot, aq.plot, pcout

Examples

# coordinates given by a suitable data frame
res <- groupShape(DFsavage, bandW=4, outlier='mcd',
                  dstTarget=100, conversion='m2mm')
names(res)
res$corXY
res$Outliers
res$multNorm

# coordinates given by a matrix
## Not run: 
xy <- matrix(round(rnorm(200, 0, 5), 2), ncol=2)
groupShape(xy, bandW=1.6)

## End(Not run)

[Package shotGroups version 0.8.2 Index]