Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a weighted median test for two samples in R? [closed]

Tags:

r

median

weighted

I have two samples (Group 1 and Group 2), each containing 1) an income variable and 2) a weight variable indicating the weight for each observation.

I simply want to test whether the medians of income in the two samples (Group 1 and Group 2) are statistically different.

I know I can use Mood's median test if I don't consider the weights, but is there a way to perform the median test while accounting for the weights of each observation?

Thanks for your help in advance!

like image 830
TrebiLime Avatar asked Sep 13 '25 06:09

TrebiLime


1 Answers

survey:svyranktest will do this for you. It has an option test="median" to compare medians.

like image 166
Thomas Lumley Avatar answered Sep 15 '25 21:09

Thomas Lumley