Learn R Programming

shotGroups (version 0.6.2)

groupShape: 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, plots = TRUE, bandW = 0.5, outlier=c('mcd', 'pca'),
           dstTarget = 100, conversion = 'm2cm', ...)

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

## S3 method for class 'default':
groupShape(xy, plots = TRUE, bandW = 0.5, outlier=c('mcd', 'pca'),
           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
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
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.
...
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.

Value

  • A list with the results from the numerical analyses and statistical tests.
  • corXYcorrelation matrix of (x,y)-coordinates.
  • corXYrobrobust estimate of correlation matrix of (x,y)-coordinates.
  • Outliersa vector of row indices for observations identified as outliers.
  • ShapiroXShapiro-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.
  • ShapiroYShapiro-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.
  • multNormE-statistic-Test result for multivariate normality of (x,y)-coordinates.

Details

In addition to the numerical results listed below, this function produces the following diagrams:
  • a combined plot for multivariate outlier identification as produced byaq.plot
  • a chi-square Q-Q-plot for eyeballing multivariate normality as produced bychisq.plot, including a reference line with intercept 0 and slope 1
  • a heatmap of a non-parametric 2D-kernel density estimate for the (x,y)-coordinates as produced bysmoothScattertogether with group center and error ellipses (original and scaled by factor 2) based on a robust estimate for the covariance matrix (fromcovMcdusing the MCD algorithm)
  • a Q-Q-plot of x-coordinates for eyeballing normality
  • a Q-Q-plot of y-coordinates for eyeballing normality
  • a histogram of x-coordinates including a fitted normal distribution as well as a non-parametric kernel density estimate
  • a histogram of y-coordinates including a fitted normal distribution as well as a non-parametric kernel density estimate

See Also

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

Examples

Run this code
# 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
xy <- matrix(round(rnorm(200, 0, 5), 2), ncol=2)
groupShape(xy, bandW=1.6)

Run the code above in your browser using DataLab