Hi, I use a vector of data to draw the histogram, but it is different from the graph by SAS. Can you check it for me please? b is a column vector of 4332 hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) rug(b) When I used rug, I find the records are smaller than 4332. I don't know where I did wrong. Thanks. -- Yi Du [[alternative HTML version deleted]]
Hi, On Wed, Jan 13, 2010 at 12:58 PM, Yi Du <abraham.du at gmail.com> wrote:> Hi, > > > I use a vector of data to draw the histogram, but it is different from the > graph by SAS. Can you check it for me please?How are we supposed to check something without data, pictures, etc? What do you want checking, exactly?> b is a column vector of 4332 > > hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) > rug(b) > > When I used rug, I find the records are smaller than 4332. I don't know > where I did wrong.What do you mean? Is the histogram that you're getting surprising? Is the result of adding a "rug" surprising? Are you actually trying to count 4332 tick marks at the bottom of your plot? What records are smaller than 4332? Try to see if what rug returns, eg: r <- rug(b) length(r) should be as long as your `b` vector I'm not sure what you're asking, but hopefully some of the info I threw at you is helpful. Please be a bit more specific with any follow up if you still find anything confusing. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
If I do b <- rnorm(4332) hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) rug(b) The plot looks entirely reasonable. As far as being different from SAS, perhaps SAS and R use different breakpoints, that is, different boundaries between the histogram bars. -Don At 11:58 AM -0600 1/13/10, Yi Du wrote:>Hi, > > >I use a vector of data to draw the histogram, but it is different from the >graph by SAS. Can you check it for me please? > >b is a column vector of 4332 > >hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) >rug(b) > >When I used rug, I find the records are smaller than 4332. I don't know >where I did wrong. > >Thanks. > >-- >Yi Du > > [[alternative HTML version deleted]] > >______________________________________________ >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.-- -------------------------------------- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062
Thanks all, I fixed it. On Wed, Jan 13, 2010 at 2:47 PM, Don MacQueen <macq@llnl.gov> wrote:> If I do > > b <- rnorm(4332) > hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) > rug(b) > > The plot looks entirely reasonable. > > As far as being different from SAS, perhaps SAS and R use different > breakpoints, that is, different boundaries between the histogram bars. > > -Don > > At 11:58 AM -0600 1/13/10, Yi Du wrote: > >> Hi, >> >> >> I use a vector of data to draw the histogram, but it is different from the >> graph by SAS. Can you check it for me please? >> >> b is a column vector of 4332 >> >> hist(b,probability=T,breaks=30,col='lightblue',ylim=c(0,1)) >> rug(b) >> >> When I used rug, I find the records are smaller than 4332. I don't know >> where I did wrong. >> >> Thanks. >> >> -- >> Yi Du >> >> [[alternative HTML version deleted]] >> >> ______________________________________________ >> R-help@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. >> > > > -- > -------------------------------------- > Don MacQueen > Environmental Protection Department > Lawrence Livermore National Laboratory > Livermore, CA, USA > 925-423-1062 > -------------------------------------- >-- Yi Du Ph. D student in Economics University of Missouri Department of Economics 118 Professional Building Columbia MO 65211 1-573-239-6467 [[alternative HTML version deleted]]