[R] [FORGED] Re: Quantile Density Contours

peter dalgaard pd@|gd @end|ng |rom gm@||@com
Thu Mar 28 00:46:17 CET 2019


You might be wishing for a contour plot of the density, labeled by the probability mass outside of each contour, but there is no general simple connection between density contours and the mass inside of them. You can work it out (I think) for elliptically contoured distributions, but I suspect that is about all.

You can do contours of the multivariate CDF, but that comes with its own set of issues, e.g. that F(x,y) = 0.1 means P(X <= x, Y <= y) = 0.1, so contour lines consist of points with the same probability mass to the "south-west" of them.

-pd

> On 27 Mar 2019, at 22:20 , Bernard Comcast <mcgarvey.bernard using comcast.net> wrote:
> 
> That thought had crossed my mind so thanks for that clarification Bert. i think you are correct and so the plot I am looking at must be doing something different than I was thinking.
> 
> Thanks
> 
> Bernard
> Sent from my iPhone so please excuse the spelling!"
> 
>> On Mar 27, 2019, at 5:18 PM, Bert Gunter <bgunter.4567 using gmail.com> wrote:
>> 
>> You are missing a crucial point. The reals are well ordered; higher dimensions are not. Therefore 2d quantile contours are not unique. 
>> 
>> Of course assuming I understand your query correctly.
>> 
>> 
>> Bert
>> 
>>> On Wed, Mar 27, 2019, 13:55 Bernard McGarvey <mcgarvey.bernard using comcast.net> wrote:
>>> If I understand correctly the ContourLines function gives you the contour lines when you put in the data. But before this I need to data to put into that function. I think this is something like a 2D CDF of the data that then leads to the 2D quantiles but I am not 100% sure. What I am basically looking for is the 2D curve that encloses say 95% of the data in a similar fashion to a 1D quantile where the quantile represents the value that x% of the data is below. I think what I am looking for is the 2D bivariate version of the 1D quantile plot (where the quantile value is plotted vs the % value).
>>> 
>>> I hope this makes some sense.
>>> 
>>> Bernard McGarvey
>>> 
>>> 
>>> Director, Fort Myers Beach Lions Foundation, Inc.
>>> 
>>> 
>>> Retired (Lilly Engineering Fellow).
>>> 
>>> 
>>>> On March 27, 2019 at 3:57 PM Paul Murrell <paul using stat.auckland.ac.nz> wrote:
>>>> 
>>>> 
>>>> 
>>>> Are you looking for the contourLines() function ?
>>>> 
>>>> Paul
>>>> 
>>>> On 28/03/19 8:37 AM, Bernard McGarvey wrote:
>>>>> John, I have attached a pdf of the plot. Hopefully you can read this.
>>>>> 
>>>>> If I understand correctly, this plot is basically the 2-D version of the 1-D quantile plot.
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bernard McGarvey
>>>>> 
>>>>> 
>>>>> Director, Fort Myers Beach Lions Foundation, Inc.
>>>>> 
>>>>> 
>>>>> Retired (Lilly Engineering Fellow).
>>>>> 
>>>>> 
>>>>>> On March 27, 2019 at 7:44 AM John Kane <jrkrideau using gmail.com> wrote:
>>>>>> 
>>>>>> 
>>>>>> The figure did not get  through. Perhaps try a pdf?
>>>>>> 
>>>>>> On Tue, 26 Mar 2019 at 13:41, Bernard McGarvey
>>>>>> <mcgarvey.bernard using comcast.net> wrote:
>>>>>>> 
>>>>>>> I want to see if I can reproduce the plot below in R. If I understand it correctly, i takes my bivariate data and creates quantile density contours. My interpretation of these contours is that they enclose a certain % of the total data. I am using the bkde2D function in library KernSmooth which gives density values that can be plotted on a contour plot but I would like the curves that enclose a given % of the data, if that is possible
>>>>>>> 
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Bernard McGarvey
>>>>>>> 
>>>>>>> Director, Fort Myers Beach Lions Foundation, Inc.
>>>>>>> 
>>>>>>> Retired (Lilly Engineering Fellow).
>>>>>>> 
>>>>>>> 
>>>>>>> ______________________________________________
>>>>>>> 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.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> John Kane
>>>>>> Kingston ON Canada
>>>>>> 
>>>>>> ______________________________________________
>>>>>> 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.
>>>> 
>>>> -- 
>>>> Dr Paul Murrell
>>>> Department of Statistics
>>>> The University of Auckland
>>>> Private Bag 92019
>>>> Auckland
>>>> New Zealand
>>>> 64 9 3737599 x85392
>>>> paul using stat.auckland.ac.nz
>>>> http://www.stat.auckland.ac.nz/~paul/
>>> 
>>> ______________________________________________
>>> 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.
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd.mes using cbs.dk  Priv: PDalgd using gmail.com



More information about the R-help mailing list