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

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

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

Subject |
st: AW: Compute mean for groups leaving one member out |

Date |
Fri, 23 Oct 2009 09:41:30 +0200 |

<> "Could you suggest a simple way of doing this?" Taking a cue from Nick`s FAQ cited earlier: ************* clear* set obs 40 gen country=_n gen quarter=quarterly("1990:1", "YQ") expand 68 bys country: /* */ replace quarter=quarter+_n-1 format quarter %tq gen icrg=rnormal(10,100) //calculate mean bys quarter: egen totalicrg= /* */ total(icrg) //divide by # of countries-1 gen mymean=(totalicrg-icrg)/39 //10 random checks... forv i=1/10{ local a= 1+int(`c(N)'*runiform()) l country quarter mymean in `a' su icrg if quarter==quarter[`a'] /* */ & country!=country[`a'] } ************* HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von kokootchke Gesendet: Freitag, 23. Oktober 2009 07:39 An: statalist Betreff: st: Compute mean for groups leaving one member out Dear all: I have a panel dataset of 40 countries at quarterly frequency from 1990:1 to 2006:4. I would like to compute the average of a variable (called icrg) for all countries in a given time period. My problem is that in doing this computation, I would like to leave one country out of the calculation. For example, in period 1990:1 for Mexico, I would like to compute the average of icrg for ALL other countries in this period EXCLUDING Mexico. Could you suggest a simple way of doing this? Thank you very much. Best, Adrian _________________________________________________________________ Windows 7: It helps you do more. Explore Windows 7. http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PID24727::T:WLM TAGL:ON:WL:en-US:WWL_WIN_evergreen3:102009 * * 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**:**st: RE: AW: Compute mean for groups leaving one member out***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: Random walk simplex***From:*"Akshay Shanker" <Akshay.Shanker@standards.org.au>

**st: Compute mean for groups leaving one member out***From:*kokootchke <kokootchke@hotmail.com>

- Prev by Date:
**st: AW: Compute mean for groups leaving one member out** - Next by Date:
**st: new version of proprcspline available** - Previous by thread:
**st: AW: Compute mean for groups leaving one member out** - Next by thread:
**st: RE: AW: Compute mean for groups leaving one member out** - Index(es):

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