Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: calculating an average within group means with specific weights


From   Jordan Nickerson {msbcb755} <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: calculating an average within group means with specific weights
Date   Tue, 8 Jan 2013 20:16:09 +0000

Hello,

I've been scratching my head trying to figure this out all morning.

I have a set of observations (call the variable of interest size) that can be segmented with 3 distinct variables (you can call them gender, state, and year). The ultimate goal will be to compute the average for each gender across years, while weighting appropriately for the proportion of all observations from a given state. 

As an example, suppose the % of the observations from different states are as follows: Texas = 50%, Ohio = 30%, Florida = 20%.

I'm trying to find a robust way to calculate the mean (and SEs) of size for both genders in each year, after controlling for the state in the following way.

Suppose the averages are as follows:
Avg(Size | Male, Texas, 2000) = 20
Avg(Size | Male, Ohio, 2000) = 30
Avg(Size | Male, Florida, 2000) = 40

The desired end result would be 20 * .5 + 30 * .3 + 40 * .2 = 27 for males in 2000

I've tried mean size [fweight=X] if gender = "Male", over(year) for any possible permutation of X (% of obs per state, % of obs per state / % obs per state-year, and so on...)

Is there something that I'm missing?

Thanks
Jordan
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index