Clint Thompson
> I am using Intercooled STATA 8 and I want to create a frequency
> polygon (yes, a simple & elementary request), however, I am
> unable to find any command in STATA that will return what I
> need. Any suggestions??
Lee Sieswerda
> Something like this will get you started:
>
> sysuse auto
> table rep78, replace
> twoway line table1 rep78
>
> If you want to show the "histogram" as well you can add an
> overlay (or
> underlay in this case)
>
> twoway bar table1 rep78 || line table1 rep78
>
> If you data are continuous and not already conveniently
> binned, then you'll
> have to use an appropriate function to create your
> categories before running
> -table-.
More than that, you would need to fill in explicit
zeros for bins in gaps not represented in the data.
For example, contemplate the results of
. histogram mpg, w(2)
For a one-off, you could just add a few data points
interactively, or do something like this:
gen freq = .
local j = 1
qui forval i = 10(2)42 {
count if mpg >= `i' & mpg < `=`i' + 2'
replace freq = r(N) in `j++'
}
gen mpg2 = 8 + 2 * _n if freq < .
_crcslbl mpg2 mpg
twoway line freq mpg2
Nick
[email protected]
*
* 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/