0

I would like to generate SMD and plot them without including the prediction model in my code; I am using the cobalt package and specifically the loveplot command to generate the plot. However, I would like to just include the probability of treatment in my code as opposed to including the full prediction model in the code as shown below.

library(WeightIt); data("lalonde", package = "cobalt")


w.out1 <- weightit(treat ~ age + educ + race + 
                     married + nodegree + re74 + re75, 
                   data = lalonde)


love.plot(treat ~ age + educ + race + 
            married + nodegree + re74 + re75, 
          data = lalonde, 
          weights = list(IPW =w.out1 ),
          var.order = "alphabetical", binary = "std",
          abs = FALSE, colors = c("red", "blue"), 
          shapes = c("circle", "triangle"),
          sample.names = c("Unweighted", "PS Weighted"),
          line = FALSE,
          themes = list(theme(legend.position = "top")))


Magut
  • 151
  • 7
  • What do you foresee as a probability plot? Are you referring to something more along the lines of a distributional balance (density) plot? If not, can you add an image to your question about what this type of plot looks like? Perhaps it goes by another description? – Kat Dec 13 '22 at 00:25
  • @kat, yes a distributional balance plot – Magut Dec 13 '22 at 14:45
  • 1
    This is better than me answering your question! [Check out this resource.](https://cran.r-project.org/web/packages/cobalt/vignettes/cobalt.html) It depicts a ton of things you can do with this data, specifically addressing your question. – Kat Dec 13 '22 at 15:07
  • I'm not clear on what you are trying to do. Are you trying to generate the same plot but with different code? Why? Are you trying to make a love plot with only the propensity score? Why? You need to report balance on the covariates. If you just want to add the propensity score to the plot, do so using the `distance` argument. – Noah Dec 14 '22 at 15:44
  • Thanks @Noah, distance argument works – Magut Dec 15 '22 at 16:53

0 Answers0