I have a couple of minor comments on matchit (which I am now using
more and enjoying very much). I hope to have more substantive issues
to discuss in due course. (See the end for my version information.)
1) The ?matchit help page includes:
works. For example, 'x1:x2' represents the first order
interaction term between 'x1' and 'x2', and 'I(x1 \^\ 2)'
represents the square term of 'x1'. See 'help(formula)' for
details.
Is "\^\" the way that you want to express this? I don't think that the
slashes are correct.
2) The full help pages do not seem to be available unless you are
connected to the internet. I do not think that this is standard in R
and it is certainly, from a user point of view, not desirable. I, for
one, often work off-line and would like to have the full help
available.
3) You might consider providing some latex output options. One way of
doing this is via a method to the xtable package, which is quite
good. Or am I missing something? How do you recommend saving the
results of various analyses? Right now, I just use the verbatim
environment within LaTeX and copy/paste from the R prompt within ESS,
but if there is a better way, it would be nice to know it.
4) I don't think that the way that matchit deals with missing values
is optimal. Consider:
> z <- lalonde[seq(0,600, 30),]
> dim(z)
[1] 20 10
> z[1, "black"] <- NA
> m.out <- matchit(treat ~ educ + black, data = z)
Calculating propensity score...Done
Matching Treated: 2030%...4050%...6070%...8090%...100%...Done
Calculating summary statistics...Done
Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 20, 19
>
I *think* that matchit does not like it when there is a missing value
for any of the covariates. Fine. But it should give that warning, but
not fail with an obscure error.
5) It would certainly be nice if the main ?matchit help page included
an example or two.
6) Error messages with regard to the necessity of factors in exact
matches (or better default) behavior would be good. Consider:
> m.out <- matchit(treat ~ hispan + nodegree, data = lalonde)
Calculating propensity score...Done
Matching Treated: 10%...20%...30%...40%...50%...60%...70%...80%...90%...100%...Done
Calculating summary statistics...Done
> m.out <- matchit(treat ~ hispan + nodegree, ,method = "exact", data = lalonde)
Calculating propensity score...Error in switch(method, model.frame = return(mf), glm.fit = 1, glm.fit.null = 1, :
invalid 'method': exact
>
Why should "exact" fail to work in the second case when everything is
fine in the first? I *thought* it was because "exact" requires factors,
but that fix does not work for me.
I guess that this last one is the only real question that I have for
the list. Why does:
m.out <- matchit(treat ~ hispan + nodegree, ,method = "exact", data =
lalonde)
fail?
I hope that this is enough for now! ;-)
Thanks again for an excellent package.
Dave Kane
> packageDescription("MatchIt")
Package: MatchIt
Version: 2.2-5
Date: 2005-12-07
Title: MatchIt: Nonparametric Preprocessing for Parametric Casual Inference
Author: Daniel Ho <daniel.e.ho(a)gmail.com>, Kosuke Imai <kimai(a)Princeton.Edu>, Gary King <king(a)harvard.edu>,
Elizabeth Stuart <stuart(a)stat.harvard.edu>
Maintainer: Kosuke Imai <kimai(a)Princeton.Edu>
Depends: R (>= 2.2), MASS, Zelig
Suggests: optmatch, Matching, WhatIf
Description: MatchIt selects matched samples of the the original treated and control groups with similar
covariate distributions -- can be used to match exactly on covariates, to match on propensity
scores, or perform a variety of other matching procedures.
LazyLoad: yes
LazyData: yes
License: GPL version 2 or newer
URL: http://gking.harvard.edu/matchit
Packaged: Wed Dec 7 09:39:20 2005; kimai
Built: R 2.2.0; ; 2006-01-11 10:17:37; unix
--
David Kane
Kane Capital Management
646-644-3626
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
The "exact" demo does not work.
> demo('exact')
demo(exact)
---- ~~~~~
Type <Return> to start :
> data(lalonde)
> user.prompt()
Error in eval.with.vis(expr, envir, enclos) :
couldn't find function "user.prompt"
>
I suspect that this is related to the previous problem that I
reported.
Let me know if this is more feedback/detail than you really want to
get. You would probably find that test cases would catch some of these
issues prior to release.
Dave Kane
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
This is a cleaner version of my previous bug report. Details at the
end. I get a failure trying to run the example here:
http://gking.harvard.edu/matchit/docs/Exact_Matching.html
> library(MatchIt)
> data(lalonde)
> m.out <- matchit(treat ~ educ + black + hispan, data = lalonde, method = "exact")
Calculating propensity score...Error in switch(method, model.frame = return(mf), glm.fit = 1, glm.fit.null = 1, :
invalid 'method': exact
> traceback()
9: stop("invalid 'method': ", method)
8: switch(method, model.frame = return(mf), glm.fit = 1, glm.fit.null = 1,
stop("invalid 'method': ", method))
7: glm(formula = treat ~ educ + black + hispan, data = lalonde,
method = "exact", family = binomial)
6: eval(expr, envir, enclos)
5: eval(as.call(mf), sys.frame(sys.parent()))
4: distance(formula = treat ~ educ + black + hispan, data = lalonde,
method = "exact")
3: eval(expr, envir, enclos)
2: eval(as.call(mf), sys.frame(sys.parent()))
1: matchit(treat ~ educ + black + hispan, data = lalonde, method = "exact")
>
Dave Kane
> packageDescription("MatchIt")
Package: MatchIt
Version: 2.2-5
Date: 2005-12-07
Title: MatchIt: Nonparametric Preprocessing for Parametric Casual Inference
Author: Daniel Ho <daniel.e.ho(a)gmail.com>, Kosuke Imai <kimai(a)Princeton.Edu>, Gary King <king(a)harvard.edu>,
Elizabeth Stuart <stuart(a)stat.harvard.edu>
Maintainer: Kosuke Imai <kimai(a)Princeton.Edu>
Depends: R (>= 2.2), MASS, Zelig
Suggests: optmatch, Matching, WhatIf
Description: MatchIt selects matched samples of the the original treated and control groups with similar
covariate distributions -- can be used to match exactly on covariates, to match on propensity
scores, or perform a variety of other matching procedures.
LazyLoad: yes
LazyData: yes
License: GPL version 2 or newer
URL: http://gking.harvard.edu/matchit
Packaged: Wed Dec 7 09:39:20 2005; kimai
Built: R 2.2.0; ; 2006-01-11 10:17:37; unix
-- File: /home/kane/rlib/MatchIt/DESCRIPTION
> R.version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 2
minor 2.0
year 2005
month 10
day 06
svn rev 35749
language R
>
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
The only difficulty is that for some matching methods you are doing one to
many matching with a variable number of matches for each treated
observation. But, we will try to come up with an easy and general way to
do this.
Thanks for your input,
Kosuke
-----------------------------------------------------
Kosuke Imai Office: Corwin Hall 041
Assistant Professor Phone: 609-258-6601
Department of Politics eFax: 973-556-1929
Princeton University Email: kimai(a)Princeton.Edu
Princeton, NJ 08544-1012 http://imai.princeton.edu
-----------------------------------------------------
On Tue, 10 Jan 2006, Anirudh V. S. Ruhil wrote:
> Hi Kosuke;
>
> I've been employing cut-and-paste operations that cut from
> m.out$match.matrix to create flags for matched sets but thought there may
> be a command to to pipe the same. Perhaps we could add it to the MatchIt
> wishlist?? *grin*
>
> best
>
> Ani
>
> --On Friday, January 06, 2006 8:43 PM -0500 Kosuke Imai
> <kimai(a)Princeton.Edu> wrote:
>
> : Hi Ani,
> : You can look at m.out$match.matrix to see which treated unit is matched
> : with which control unit (where m.out is the output from matchit()).
>
> Anirudh V. S. Ruhil, Ph.D.
> Sr. Research Associate
> Voinovich Center for Leadership and Public Affairs
> Ohio University
> Building 21, The Ridges
> Athens, OH 45701-2979
> Tel: 740.597.1949 | Fax: 740.597.3057
>
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
Hi Ani,
You can look at m.out$match.matrix to see which treated unit is matched
with which control unit (where m.out is the output from matchit()).
match.data() is the function that extracts the matched units, but won't
give out which treated units are matched with which control untis.
Hope this helps,
Kosuke
-----------------------------------------------------
Kosuke Imai Office: Corwin Hall 041
Assistant Professor Phone: 609-258-6601
Department of Politics eFax: 973-556-1929
Princeton University Email: kimai(a)Princeton.Edu
Princeton, NJ 08544-1012 http://imai.princeton.edu
-----------------------------------------------------
On Fri, 6 Jan 2006, Anirudh V. S. Ruhil wrote:
> Hi Kosuke;
>
> If I am using MatchIt and lets assume I am pulling 1:1 matches. I'd like to
> use "match.data" to pipe out the matched cases with the distance and weight
> measures as well as an indicator that tells me which treated case is
> matched to which control case. How would I do that? The documentation
> doesn't clarify beyond weights, distance, and subclass.
>
> thanks in advance!
>
> Ani
>
> Anirudh V. S. Ruhil, Ph.D.
> Sr. Research Associate
> Voinovich Center for Leadership and Public Affairs
> Ohio University
> Building 21, The Ridges
> Athens, OH 45701-2979
> Tel: 740.597.1949 | Fax: 740.597.3057
>
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/