groupShape | R Documentation |
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.
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, ...)
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 |
center |
logical: center groups to mean (0,0) first? If variable |
plots |
logical: show diagrams? |
bandW |
for argument |
outlier |
method for outlier identification: |
dstTarget |
a numerical value giving the distance to the target - used in MOA calculation. Acts as override if variable |
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 |
... |
additional arguments passed to |
In addition to the numerical results listed below, this function produces the following diagrams:
a combined plot for multivariate outlier identification as produced by aq.plot
- requires installing package mvoutlier
a chi-square Q-Q-plot for eyeballing multivariate normality as produced by chisq.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 by smoothScatter
together with group center and error ellipses (original and scaled by factor 2) based on a robust estimate for the covariance matrix (from covMcd
using 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
If package shiny
is installed, an interactive web app for this functionality can be run with runGUI("analyze")
.
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 |
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 |
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 |
multNorm |
E-statistic-Test result for multivariate normality of (x,y)-coordinates - only available if package |
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.
qqnorm
,
smoothScatter
,
hist
,
kernel
,
covMcd
,
shapiro.test
,
ks.test
,
mvnorm.etest
,
chisq.plot
,
aq.plot
,
pcout
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.