Good afternoon,

I am using survey data and because I need to account for the sampling & pweights, I'm using svy command for my analysis. I am wondering how to correctly obtain the median values. Currently, I am using epctile (sample code below), but the median value I am obtaining is outside of the 95% CI range I get within the weighted mean in the svy command, even though it allows me to apply the pweights. This seems odd, though one option I thought would be to report the 95% CI of both the mean and median separately. Any insights would be incredibly welcome!


. svy, subpop(if analytical_pop==1 & first_cancer==wave): mean percent_asset_change1
(running mean on estimation sample)

Survey: Mean estimation

Number of strata = 51 Number of obs = 15,736
Number of PSUs = 102 Population size = 71,582,508
Subpop. no. obs = 263
Subpop. size = 892,926
Design df = 51

-----------------------------------------------------------------------
| Linearized
| Mean Std. Err. [95% Conf. Interval]
----------------------+------------------------------------------------
percent_asset_change1 | .0203422 .5888416 -1.161807 1.202491
-----------------------------------------------------------------------
Note: 20 strata omitted because they contain no subpopulation members.





. epctile percent_asset_change1 if analytical_pop==1 & first_cancer==wave [pweight=pre_rwtresp], p(50)



Percentile estimation
------------------------------------------------------------------------------
percent_as~1 | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
p50 | -.0451306 .0387276 -1.17 0.244 -.1210354 .0307741
------------------------------------------------------------------------------