Re: [R] Finding Lower Envelope of Points on a Plot?

From: Stephan Kolassa <Stephan.Kolassa_at_gmx.de>
Date: Wed, 30 Jun 2010 22:17:57 +0200

Hi,

To be honest, what you mean by "a (linear) lower envelope" becomes less and less clear to me. Take any cloud of 2-d points. The convex hull consists of a number of these points - or alternatively, of a number of line segments between successive ones of these points. Thus, every one of these segments defined by a pair of points on the bottom half of the convex hull would, if prolonged to infinity, define a line with all your points in the half-space above the line, which sounds a lot like what you seem to look for - in which case, "the" lower envelope would not be well-defined.

Or does your cloud of points have two points A and B such that all points are to the right of A and to the left of B and above the line AB? In this case, you could call the segment AB "the lower envelope" in your sense, but finding such A and B (if they exist) is trivial: look for the leftmost point, if there are multiple ones of these, take the bottom one, that's A, and the same for B.

Life would be easier for us if you provided a small reproducible example and told us what you expect the result to be.

HTH
Stephan

Asha Sharma schrieb:
> Hi,
>
> Thanks to both of you for taking the time to answer my question. I was
> maybe not very clear in the way I framed my question. By plot, I meant
> an x-y plot with a cloud of points which should have a linear lower
> envelope. Is there a way to both plot as well as get the parameters of
> the lower envelope (intercept, slope, etc.) and to also set the
> percentage of points outside it?
>
> Thanks!
>
> Asha
>
>
> Stephan Kolassa wrote:

>> Hi,
>>
>> one possibility would be to calculate the convex hull using chull(). I 
>> believe that the hull points are returned by chull() in a clockwise 
>> order (?), so the points between the rightmost and the leftmost point 
>> in the chull() result are the lower half of the convex hull. Remove 
>> these points from the original dataset (a variant of "peeling convex 
>> hulls") and iterate until you have removed your prespecified 
>> percentage of points - these all lie outside of the final lower hull 
>> (though the percentage will, of course, only be approximated, but you 
>> should be able to modify this to taste).
>>
>> HTH
>> Stephan
>>
>>
>> David Winsemius schrieb:
>>>
>>> On Jun 30, 2010, at 2:05 PM, Asha Sharma wrote:
>>>
>>>> Hi,
>>>>
>>>> I am looking for a way to find the lower envelope of points on a 
>>>> plot, preferably specifying what percentage of points should be 
>>>> allowed to lie outside the envelope. There must be a straightforward 
>>>> way to do this, but I do not seem to be able to find it. I would 
>>>> greatly appreciate any help.
>>>
>>> You probably want something like the "lower half" of the convex hull. 
>>> You should find quite a bit of code with your favorite r search 
>>> engine on the topic of "convex hull".
>>
>

______________________________________________
R-help_at_r-project.org mailing list
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. Received on Wed 30 Jun 2010 - 20:20:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 30 Jun 2010 - 20:41:02 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive