Propensity score matching


I'm trying to do propensity score matching using R, which I've never used before. I mostly use SAS due to big data and I already have a table imported from SAS with

x (exposure variable)
logit (value of linear predictor)
ps (estimated probabilty)

It's about 2 million rows. Now, I want to try to do matching 1:2, option to replace a matched individual after matching, caliper about .2*sd.

I have tried some snippets from some code examples but in some cases I get some kind of overflow error and in some cases I just can't get it to work.

Can someone give me a short rundown on a possible solution?

Thank you so much in advance.

Its hard to help you with data and code we can't see.
In general when trying example code; its best to run their entire lesson on their data, and try to understand their steps; where your data/issues may differ, so that you can a) be confident that they example code at least works on their data... b) have more knowledge when adapting theirs to yours.

I can tell you that * R: propensity score matching is available as part of the MatchIt,[7][8] optmatch,[9] or other packages.

I would really encourage you to review the following guide, FAQ: Tips for writing R-related questions.
For example, the guide emphasizes asking coding questions with formatted code-chunks and a reprex.

You may have noticed folks here requesting minimal reprexes, that's because asking questions this way saves answerers a lot of time.

Reproducible Examples:

  • help make your question clear and replicable
  • increases the probability folks will reach out and try to help,
  • reduces the number of back-and-forths required to understand the question,
  • and makes your question and suggested solutions more useful to folks in the future researching similar problems.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.