ngreifer/WeightIt

How can the weights be extracted as a column added to the original dataset?

yatefi opened this issue · 2 comments

Hi,
I'm using the package to compute the weights, but the purpose of these weighting methods is to ultimately use the weights as regression weights in a subsequent analysis. However, the output is given as an object. How can I add the weights to the original data set as a column so that I can use it as regression weights in the subsequent analysis? Thanks!

You can just supply the weights directly from the object to the modeling function, as done in the WeightIt tutorial. If you want to use the weights outside R (e.g., in Stata), you can create a new column in your dataset and assign the weights to it, e.g., data$weights <- w.out$weights, where data is your original dataset and w.out is the weightit() output object.

Awesome! thanks for the quick response!