[R] How to create density ellipses with R
John Fox
j|ox @end|ng |rom mcm@@ter@c@
Sat Jan 15 18:49:55 CET 2022
Dear Chris,
I took a quick look at your document. You might be interested in
Friendly, Monette, and Fox, Elliptical Insights: Understanding
Statistical Methods through Elliptical Geometry, Statistical Science
2013, 28: 1–39, which is available at
<https://arxiv.org/pdf/1302.4881.pdf>. I probably should cite that paper
in ?car::ellipse.
Best,
John
On 2022-01-15 12:00 p.m., Chris Evans wrote:
> This spurred me on to clarify my own understanding of these ellipses (and of
> ellipsoid hulls) and led to:
>
> https://www.psyctc.org/Rblog/posts/2022-01-15-data-ellipses-and-confidence-ellipses/
>
> And I am, decidedly nervously, putting it here in case it's useful to you Paul or
> to anyone else. I think I have the basic ideas correct but of course, if any proper
> statisticians have corrections, I would love to receive them, off list probably
> unless the errors are terrible. I am entirely self-taught as a statistician, much
> of what I've learned has come from probably over 10, perhaps nearer 20 years on this
> list. Thanks to all for all the work to maintain the list and contribute to it.
>
> Chris
>
> ----- Original Message -----
>> From: "John Fox" <jfox using mcmaster.ca>
>> To: "Paul Bernal" <paulbernal07 using gmail.com>
>> Cc: "R" <r-help using r-project.org>
>> Sent: Friday, 14 January, 2022 18:53:55
>> Subject: Re: [R] How to create density ellipses with R
>
>> Dear Paul,
>>
>> On 2022-01-14 1:17 p.m., Paul Bernal wrote:
>>> Dear John and R community friends,
>>>
>>> To be a little bit more specific, what I need to accomplish is the
>>> creation of a confidence interval ellipse over a scatterplot at
>>> different percentiles. The confidence interval ellipses should be drawn
>>> over the scatterplot.
>>
>> I'm not sure what you mean. Confidence ellipses are for regression
>> coefficients and so are on the scale of the coefficients; data
>> (concentration) ellipses are for and on the scale of the explanatory
>> variables. As it turns out, for a linear model, the former is the
>> rescaled 90 degree rotation of the latter.
>>
>> Because the scatterplot of the (two) variables has the variables on the
>> axes, a data ellipse but not a confidence ellipse makes sense (i.e., is
>> in the proper units). Data ellipses are drawn by car::dataEllipse() and
>> (as explained by Martin Maechler) cluster::ellipsoidPoints(); confidence
>> ellipses are drawn by car::confidenceEllipse() and the various methods
>> of ellipse::ellipse().
>>
>> I hope this helps,
>> John
>>
>>>
>>> Any other guidance will be greatly appreciated.
>>>
>>> Cheers,
>>>
>>> Paul
>>>
>>> El vie, 14 ene 2022 a las 11:27, John Fox (<jfox using mcmaster.ca
>>> <mailto:jfox using mcmaster.ca>>) escribió:
>>>
>>> Dear Paul,
>>>
>>> As I understand it, the ellipse package is meant for drawing confidence
>>> ellipses, not density (i.e., data) ellipses. You should be able to use
>>> ellipse::ellipse() to draw a bivariate-normal density ellipse (assuming
>>> that's what you want), but you'll have to do some computation first.
>>>
>>> You might find the dataEllipse() function in the car package more
>>> convenient (again assuming that you want bivariate-normal density
>>> contours).
>>>
>>> I hope this helps,
>>> John
>>>
>>> --
>>> John Fox, Professor Emeritus
>>> McMaster University
>>> Hamilton, Ontario, Canada
>>> web: https://socialsciences.mcmaster.ca/jfox/
>>> <https://socialsciences.mcmaster.ca/jfox/>
>>>
>>> On 2022-01-14 10:12 a.m., Paul Bernal wrote:
>>> > Dear R friends,
>>> >
>>> > Happy new year to you all. Not quite sure if this is the proper
>>> place to
>>> > ask about this, so I apologize if it is not, and if it isn´t,
>>> maybe you can
>>> > point me to the right place.
>>> >
>>> > I would like to know if there is any R package that allows me to
>>> produce
>>> > density ellipses. Searching through the net, I came across a
>>> package called
>>> > ellipse, but I'm not sure if this is the one I should use.
>>> >
>>> > Any help and/or guidance will be greatly appreciated.
>>> >
>>> > Best regards,
>>> >
>>> > Paul
>>> >
>>> > [[alternative HTML version deleted]]
>>> >
>>> > ______________________________________________
>>> > R-help using r-project.org <mailto:R-help using r-project.org> mailing list
>>> -- To UNSUBSCRIBE and more, see
>>> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> <https://stat.ethz.ch/mailman/listinfo/r-help>
>>> > PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> <http://www.R-project.org/posting-guide.html>
>>> > and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list