# st: RE: RE: bihistogram

 From "Rajesh Tharyan" To Subject st: RE: RE: bihistogram Date Tue, 26 Aug 2008 13:54:27 +0100

```Thank you very much nick,

I will check that out..

rajesh

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 26 August 2008 12:50
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: bihistogram

A bihistogram -- I didn't know before searching -- is a dual histogram
with one group's frequencies shown as negative.

Rajesh found nothing, but -search histogram- points to this:

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

The text is accessible to all via
<http://www.stata-journal.com/sjpdf.html?articlenum=gr0014>

That includes a worked example.

Here is another:

sysuse auto, clear
twoway__histogram_gen mpg if foreign, width(2) start(10) freq ///
gen(freq_foreign mpg_foreign)
twoway__histogram_gen mpg if !foreign, width(2) start(10) freq ///
gen(freq_domestic mpg_domestic)
replace freq_foreign = -freq_foreign
twoway bar freq_foreign mpg_foreign, barw(2) || ///
bar freq_domestic mpg_domestic, barw(2) ///
legend(order(1 "Foreign" 2 "Domestic"))

Nick
n.j.cox@durham.ac.uk

Rajesh Tharyan

Is it possible to produce a bihistogram in stata? Nothing turns up on
findit
or search. I was trying to write a program to do that. But can one get
stata
to produce histogram with -ve frequencies?

*
*   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/
```