Hi All, I have codes as follows to get the ecdf plots: > day.hos2<-c(6,4,6,6,4,6,5,4,7,5,6,6,8,6,17,9,8,4,6,3,5,8,7,12,5,10,6,4,6 ,13,7,6,6,25,4,9,96,6,6,6,6,9,4,5,5,4,10,5,7,6) > day.hos3<-c(5,6,7,6,4,5,6,6,6,6,19,7,5,9,8,8,7,5,6,20,40,5,8,7,7,5,6,13, 11,9,4,6,9,16,6,7,6) > f<-ecdf(day.hos2) > plot(f,col.p='red',col.h='red') > g<-ecdf(day.hos3)> lines(g,lty=2)But in order to compare the two ecdf plots. I want to smooth the ecdf plot, make it like a continuous distribution curve. Could you please help me with it? I try to find some arguments in "plot" but not successful. Thank you! [[alternative HTML version deleted]]
Better idea: Compare directly. ?qqplot -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA "The business of the statistician is to catalyze the scientific learning process." - George E. P. Box> -----Original Message----- > From: r-help-bounces at stat.math.ethz.ch > [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Linda Lei > Sent: Thursday, April 20, 2006 10:08 AM > To: r-help at stat.math.ethz.ch > Subject: [R] smooth the ecdf plots > > Hi All, > > > > I have codes as follows to get the ecdf plots: > > > > > > day.hos2<-c(6,4,6,6,4,6,5,4,7,5,6,6,8,6,17,9,8,4,6,3,5,8,7,12, > 5,10,6,4,6 > ,13,7,6,6,25,4,9,96,6,6,6,6,9,4,5,5,4,10,5,7,6) > > > > > > day.hos3<-c(5,6,7,6,4,5,6,6,6,6,19,7,5,9,8,8,7,5,6,20,40,5,8,7 > ,7,5,6,13, > 11,9,4,6,9,16,6,7,6) > > > > > f<-ecdf(day.hos2) > > > > > plot(f,col.p='red',col.h='red') > > > > > g<-ecdf(day.hos3) > > > > > lines(g,lty=2) > > > > But in order to compare the two ecdf plots. I want to smooth the ecdf > plot, make it like a continuous distribution curve. Could you please > > help me with it? I try to find some arguments in "plot" but not > successful. > > > > Thank you! > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >
Linda Lei wrote:> Hi All, > > > > I have codes as follows to get the ecdf plots: > > > > > > day.hos2<-c(6,4,6,6,4,6,5,4,7,5,6,6,8,6,17,9,8,4,6,3,5,8,7,12,5,10,6,4,6 > ,13,7,6,6,25,4,9,96,6,6,6,6,9,4,5,5,4,10,5,7,6) > > > > > > day.hos3<-c(5,6,7,6,4,5,6,6,6,6,19,7,5,9,8,8,7,5,6,20,40,5,8,7,7,5,6,13, > 11,9,4,6,9,16,6,7,6) > > > > > f<-ecdf(day.hos2) > > > > > plot(f,col.p='red',col.h='red') > > > > > g<-ecdf(day.hos3) > > > > >>lines(g,lty=2) > > > > > But in order to compare the two ecdf plots. I want to smooth the ecdf > plot, make it like a continuous distribution curve. Could you please > > help me with it? I try to find some arguments in "plot" but not > successful. > > > > Thank you!Think about keeping them ECDFs and not distorting them. And you can superimpose two of them using thin blank lines for one and thicker gray scale lines for the other and be able to see them clearly. Use e.g. library(Hmisc) ?ecdf (look at groups argument) Someday I may rename ecdf in Hmisc to avoid confusion with the builtin ecdf function. Frank> > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University