This refers to -spineplot- from the SJ.
You need to -generate- your own.
I thought of adding something like that to -spineplot-, but
1. Life is short. Something else supervened.
2. Sometimes it seems a better contribution not to add more options and
further complicate a command, especially if there are several
possibilities that suggest themselves and users can do it upstream of a
command anyway.
Suppose for example you went
. sysuse auto
. bysort foreign rep78 : gen freq = _N
. by foreign : gen colfreq = _N
. bysort rep78 : gen rowfreq = _N
. count if !missing(foreign, rep78)
. local total = r(N)
Then you can -generate- percents:
. gen percent = 100 * freq / `total'
. gen rowpercent = 100 * freq / rowfreq
. gen colpercent = 100 * freq / colfreq
In practice, you will want to -round()- to the nearest percent or to one
decimal place. Often, you will want to make the text crisp and clear by
adding a call to option -mlabsize()-.
If you only want to plot a subset of observations, do this kind of thing
between
. preserve
. keep if <interesting and useful>
and
. restore
Nick
[email protected]
[email protected]
Thanks.
Is there an easy way to get percentages in the middle of each of those
boxes? Or do I have to generate my own and use text()?
--- Maarten buis <[email protected]> wrote:
> A nice alternative is the spineplot (implemented in Stata by Nick
> Cox)
*
* 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/