An alternative (with Toyoto's data) could be
twoway histogram n [fw=freq] , discrete w(0.5) || line p n
Nick
[email protected]
Natarajan Ramachandran
> Does anyone know how to superimpose a bar chart graph with a
> line graph using Stata? Specifically, I want to know how to
> use Stata 8.0 graphs to superimpose a discrete outcome bar
> chart with its Poisson probability line graph.
Toyoto Iwata
If you have this data,
.input n freq
1. 3 1
2. 2 2
3. 1 5
4. 0 10
5. end
. di 12/18
.66666667
dicrete probabilities should be
. gen p = ((12/18)^n)/(exp(lnfact(n))*exp(12/18))
. list
+---------------------+
| n freq p |
|---------------------|
1. | 3 1 .0253539 |
2. | 2 2 .1140927 |
3. | 1 5 .3422781 |
4. | 0 10 .5134171 |
+---------------------+
. gen p20 = 20*p
. graph twoway bar freq n || line p20 n, title(`""poisson" distribution"')
Perhaps this graph may be so rough for Ramachandran
that you have to browse over the graphics manual.
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/