# coordinates given by a suitable data frame
(cep <- getCEP(DFtalon, accuracy=FALSE, dstTarget=10, conversion='m2mm',
type=c('Rayleigh', 'Grubbs', 'RAND')))
# plot points, centers, and circles indicating 50\%-CEP estimates
plot(Point.Y ~ Point.X, data=DFtalon, asp=1, pch=16)
drawCircle(cep$ctr, cep$Rayleigh['unit', '50%'], fg='red')
drawCircle(cep$ctr, cep$Grubbs['unit', '50%'], fg='green3')
drawCircle(cep$ctr, cep$RAND['unit', '50%'], fg='blue')
points(cep$ctr[1], cep$ctr[2], pch=4, col='gray50', cex=2, lwd=2)
legend(x='bottomleft',
legend=c('Rayleigh 50', 'Grubbs 50', 'RAND 50', 'center'),
col=c('red', 'green3', 'blue', 'gray50'), lwd=2,
lty=c(1, 1, 1, NA), pch=c(NA, NA, NA, 4), bg='white')
# calculate actual coverage percentage of 50% CEP estimates
dists <- getDistToCtr(DFtalon) # distances to center
# extract CEP radius for all estimates
CEPr <- c(Rayleigh=cep$Rayleigh['unit', '50%'],
Grubbs=cep$Grubbs['unit', '50%'],
RAND=cep$RAND['unit', '50%'])
# percentage of points in circle with radius = CEP
100 * sapply(CEPr, function(x) sum(dists <= x)) / length(dists)
# coordinates given by a matrix
xy <- matrix(round(rnorm(100, 0, 5), 2), ncol=2)
getCEP(xy, accuracy=FALSE, dstTarget=25, conversion='m2cm',
type=c('Rayleigh', 'Grubbs', 'RAND')))Run the code above in your browser using DataLab