Learn R Programming

shotGroups (version 0.3)

getConfEll: Confidence ellipse

Description

Calculates the 2D-confidence ellipse under the assumption of bivariate normality. Also includes the ellipse based on a robust estimate for the covariance matrix of the (x,y)-coordinates.

Usage

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

## S3 method for class 'data.frame':
getConfEll(xy, level = 0.5, dstTarget = 100, conversion = 'm2cm', doRob=TRUE)

## S3 method for class 'default':
getConfEll(xy, level = 0.5, dstTarget = 100, conversion = 'm2cm', doRob=TRUE)

Arguments

xy
(x,y)-coordinates of n points: either a numerical (n x 2)-matrix (1 row of coordinates per point), or a data frame with either the variables X, Y or Point.X, Point.Y.
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 (x,y)-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(x,y)-coordinates group center.
  • ctrRob(x,y)-coordinates robust estimate of group center.
  • covcovariance matrix.
  • covRobrobust estimate of covariance matrix.
  • sizea numerical matrix with the length of the semi-major and semi-minor axis of the ellipse (in original measurement units and MOA).
  • sizeRoba numerical matrix with the length of the semi-major and semi-minor axis of the ellipse based on a robust estimate for the covariance matrix of (x,y)-coordinates (in original measurement units and MOA).
  • shapea numerical vector with the aspect ratio and the flattening of the ellipse as well as the trace and determinant of the covariance matrix.
  • shapeRoba 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 (x,y)-coordinates.
  • magFacmagnification factor used to turn the error ellipse into the confidence ellipse as determined by the F(2, 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 (x,y)-coordinates is from covMcd using the MCD algorithm. See getCEP for estimates of the circular 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
xy <- matrix(round(rnorm(100, 0, 5), 2), ncol=2)
getConfEll(xy, level=0.5, dstTarget=25, conversion='m2cm')

Run the code above in your browser using DataLab