1
$\begingroup$

I am trying to manipulate the output of EllipsoidQuantile to find the area in the next line.

I can easily find the 95% confidence interval and this generates an ellipsoid, but I would like to extract the axis without copy and pasting.

data = {{-3.17, 272.35}, {.67, 271.54},..........};
elips = EllipsoidQuantile[data, 0.95]

the output is then

Ellipsoid[{{-.578,272},{2.88,0.62},{-.09,0.12},{-.12,-.099}}]

I would like to extract the second row of data(major and minor axis).

$\endgroup$
2
  • $\begingroup$ Part ? And please add complete examples. $\endgroup$
    – Sektor
    Commented May 28, 2015 at 16:01
  • $\begingroup$ As a word of caution, you might care to know that EllipsoidQuantile uses an obsolete definition of the Ellipsoid function, as you will notice if you compare the three-argument results you get with the current two-argument definition in the documentation. Take a look at this question How to draw confidence ellipse from a covariance matrix? for a way of drawing those ellipsoids that also doesn't require you to use the MultivariateStatistics package. $\endgroup$
    – MarcoB
    Commented May 28, 2015 at 16:13

1 Answer 1

1
$\begingroup$

Let me generate some random bivariate toy data :

SeedRandom[1]
newdata = RandomVariate[BinormalDistribution[{10, 25}, {1, 5}, 0.7], 100]; 

Take a look at my answer to this question: How to draw confidence ellipse from a covariance matrix?. You will see that you can obtain a 95% confidence ellipsoid as follows:

ellipsoid95 = Ellipsoid[Mean[newdata], 6 Covariance[newdata]]

(* Out: Ellipsoid[{9.99033, 25.6897}, {{6.17123, 20.9226}, {20.9226, 137.338}}] *)

You can plot this with your data:

ListPlot[
  newdata, 
  Epilog -> {Opacity[0], EdgeForm[{Gray, Thick, Dashed}], ellipsoid95},
  PlotRangePadding -> Scaled[.075], Frame -> True, Axes -> False
]

Mathematica graphics

This generates a "new" Ellipsoid object that plays nice with the convenient geometric region functions. For instance, you can then obtain its area simply with the Area function:

Area[ellipsoid95]

(* Out: 63.596 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.