Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Pretreatment pair matching

From   Austin Nichols <>
Subject   Re: st: Pretreatment pair matching
Date   Thu, 20 Sep 2012 12:46:28 -0400

Wojciech Hardy <>:
What variables do you want to match on to make pairs?
If they are all categorical and a relatively small number, you might simply
 egen class=group(x*)
and randomize within class, or:
 bys x*: g pair_id=ceil((_n-mod(_n-1,2))/2)
 g u=uniform()
 bys x* pair_id (u): g treatment=_n==1
or somesuch.

With some continuous variables, you may prefer to construct a
Mahalanobis distance from group means, and then sort by that distance
within group before assigning a pair id. See also -help cluster- and
the related manual entries.

You might also want to read "The Essential Role of Pair Matching in
Cluster-Randomized Experiments, with Application to the Mexican
Universal Health Insurance Evaluation" by Kosuke Imai, Gary King and
Clayton Nall (2009):

On Thu, Sep 20, 2012 at 6:44 AM, Wojciech Hardy <> wrote:
> Hello all,
> I'm trying to conduct a pair matching procedure only without having
> the treatment group and control group set beforehand.
> In fact we intend to use the pair matching to help us decide which
> items should go to the treatment group (i.e. we'd like to find
> 'twins', and then put one of them into the treatment group, and the
> keep other one in the control group, thus increasing the efficiency of
> later statystical analysis).
> I've found some commands allowing for measuring the treatment effect,
> by comparing twins, but these do not apply to my case and
> unfortunately I don't have the skills to modify the commands to give
> me what I need.
> What I'd want is to match the observations into pairs (generate some
> "pair ID" probably), based on specified variables, without doing
> anything else.
> I thought of solving this by duplicating the dataset, giving the new
> copy a "1" value in a treatment variable, and making the already
> created commands match between the two identical groups. I'd have to
> make it not match the observations with the same ID however (i.e. with
> their own copies), and I don't know how to do it. Also, I'm not sure
> if these commands report what pairs they've made in the process.
> I haven't found any solution to this on the net, so I'll be really
> grateful for any help!
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index