Using this link as a starting point, How to find the smallest ellipse covering a given fraction of a set of points in R?
I would like to expand the question to make it possible to find a circle that includes (touches or goes inside) a given fraction of a set of ellipses, instead of being limited to a set of 2d data points.
I'm also looking for a circle, as opposed to the ellipse that the ellipsoidhull function produces. Maybe there is a way to configure the shape that ellipsoidhull function produces, that I haven't found yet? My data set is:
library(ggplot2)
library(ggforce)
x<-runif(20,0,10)
y<-runif(20,0,10)
a<-runif(20,0,3)
b<-runif(20,0,3)
ggplot() + geom_ellipse(aes(x0 = x, y0 = y, a = a, b = b, angle = 0)) +
coord_fixed()
I believe the algorithm would become the red circle in this plot. Touching or penetrating or enveloping 11 out of 20 ellipses.
