You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to do a matching on data to have it balanced for the two groups defined by a variable according to certain variables. I want to do a 1:2 matching.
I used this code a few months ago and it returned what I needed.
Today I tried to run it again but the outcome was not the same and I think there is a bug.
When I display the dataset post matching I have the subclass variable which should tell me each case which 2 controls it has been matched to. But this doesn't work well today: I see 2 records for each subclass value (1 case and 1 control) until the last subclass for which I see 1 case and lots of controls. The total records are 3 times the number of cases to be matched but the subclasses are not correct and I cannot verify each case to which 2 controls it has been matched.
Actual versions:
R version 4.4.2 (2024-10-31 ucrt)
MatchIt version: 4.6.0
Sorry about this. It is a known issue, and I fixed it in the development version, which you can install using remotes::install_github("ngreifer/MatchIt"). I'm working on getting it onto CRAN soon.
I need to do a matching on data to have it balanced for the two groups defined by a variable according to certain variables. I want to do a 1:2 matching.
I used this code a few months ago and it returned what I needed.
Today I tried to run it again but the outcome was not the same and I think there is a bug.
When I display the dataset post matching I have the subclass variable which should tell me each case which 2 controls it has been matched to. But this doesn't work well today: I see 2 records for each subclass value (1 case and 1 control) until the last subclass for which I see 1 case and lots of controls. The total records are 3 times the number of cases to be matched but the subclasses are not correct and I cannot verify each case to which 2 controls it has been matched.
Actual versions:
R version 4.4.2 (2024-10-31 ucrt)
MatchIt version: 4.6.0
This is the code:
library(MatchIt)
library(writexl)
data("lalonde")
m.out2<-matchit(treat ~ age+educ+married+race,data = lalonde, method = "nearest",
distance = "mahalanobis", exact = c("race"), caliper = c(age = 5), std.caliper = FALSE,ratio = 2, random = TRUE)
m.data2 <- match.data(m.out2)
write_xlsx(m.data2, "m.data2.xlsx")
The text was updated successfully, but these errors were encountered: