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

From |
jjc.li@utoronto.ca |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: how to express the mean of a variable in a calculation? |

Date |
Tue, 07 Jul 2009 22:36:24 -0400 |

Thank you Joseph and Kit! But there's an error in my calculation: . di `slpmean1' .22114205 . nlcom (_b[halflnpllnpl]+slpmean1*slpmean1-slpmean1)/(slpmean1*slpmean1) slpmean1 not found r(111); Hope you can help we with it. Thanks again. Crystal Quoting Joseph McDonnell <jockmcdock@gmail.com>:

quietly summarize x2 if year>=1 & year<=5 display r(mean) local x2mean1_5=r(mean) di `x2mean1_5' you can then use x2mean1_5 in your calculations. You can, in principle, use r(mean) but this will be wiped on the next r-class command. If you want the mean for each individual year, you could use a loop forvalues yr=1(1)5 { quietly summarize x2 if year==`yr' local mean`yr'=r(mean) } di `mean1' di `mean5' Cheers Joseph 2009/7/8 <jjc.li@utoronto.ca>:Dear all, I am going to calculate sth after the the regression. I know _b[x1] represents the coef. of variable x1. But how to express the mean of variable x2, in particular just the mean of x2 from year 1 to year 5 (let's say there are total 10 years)? Thanks! Crystal * * 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/

**References**:**st: how to express the mean of a variable in a calculation?***From:*jjc.li@utoronto.ca

**Re: st: how to express the mean of a variable in a calculation?***From:*Joseph McDonnell <jockmcdock@gmail.com>

- Prev by Date:
**Re: st: RE: Converting a continuous var into a binary var** - Next by Date:
**Re: st: how to express the mean of a variable in a calculation?** - Previous by thread:
**Re: st: how to express the mean of a variable in a calculation?** - Next by thread:
**Re: st: how to express the mean of a variable in a calculation?** - Index(es):

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