Home > front end >  Use linear model for propensity score matching (R MatchIt)
Use linear model for propensity score matching (R MatchIt)

Time:05-11

I want to use the propensity score fitted from a linear model to match observations using the MatchIt library.

For example, suppose df is a dataframe. If I were to balance its treatment column in terms of x1, x2 and x3 using the propensity score from a logit, I would set distance = 'glm' and link = 'logit':

m <- matchit(formula = treatment ~ x1   x2   x3,
             data = df,
             method = 'nearest',
             distance = 'glm',
             link = 'logit')

How can I do the same with a linear model instead of a logit?

As per the documentation:

When link is prepended by "linear.", the linear predictor is used instead of the predicted probabilities.

Hence, I tried:

m <- matchit(formula = treatment ~ x1   x2   x3,
             data = df,
             method = 'nearest',
             distance = 'glm',
             link = 'linear.logit')

I'm afraid that doing this (link = linear.logit) would use the score from the log-odds of the logit model.

Is there any way I can just use a linear model instead of a generalized linear model?

CodePudding user response:

You cannot do this from within matchit() (and you shouldn't, in general, which is why it is not allowed). But you can always estimate propensity score outside matchit() however you want and the supply them to matchit(). To use a linear probability model, you would run the following:

fit <- lm(treatment ~ x1   x2   x3, data = df)
ps <- fit$fitted
m <- matchit(treatment ~ x1   x2   x3,
             data = df,
             method = 'nearest',
             distance = ps)
  • Related