Statalist


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

st: RE: Mean


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Mean
Date   Fri, 23 Jan 2009 17:54:36 -0000

Check out 

1. David Kantor's -wtmean()- function for -egen- from 

. ssc inst _gwtmean 

And 

2. The FAQ 

FAQ     . . Calculating variables containing weighted group summary
statistics
        . . . . . . . . . . . . . . . . . . . . .  N. J. Cox and S. P.
Jenkins
        1/03    I want to calculate a variable containing weighted
                group summary statistics, but I do not want to
                collapse the data and egen does not support weights.
                How can I do this?
                http://www.stata.com/support/faqs/data/weighted.html

Nick 
[email protected] 

[email protected]


I have to create a variable that compute the mean of varname (y) for a 
particular area (area=1)and conditioned to an other variable (x, that 
assumes value equals to 1,2,3,4,6),so I would calculate the mean of 
y|x=1 in area=1, the mean of y|x=2 in area=1, and so on. I typed

egen mean=mean(y) if area==1, by (x)

but I have to introduce aweight to this computation, how can I do?

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



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