I was wondering if there are any easy way to read the histogram that
state created. Specially, I would to know exactly what bins were created and how many observations are in each bin. After drawing the histogram, I thought I would be able to see this information using some "return" type of command, but clearly that does not seem to be the case. I looked at the manual but did not see any such commands either. I looked at the STATA listserv and I was surprised to see that this issue has not arisen before. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
ssc inst byhist
sysuse auto byhist mpg mat li r(b) On Mon, Dec 8, 2008 at 12:01 PM, Richard Boylan <[hidden email]> wrote: > I was wondering if there are any easy way to read the histogram that > state created. > > Specially, I would to know exactly what bins were created and how many > observations are in each bin. > > After drawing the histogram, I thought I would be able to see this > information using some "return" type of command, > but clearly that does not seem to be the case. I looked at the manual > but did not see any such commands either. > > I looked at the STATA listserv and I was surprised to see that this > issue has not arisen before. * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Thanks. That does exactly what I asked for, but the command "byhist"
does not allow two options that I was using. First, I was using the option "by(var1 var2)" and byhist seem to only allow "by(var1)." Second, I was using the option "scheme(s2mono)" which byhist does not allow. On Mon, Dec 8, 2008 at 11:06 AM, Austin Nichols <[hidden email]> wrote: > ssc inst byhist > sysuse auto > byhist mpg > mat li r(b) > > On Mon, Dec 8, 2008 at 12:01 PM, Richard Boylan <[hidden email]> wrote: >> I was wondering if there are any easy way to read the histogram that >> state created. >> >> Specially, I would to know exactly what bins were created and how many >> observations are in each bin. >> >> After drawing the histogram, I thought I would be able to see this >> information using some "return" type of command, >> but clearly that does not seem to be the case. I looked at the manual >> but did not see any such commands either. >> >> I looked at the STATA listserv and I was surprised to see that this >> issue has not arisen before. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
" Second, I was using the option "scheme(s2mono)" which byhist does not
allow." After running "byhist", pull down "Edit- Apply Scheme" in the Graph Window and apply your desired scheme... HTH Martin -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Richard Boylan Sent: Monday, December 08, 2008 6:21 PM To: [hidden email] Subject: Re: st: histogram, read axes Thanks. That does exactly what I asked for, but the command "byhist" does not allow two options that I was using. First, I was using the option "by(var1 var2)" and byhist seem to only allow "by(var1)." Second, I was using the option "scheme(s2mono)" which byhist does not allow. On Mon, Dec 8, 2008 at 11:06 AM, Austin Nichols <[hidden email]> wrote: > ssc inst byhist > sysuse auto > byhist mpg > mat li r(b) > > On Mon, Dec 8, 2008 at 12:01 PM, Richard Boylan <[hidden email]> wrote: >> I was wondering if there are any easy way to read the histogram that >> state created. >> >> Specially, I would to know exactly what bins were created and how many >> observations are in each bin. >> >> After drawing the histogram, I thought I would be able to see this >> information using some "return" type of command, >> but clearly that does not seem to be the case. I looked at the manual >> but did not see any such commands either. >> >> I looked at the STATA listserv and I was surprised to see that this >> issue has not arisen before. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Line for the server...
Or, better still, toss it into the call to -byhist- within its -tw()- option so the -scheme- gets passed through... "byhist mpg, tw(scheme(s2mono))" HTH Martin -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Martin Weiss Sent: Monday, December 08, 2008 6:31 PM To: [hidden email] Subject: RE: st: histogram, read axes " Second, I was using the option "scheme(s2mono)" which byhist does not allow." After running "byhist", pull down "Edit- Apply Scheme" in the Graph Window and apply your desired scheme... HTH Martin -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Richard Boylan Sent: Monday, December 08, 2008 6:21 PM To: [hidden email] Subject: Re: st: histogram, read axes Thanks. That does exactly what I asked for, but the command "byhist" does not allow two options that I was using. First, I was using the option "by(var1 var2)" and byhist seem to only allow "by(var1)." Second, I was using the option "scheme(s2mono)" which byhist does not allow. On Mon, Dec 8, 2008 at 11:06 AM, Austin Nichols <[hidden email]> wrote: > ssc inst byhist > sysuse auto > byhist mpg > mat li r(b) > > On Mon, Dec 8, 2008 at 12:01 PM, Richard Boylan <[hidden email]> wrote: >> I was wondering if there are any easy way to read the histogram that >> state created. >> >> Specially, I would to know exactly what bins were created and how many >> observations are in each bin. >> >> After drawing the histogram, I thought I would be able to see this >> information using some "return" type of command, >> but clearly that does not seem to be the case. I looked at the manual >> but did not see any such commands either. >> >> I looked at the STATA listserv and I was surprised to see that this >> issue has not arisen before. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
In reply to this post by Richard Boylan
How about this?
cap ssc inst byhist sysuse auto egen g=group(for rep78), label byhist mpg, by(g) tw(scheme(s2mono) leg(col(1))) mat li r(b) la li g On Mon, Dec 8, 2008 at 12:21 PM, Richard Boylan <[hidden email]> wrote: > Thanks. That does exactly what I asked for, but the command "byhist" > does not allow two options that I was using. > > First, I was using the option "by(var1 var2)" and byhist seem to only > allow "by(var1)." > > Second, I was using the option "scheme(s2mono)" which byhist does not allow. > > On Mon, Dec 8, 2008 at 11:06 AM, Austin Nichols <[hidden email]> wrote: >> ssc inst byhist >> sysuse auto >> byhist mpg >> mat li r(b) >> >> On Mon, Dec 8, 2008 at 12:01 PM, Richard Boylan <[hidden email]> wrote: >>> I was wondering if there are any easy way to read the histogram that >>> state created. >>> >>> Specially, I would to know exactly what bins were created and how many >>> observations are in each bin. >>> >>> After drawing the histogram, I thought I would be able to see this >>> information using some "return" type of command, >>> but clearly that does not seem to be the case. I looked at the manual >>> but did not see any such commands either. * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Thank you so much. It is different from my original graphs, but it may
be better. I will have to play around with it. On Mon, Dec 8, 2008 at 11:41 AM, Austin Nichols <[hidden email]> wrote: > How about this? > > cap ssc inst byhist > sysuse auto > egen g=group(for rep78), label > byhist mpg, by(g) tw(scheme(s2mono) leg(col(1))) > mat li r(b) > la li g > > On Mon, Dec 8, 2008 at 12:21 PM, Richard Boylan <[hidden email]> wrote: >> Thanks. That does exactly what I asked for, but the command "byhist" >> does not allow two options that I was using. >> >> First, I was using the option "by(var1 var2)" and byhist seem to only >> allow "by(var1)." >> >> Second, I was using the option "scheme(s2mono)" which byhist does not allow. >> >> On Mon, Dec 8, 2008 at 11:06 AM, Austin Nichols <[hidden email]> wrote: >>> ssc inst byhist >>> sysuse auto >>> byhist mpg >>> mat li r(b) >>> >>> On Mon, Dec 8, 2008 at 12:01 PM, Richard Boylan <[hidden email]> wrote: >>>> I was wondering if there are any easy way to read the histogram that >>>> state created. >>>> >>>> Specially, I would to know exactly what bins were created and how many >>>> observations are in each bin. >>>> >>>> After drawing the histogram, I thought I would be able to see this >>>> information using some "return" type of command, >>>> but clearly that does not seem to be the case. I looked at the manual >>>> but did not see any such commands either. > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
In reply to this post by Richard Boylan
What Stata does graphically with -histogram- can be replicated
numerically using the -twoway__histogram_gen- command. This was written up in SJ-5-2 gr0014 . . . . . . . Stata tip 20: Generating histogram bin variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . D. A. Harrison Q2/05 SJ 5(2):280--281 (no commands) tip illustrating the use of twoway__histogram_gen for creation of complex histograms and other graphs or tables which is accessible to all under the Stata Journal's 3 year window. Example: sysuse auto twoway__histogram_gen mpg, width(2) start(10) gen(freq centre) freq l freq centre if centre < . Nick [hidden email] Richard Boylan I was wondering if there are any easy way to read the histogram that state created. Specially, I would to know exactly what bins were created and how many observations are in each bin. After drawing the histogram, I thought I would be able to see this information using some "return" type of command, but clearly that does not seem to be the case. I looked at the manual but did not see any such commands either. I looked at the STATA listserv and I was surprised to see that this issue has not arisen before. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Thanks, although the option "by()" is not allowed with
twoway__histogram_gen mpg On Mon, Dec 8, 2008 at 12:05 PM, Nick Cox <[hidden email]> wrote: > What Stata does graphically with -histogram- can be replicated > numerically using the -twoway__histogram_gen- command. This was written > up in > > SJ-5-2 gr0014 . . . . . . . Stata tip 20: Generating histogram bin > variables > . . . . . . . . . . . . . . . . . . . . . . . . . . . . D. A. > Harrison > Q2/05 SJ 5(2):280--281 (no > commands) > tip illustrating the use of twoway__histogram_gen for > creation of complex histograms and other graphs or tables > > which is accessible to all under the Stata Journal's 3 year window. > > Example: > > sysuse auto > twoway__histogram_gen mpg, width(2) start(10) gen(freq centre) freq > l freq centre if centre < . > > Nick > [hidden email] > > Richard Boylan > > I was wondering if there are any easy way to read the histogram that > state created. > > Specially, I would to know exactly what bins were created and how many > observations are in each bin. > > After drawing the histogram, I thought I would be able to see this > information using some "return" type of command, > but clearly that does not seem to be the case. I looked at the manual > but did not see any such commands either. > > I looked at the STATA listserv and I was surprised to see that this > issue has not arisen before. > > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ > * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Richard Boylan <[hidden email]>:
If you want to loop over values and run -twoway__histogram_gen- for each distinct value, you can use -levelsof- and -foreach-. -byhist- on SSC uses the "total" category to pick bins using -twoway__histogram_gen-, i.e. it uses the marginal distribution across all by() groups. In general, if you are comparing histograms it is advantageous to use a common bin specification IMHO. On Mon, Dec 8, 2008 at 2:11 PM, Richard Boylan <[hidden email]> wrote: > Thanks, although the option "by()" is not allowed with > twoway__histogram_gen mpg * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ |
Free forum by Nabble | Edit this page |