In general, you can always look at "match.matrix" which will tell you
how each observation is matched.
Kosuke
Department of Politics
Princeton University
On 8/3/11 6:58 PM, Stuart, Elizabeth A. wrote:
Hi Ana,
The code works fine if you do nearest neighbor matching, for which the
match.matrix makes sense:
data(lalonde)
m.out <- matchit(formula = treat ~ age + educ + black + hispan +
married +
+ nodegree + re74 + re75, data = lalonde, method = "nearest")
cbind(lalonde[row.names(m.out$match.matrix),"re78"],
lalonde[m.out$match.matrix,"re78"])
[,1] [,2]
[1,] 9930.0460 959.04450
[2,] 3595.8940 6847.78500
[3,] 24909.4500 2231.36700
[4,] 7506.1460 2281.61000
[5,] 289.7899 0.00000
[6,] 4056.4940 17833.20000
If you are using cem it sounds from Gary’s email like the “pair”
function is the way to get similar information.
Liz
On 8/3/11 5:16 PM, "Ana Kolar" <annakolar(a)yahoo.com> wrote:
I believe that the output object of matchit is called m.out (in your
example). And unfortunately it doesn't work or am I doing something
wrong? Please look at the example below.
cbind(lalonde[row.names(m.out$match.matrix),"re78"],
lalonde[m.out$match.matrix,"re78"])
[,1] [,2]
m.out
Call:
matchit(formula = treat ~ age + educ + black + hispan + married +
nodegree + re74 + re75, data = lalonde, method = "cem")
Control Treated
All 429 185
Matched 78 68
Unmatched 351 117
Discarded 0 0
------------------------------------------------------------------------
*From:*Kosuke Imai <kimai(a)Princeton.EDU>
*To:* Ana Kolar <annakolar(a)yahoo.com>
*Cc:* "matchit(a)lists.gking.harvard.edu"
<matchit(a)lists.gking.harvard.edu>
*Sent:* Wednesday, 3 August 2011, 23:10
*Subject:* Re: [matchit] getting a matrix of matched pairs
It's the output object from matchit() command.
Kosuke Imai
Princeton University
http://imai.princeton.edu
Sent from my iPhone
On Aug 3, 2011, at 5:07 PM, "Ana Kolar" <annakolar(a)yahoo.com>
wrote:
I believe so, but this example code doesn't work on the
lalonde example that you have provided throughout the
package. Could you please point me towards what that 'foo'
object represents? Ana
------------------------------------------------------------------------
*From:*Kosuke Imai <kimai(a)Princeton.EDU>
*To:* Ana Kolar <annakolar(a)yahoo.com>
*Cc:* "matchit(a)lists.gking.harvard.edu"
<matchit(a)lists.gking.harvard.edu>
*Sent:* Wednesday, 3 August 2011, 23:02
*Subject:* Re: [matchit] getting a matrix of matched pairs
That's an example code. You would have to replace "foo"
etc with your own objects.
Kosuke Imai
Princeton University
<http://imai.princeton.edu>
http://imai.princeton.edu
Sent from my iPhone
On Aug 3, 2011, at 4:56 PM, "Ana Kolar" <
<mailto:annakolar@yahoo.com> annakolar(a)yahoo.com> wrote:
Thank you Geoff, but this line of code unfortunately
doesnt work. Object 'foo' is not found. No idea what
that object 'foo' actually means. Could you please
give an advice on that?
cbind(lalonde[row.names(foo$match.matrix),"re78"],
lalonde[foo$match.matrix,"re78"])
Error in row.names(foo$match.matrix) : object 'foo'
not found
------------------------------------------------------------------------
*From:*Geoffrey Smith < <mailto:gps@asu.edu>
gps(a)asu.edu>
*To:* Ana Kolar < <mailto:annakolar@yahoo.com>
annakolar(a)yahoo.com>
*Cc:* Gary King < <mailto:king@harvard.edu>
king(a)harvard.edu>gt;; "
<mailto:matchit@lists.gking.harvard.edu>
matchit(a)lists.gking.harvard.edu" <
<mailto:matchit@lists.gking.harvard.edu>
matchit(a)lists.gking.harvard.edu>
*Sent:* Wednesday, 3 August 2011, 22:46
*Subject:* Re: [matchit] getting a matrix of
matched pairs
See section 5.5 of the .pdf version of the
manual available at
<http://gking.harvard.edu/matchit>
<http://gking.harvard.edu/matchit>
http://gking.harvard.edu/matchit . Geoff
On Wed, Aug 3, 2011 at 1:36 PM, Ana Kolar <
<mailto:annakolar@yahoo.com>
<mailto:annakolar@yahoo.com>
annakolar(a)yahoo.com> wrote:
If I understand this correctly. While using
*matchit *function, we can get matched pairs
only if "cem" method is used and there is no
option to get matched pairs if we use other
methods like "nearest", "optimal",
"full" or
"genetic"?
------------------------------------------------------------------------
*From:*Gary King < <mailto:king@harvard.edu> <mailto:king@harvard.edu>
king(a)harvard.edu>
*To:* Ana Kolar < <mailto:annakolar@yahoo.com>
<mailto:annakolar@yahoo.com> annakolar(a)yahoo.com>
*Cc:* " <mailto:matchit@lists.gking.harvard.edu>
<mailto:matchit@lists.gking.harvard.edu>
matchit(a)lists.gking.harvard.edu" <
<mailto:matchit@lists.gking.harvard.edu>
<mailto:matchit@lists.gking.harvard.edu> matchit(a)lists.gking.harvard.edu>
*Sent:* Wednesday, 3 August 2011, 22:22
*Subject:* Re: [matchit] getting a matrix of matched pairs
Cem has a pair() function to do this.
Gary King
<http://gking.harvard.edu> <http://gking.harvard.edu>
http://gking.harvard.edu
617-500-7570
(from my phone)
On Aug 3, 2011 1:54 AM, "Ana Kolar" < <mailto:annakolar@yahoo.com>
<mailto:annakolar@yahoo.com> annakolar(a)yahoo.com> wrote:
Hi there,
Is MatchIt package capable of producing a matrix with all the matched
pairs? The
thing is that when match.data function is used, we only get
all the data that are matched, while I would be more interested in
getting the matched pairs.
Many thanks in advance!
Best regards,
Ana
--
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)lists.gking.harvard.edu
Subscribe/Unsubscribe: