Learn R Programming

shotGroups (version 0.7.1)

getConfEll: Confidence ellipse

Description

Calculates the confidence ellipse for the true mean of shot coordinates under the assumption of multivariate normality. Also includes the ellipse based on a robust estimate for the covariance matrix of the shot coordinates.

Usage

getConfEll(xy, level = 0.5, dstTarget = 100, conversion = 'm2cm', doRob=TRUE)
"getConfEll"(xy, level = 0.5, dstTarget = 100, conversion = 'm2cm', doRob=TRUE)
"getConfEll"(xy, level = 0.5, dstTarget = 100, conversion = 'm2cm', doRob=TRUE)

Arguments

xy
Shot coordinates of n points: either a numerical (n x p)-matrix (1 row of p coordinates per point), or a data frame with either the variables X, Y or Point.X, Point.Y (optionally Z or Point.Z).
level
a numerical value with the coverage for the confidence ellipse.
dstTarget
a numerical value with 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 shot coordinates - used in MOA calculation. See getMOA.
doRob
logical: should robust covariance matrix estimate be used as well?

Value

A list with the confidence ellipse measures.
ctr
coordinates group center.
ctrRob
coordinates robust estimate of group center.
cov
covariance matrix.
covRob
robust estimate of covariance matrix.
size
a numerical matrix with the lengths of the semi-axes of the ellipse (in original measurement units, MOA, SMOA, milliradian).
sizeRob
a numerical matrix with the lengths of the semi-axes of the ellipse based on a robust estimate for the covariance matrix of shot coordinates (in original measurement units, MOA, SMOA, milliradian).
shape
a numerical vector with the aspect ratio of the ellipse (square root of condition index kappa), its flattening (1 - inverse aspect ratio) as well as the trace and determinant of the covariance matrix.
shapeRob
a numerical vector with the aspect ratio and the flattening of the ellipse as well as the trace and determinant based on a robust estimate for the covariance matrix of shot coordinates.
magFac
magnification factor used to turn the error ellipse into the confidence ellipse as determined by the F(p, n-1)-distribution.

Details

No coordinate transforms are done (unlike in groupLocation, groupShape, groupSpread), i.e., origin is not assumed to be in top-left corner, and points are not taken relative to point of aim.

Robust estimate for the covariance matrix of coordinates is from covMcd using the MCD algorithm. See getCEP for estimates of the circular/spherical error probable.

See Also

getCEP, covMcd, drawEllipse

Examples

Run this code
# coordinates given by a suitable data frame
(ce <- getConfEll(DFsavage, level=0.5, dstTarget=100,
                  conversion='yd2in'))

# plot points, center, parametric confidence
# ellipse, and its axes
plot(point.y ~ point.x, data=DFsavage, asp=1, pch=16)
drawEllipse(ce, axes=TRUE, fg='blue', colCtr='blue', lwd=2, pch=4, cex=2)

# coordinates given by a matrix
## Not run: 
# xy <- matrix(round(rnorm(100, 0, 5), 2), ncol=2)
# getConfEll(xy, level=0.5, dstTarget=25, conversion='m2cm')
# ## End(Not run)

Run the code above in your browser using DataLab