So I am trying to do propensity score matching and then utilize Zelig to perform a logistic regression on the matched data.
Here is an example of what my data looks like: DATA
So I am trying to match the patients based on Dementia, Stroke, and Age. I am then trying to see whether or not Drug X is associated with an increased risk of falling once the patients have been matched. I would then like to go through the same process for Drug Y and Drug Z to see if each individual drug has an association.
Here is the code I have used so far to perform the matching and the logistic regression analysis:
data <- read_csv("Desktop/data.csv")
View(data)
attach(data)
data[1:10,]
m.out = matchit(Fall ~ Dementia + Stroke + Age, method = "exact", data = data)
m.data = match.data(m.out)
library(Zelig)
z.out = zelig(Fall ~ Drug X + Dementia + Stroke + Age, model = "logit", data = m.data)
x.out0 <- setx(z.out, Drug X = 0)
x1.out0 <- setx(z.out, Drug X = 1)
s.out0 <- sim(z.out, x = x.out0, x1 = x1.out0)
Everything seems to be going smoothly until this last line. Here is the error message I keep getting.
Error in eigen(Sigma, symmetric = TRUE) :
infinite or missing values in 'x'
Any ideas what I'm doing wrong? I've been stuck here for a while now and decided to reach out for help.
Thanks in advance.