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

From |
Galina Hayes <galina@uoguelph.ca> |

To |
statalist@hsphsun2.harvard.edu |

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

Date |
Tue, 17 Feb 2009 20:02:22 -0500 (EST) |

Thanks Howie, definitely helpful. Galina ----- Original Message ----- From: "Howard Lempel" <HLempel@brookings.edu> To: statalist@hsphsun2.harvard.edu Sent: Tuesday, February 17, 2009 7:36:20 PM GMT -05:00 US/Canada Eastern Subject: st: RE: categorising continuous variable and generating mean outcome Galina, 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-. Hope this helps. Howie -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Galina Hayes Sent: Tuesday, February 17, 2009 7:25 PM To: statalist@hsphsun2.harvard.edu Subject: st: categorising continuous variable and generating mean outcome Evening all, 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, Thanks Galina * * 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/ * * 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/ * * 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/

**Follow-Ups**:**RE: st: RE: categorising continuous variable and generating mean outcome***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

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

- Prev by Date:
**st: RE: categorising continuous variable and generating mean outcome** - Next by Date:
**Re: st: RE: A problem with temporary file** - Previous by thread:
**st: RE: categorising continuous variable and generating mean outcome** - Next by thread:
**RE: st: RE: categorising continuous variable and generating mean outcome** - Index(es):

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