Hello!
I encounter a problem with Matching methods.
I am working on a NSW type of database. I have NO missing values in the database.
The first time I encountered the problem:
> "Error in model.frame.default(formula = Y ~ age + education + black + hispanic + :
> les longueurs des variables diffèrent (trouvé pour 'age')"
(the french sentence meaning "the length of the variables differ (found for 'age')
I managed to solve it by playing with "discard = none", "reestimate = FALSE" etc...
But at some point, I have to create subsets for the control group and for the treated group separately and neither "discard" nor "reestimate" nor "na.omit" manage to fix the problem.
Here are the few code lines: (the bold ones are the problematic ones)
> m.out <- matchit(Tr ~ age + age2 + education + education2 + black + hispanic
> + married + nodegree + re74 + re742 + re75 + re752,
> method = "nearest", discard = "control", data=BDD,
> distance = "logit", reestimate = "FALSE", ratio = 1)
> m.out <- match.data(m.out)
> summary(m.out)
>
> z.out <- zelig(Y ~ Tr + age + age2 + education + education2 + black + hispanic
> + married + nodegree + re74 + re742 + re75 + re752,
> match.data(m.out), model = "ls")
> summary(z.out)
>
> x.out <- setx(z.out, Tr=0)
> x1.out <- setx(z.out, Tr=1)
> s.out <- sim(z.out, x = x.out, x1 = x1.out)
> summary(s.out)
>
>
> m.out1<- matchit(Tr ~ age + age2 + education + education2 + black + hispanic
> + married + nodegree + re74 + re742 + re75 + re752,
> method = "nearest", data=BDD, distance = "logit",
> discard ="none", reestimate = "FALSE", ratio = 1)
> summary(m.out1)
>
> m.out2 <- match.data(m.out1, "control")
> dim(m.out2)
>
> **z.out1 <- zelig(Y ~ age + age2 + education + education2 + black + hispanic +**
**> married + nodegree + re74 + re742 + re75 + re752,**
**> data = m.out2, model = "ls")**
And here are the packages I use:
(MatchIt)
(dplyr)
(ggplot2)
(RStata)
(rbounds)
(Matching)
(matchingR)
(rematch)
(ResourceSelection)
(Zelig)
(ATE)
(pillar)
(WhatIf)
Thanks a lot in advance for your help