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. Thanks for your time, Asha
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". -- David Winsemius, MD West Hartford, CT
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".
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". >
On Jun 30, 2010, at 4:02 PM, Asha Sharma wrote:> 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?I suspect you are requesting a scatterplot with a superimposed linear fit and 5% and 95% prediction intervals. Not much point in pursuing until you "confirm or deny". -- David> > 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.David Winsemius, MD West Hartford, CT
Hello, I am trying to color particular labels on my lattice xyplot. For example: library(lattice) z = data.frame(x = 1:5) xyplot(x~x, z) Is there any way for me to make the "4" on the y-axis blue? Thanks, Andy
On Jun 30, 2010, at 7:38 PM, Andrew Liu wrote:> Hello, > > I am trying to color particular labels on my lattice xyplot. > > For example: > > library(lattice) > z = data.frame(x = 1:5) > xyplot(x~x, z) > > Is there any way for me to make the "4" on the y-axis blue?xyplot(x~x, z, scales=list(x=list(col=c("black", "black","black","red","blue"))))> > Thanks, > Andy > > ______________________________________________ > 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.