Statalist


[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 <[email protected]>
To   stata list <[email protected]>
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

-----------------------------------------
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

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com

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



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