hello!

I am trying to calculate the average salary by state (`STATEFIP`

), for educational attainment (`EDUCD`

).

I’ve filtered the DF for employment status, age and a whole host of other criteria. However, when I sum the `INCWAGE`

and `PERWT`

up by state, then divide `INCWAGE`

by the summed `PERWT`

I am getting really low estimated. Is my approach correct? Is this something I should use replicate weights for?

Am I using the wrong weights? BTW this data is only for 2021

For example:

Any help would be greatly appreciated!

Hi Tom,

Your method of dividing the sum of INCWAGE by the sum of PERWT by state treats each value of INCWAGE as having equal weight. In order to calculate a weighted mean, you will need to find the product of INCWAGE and PERWT for each observation, sum this product for all observations within a given state, and then divide this sum by the sum of PERWT for the state. Please note that values of 999999 refer to respondents who are not in the universe for INCWAGE and 999998 refers to missing values. Replicate weights should be used to calculate standard errors, but they will not affect your point estimates.

IPUMS USA also offers an online analysis system that can calculate means without requiring users to download data themselves. I’m attaching a screenshot of the type of analysis you might run and the corresponding output screen.