ngreifer / cobalt

Covariate Balance Tables and Plots - An R package for assessing covariate balance
https://ngreifer.github.io/cobalt/
72 stars 11 forks source link

How to know who adjusted samples are? #51

Closed mureal-bioinfo closed 3 years ago

mureal-bioinfo commented 3 years ago

Hello, Noah Greifer

I am learning how to use 'cobalt' package for balancing samples from tutorials (https://cran.r-project.org/web/packages/cobalt/vignettes/cobalt.html#using-cobalt-with-multi-category-treatments) and I have a question.

With the following command, I gave each ID to 614 samples in 'lalonde' example data.

lalonde$ID <- paste0("ID_", c(1:nrow(lalonde)))

According to the tutorial, we can check "Effective sample sizes" by using bal.tab() function. The result was as follows :

Effective sample sizes       black hispan white Unadjusted 243.  72.  299.
Adjusted  138.38  54.99 259.59

I want to get the ID of each of the Adjusted samples. Could you tell me how to get the IDs of about 451(138+54+259) people?

Yours sincerely, QANGFQ

ngreifer commented 3 years ago

Hi QANGFQ,

After weighting, all units remain. All units are in the adjusted sample. The effective sample size is a function of the weights, not of who remains and who is dropped. When doing matching, that may be a different story, but currently, there are no matching methods for multi-category treatments supported by cobalt.

Noah