weighted median [message #518] |
Fri, 07 June 2013 03:55 |
isde
Messages: 2 Registered: June 2013
|
Member |
|
|
Hello.
I writing because I cannot find my way out of this apparently trivial calculation: I have to estimate the median for age at different vaccinations in several countries with Children recodes datasets, separately. I'm working on STATA10.
I'm trying to get weighted medians.
I've done "gen wgt=v005/1000000" and "sum var [iw=wgt]".The command "iweight" is not allowed with "sum,d". How can I do?
Do I have to use svyset, in which case what are the variable to incude (PSU is v021? stratification variables are v025? v024? both?).
That would be great if you could provide me with some answers. Thanks a lot in advance.
|
|
|
Re: weighted median [message #520 is a reply to message #518] |
Fri, 07 June 2013 12:37 |
Reduced-For(u)m
Messages: 292 Registered: March 2013
|
Senior Member |
|
|
Use pweight. These are probably weights. The stratification stuff should only matter for standard errors. If you want those, you could use quantile regression for the median, unconditional on anything (so just svy: qreg Y). I think qreg works with svy:, but I'm not totally positive.
|
|
|
|
|
Re: weighted median [message #594 is a reply to message #532] |
Wed, 03 July 2013 18:21 |
bsayer
Messages: 12 Registered: March 2013 Location: Silver Spring Maryland
|
Member |
|
|
If you have the option of using SUDAAN, it does weighted percentiles, including variances.
Bryan Sayer
Statistician
Social & Scientific Systems, Inc.
|
|
|
Re: weighted median [message #595 is a reply to message #594] |
Wed, 03 July 2013 18:22 |
bsayer
Messages: 12 Registered: March 2013 Location: Silver Spring Maryland
|
Member |
|
|
Also, you can calculate them by brute force, sorting by weight and creating the running sum of the weight, then finding the percentile points you want.
Bryan Sayer
Statistician
Social & Scientific Systems, Inc.
|
|
|