Compare distributions test unpaired and weighted data

Hi, I am trying to test if two populations are different. The problem is I am not sure if there is a test that works for unpaired weighted data like those.


my_data <- tibble(Var_1 = c(900, 1500, 350, 1200, 750, 100,125,250,300),
                  Gender = c("W", "W", "W", "M", "M", "W", "W", "M", "W"),
                  my_weights = c(2.2, 3.1, 8.2, 4.2, 5.3, 6.8, 12, 25, 1))

How about this idea. your weights are to 1 decimal place, so multiplying by 10 will make them all integers. Then you can uncount them, and get a simple frame to t.test

my_dat2<- uncount(my_data,
                  weights = my_weights*10)

Well this was only an example. In my real data the weights have different number of decimals

so to stay in base R you'ld need to decide a level of precision thats appropriate. and use that.
Or else search on CRAN for package offering weighted ttest.
I found with a few seconds effort, you could probably find more.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.