0

I have never used propensity scores for mulitnomial variables, and so I am unfamiliar with how the predicted probabilities are handled. I have a factor variable for treatment with 5 categories and I calculated a propensity score using multinom()

PSmod<- multinom(Treat~Age+BMI+Gender+Smoking+HIV,data =df)

df$PS <- predict(PSmod, type = 'probs')

This gives me a variable of which the class is "matrix" "array" and I am not sure how to work with this. How can I obtain a single probability from this matrix array for each subject so that I can model a glm adjusting for their propensity score? Thanks

Statistix
  • 83
  • 5
  • Next time it would be helpful to provide the `dput` of your data or use this guide: https://stackoverflow.com/help/minimal-reproducible-example. – Shawn Hemelstrand Feb 15 '22 at 03:38

1 Answers1

0

Don't do this. Adjusting for the propensity score is very complicated with multicategory treatments. Instead, use the propensity to form inverse probability weights and fit an outcome regression model to the weighted sample. To estimate the ATE, you compute each unit's weight as the inverse of the probability of being in the group they are in. The way you would create these weights in R is the following:

for (i in 1:nlevels(df$Treat)) {
  in_i <- which(df$Treat == levels(df$Treat)[i])
  df$weight[in_i] <- 1/PS_mat[in_i, i]
}

Or, you can just use the WeightIt package. WeightIt offers the function get_w_from_ps(), which takes in the PS matrix and the treatment vector and returns the weights. Even better would be to use weightit() to estimate the weights in a single step using one of a variety of methods, including but not limited to multinomial logistic regression. Other available methods include machine learning-based methods, optimization-based methods, and other generalized linear models beyond logistic. See my answer here for an example.

Noah
  • 3,437
  • 1
  • 11
  • 27