I am doing a propensity score matching(nearest neighbor matching) in R with simulated data and I keep getting the above warning messages. please I need help.
The following is my code
m.out<- matchit(Trt_Grp~Age + Base_DBP + Gender + Race + Trt_Difference, data.frame(Data1), method = "nearest")
I generated my data using the following codes
set.seed(12345)
Age <- rnorm(100, 50, 10)
round(Age, digits = 0)
Base_DBP <- rnorm(100,95 , 8)
round(Base_DBP, digits=0)
Trt_Grp <-rbinom(100, 1, prob =0.5)
print(Trt_Grp)
Race <-rbinom(100, 1, prob = 0.8)
print(Race)
Gender <-rbinom(100, 1, prob = 0.5)
print(Gender)
Patient_ID <-seq(1, 100, by=1)
print(Patient_ID)
Post_DBP <-rnorm(100, 80, 10)
print(Post_DBP)
round(Post_DBP, digits = 0)
n = 100; y1 = rnorm(n, 75, 5); y2 = rnorm(n, 85, 5) # same SD where y1 is post_DBP for drug and y2 for placebo
w = rbinom(n, 1, .20) #where w is Trt_grp
Post_DBP = w*y1 + (1-w)*y2
round(Post_DBP, digits = 0)
round(y1, digits = 0)
round(y2, digits = 0)
summary(y1)
summary(y2)
summary(Post_DBP)
Trt_Grp <- ifelse(Post_DBP<=80, 1, Trt_Grp)
Trt_Grp <- ifelse(Post_DBP>80, 0, Trt_Grp)
print(Trt_Grp)
summary(Trt_Grp)
table(Trt_Grp)
or <- cbind(Patient_ID, Age, Race, Gender,Trt_Grp, Base_DBP, Post_DBP)
round(or, digits = 0)
Trt_Difference <- Base_DBP - Post_DBP
round(Trt_Difference)
Data <- cbind(Patient_ID, Age, Race, Gender,Trt_Grp, Base_DBP, Post_DBP, Trt_Difference)
round(Data, digits = 0)