[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: RE: categorising continuous variable and generating mean outcome |

Date |
Wed, 18 Feb 2009 11:45:59 -0000 |

It seems that you are not tied to anything much beyond the idea of seeing a graphical summary of Y w.r.t. X. If that's so, any number of wired-in commands can get you there in one, e.g. -twoway mband-, -lowess-, -lpoly-, etc. But they are not always sensitive to binary variables, if that's what you have, so that in some cases the summary can be reported as outside [0,1]. If you have a continuous proportion, the same proviso applies, but less so. Nick n.j.cox@durham.ac.uk Galina Hayes Thanks Howie, definitely helpful. "Howard Lempel" <HLempel@brookings.edu> One way to do this would start by using -xtile- to create a variable with the decile of X for each observation. Then -collapse- X and Y by your decile variable to get the mean of Y and median of X for each of the ten categories. You can then plot meanY against medianX. See -help xtile- and -help collapse-. Galina Hayes I am sure there is a very simple solution to this but it has me foxed. I have two variables, Y coded as (0,1) and X which is continous. I want to break x down into 10 equal size categories (by range or percentiles, doesn't matter) and generate the mean of Y for each of the 10 categories (call it meanY) and then plot meanY against the centre value of each X category. Does this make sense? Seems like it should be easy, * * 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/

**References**:**st: RE: categorising continuous variable and generating mean outcome***From:*Howard Lempel <HLempel@brookings.edu>

**Re: st: RE: categorising continuous variable and generating mean outcome***From:*Galina Hayes <galina@uoguelph.ca>

- Prev by Date:
**RE: st: RE: A problem with temporary file** - Next by Date:
**st: RE: Problem accessing SSC new** - Previous by thread:
**Re: st: RE: categorising continuous variable and generating mean outcome** - Next by thread:
**st: Fwd: Adding rows in the middle of dataset** - Index(es):

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