So I have log-transformed measurement data arranged in a simple table:
x y
1.158362492 1.322219295
1.1430148 1.267171728
1.11058971 1.252853031
1.120573931 1.260071388
1.149219113 1.278753601
1.123851641 1.276461804
1.096910013 1.222716471
I know there are functions for plotting a confidence ellipse for these data, but how to I calculate the area of the generated shape?
Thanks
You can use package
mclust
, there is a hidden function calledmvn_plot
, the input parameters aremean
andstd
. You may try to read its code and modify it to get the length of each axis.First calculate the ellipse, then determine the lengths of the major and minor axes, and then calculate the area.
Here's a brainless approximation.
First, your data.
Then load the package
car
;dataEllipse
can be used to calculate an ellipse using a bivariate normal approximation to the data.A call to
ellipse
can give points along the ellipse thatdataEllipse
plots.We can then calculate the distance from each point on the ellipse to the center.
The minimum and maximum of these distances are the half-lengths of the minor and major axes. So we can get the area as follows.