[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: -tabulate- and ratio "number of 1/number of 0"

From   Maarten buis <>
To   stata list <>
Subject   RE: st: -tabulate- and ratio "number of 1/number of 0"
Date   Wed, 6 Feb 2008 11:52:06 +0000 (GMT)

---  "Herve STOLOWY" wrote:
> I have a dummy variable "small_profit" and use the -tabulate-
> command for several countries. <snip> I am looking for a way to get
> the ratio: number of "1"/number of "0".

You can do so manually, like so:
*-------------- begin example --------------
sysuse auto, clear
contract rep78 foreign
reshape wide _freq, i(rep78) j(foreign)
recode _freq0 .=0
recode _freq1 .=0

gen odds = _freq1/_freq0 

tabdisp rep78 if rep78 < ., cellvar(odds)
*------------- end example -----------------

Or use -tabodds-, since the ratio of the number of failures over the
number of successes is just the odds of failure. 

*----------- begin example -----------------
sysuse auto, clear
tabodds foreign rep78
*------------ end example ------------------

(I reccomend the latter strategy, as it is much easier, does not
destroy your data, and gives you confidence intervals)

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Sent from Yahoo! Mail - a smarter inbox

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index