# How to calculate MoE for subsamples

I have demographic and income data for 3 million people from the American Community Survey (courtesy of IPUMS), and my goal is calculate the median income for every permutation of age group, gender, education level, and marital status.

As one can imagine, even with this large sample -- 1% of the population -- there are some combinations that are very uncommon. While there are 22,771 unmarried female high school graduates between 18-21 in the sample, there are only 17 divorced men between 26 and 30 with a professional degree.

IPUMS also helpfully estimates the number of people that each person in their data represents, so I have a sense for the total size of the subpopulation. This is typically around 100 times as many people as in the subsample, but varies a bit. There are an estimated 2,425,151 unmarried female high school graduates between 18-21, and an estimated 2,159 divorced men between 26 and 30 with a professional degree, for example.

For each group, I'm calculating the "weighted median" annual income -- median value taking into account the provided weights. (The values differ from the raw median very little).

I need to calculate some sort of confidence metric for each combination of demographic values to decide which ones I should be using. I've read up on Standard Error, Margin of Error, etc., but I'm having difficult understanding which metric applies to this situation where I'm dealing with different parts of one large sample.