Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: matching within groups

 From Austin Nichols <[email protected]> To [email protected] Subject Re: st: matching within groups Date Thu, 8 Mar 2012 14:26:42 -0500

```Christoph Willing <[email protected]>:
You don't need psmatch2 (SSC) to run a logit.  You run your own logit,
predict ps, and then match within group as in
http://www.stata.com/statalist/archive/2011-10/msg00899.html

On Thu, Mar 8, 2012 at 2:06 PM, Christoph Willing
<[email protected]> wrote:
> The problem with psmatch2 is that it runs seperate logistic
> regressions for each group.
> In some groups however I have only one treated observation which
> results in error r(2000) i.e. data is perfectly predicted.
> My data looks somewhat like this
>
> id     group     treated     pscore
> 1          1            0             .5
> 2          1            1             .4
> 3          1            0             .3
> 4          1            1             .5
> 5          1            0             .2
>
> I would like to have a formula that simply does something like this:
> generate match = id for which abs[pscore if treated==1 - pscore if
> treated==0] is minimised, by group
>
> I am new to stata and I have no idea of how to code this.
>
>
> On Wed, Mar 7, 2012 at 3:49 PM, Austin Nichols <[email protected]> wrote:
>> Christoph Willing <[email protected]>:
>> Finding the closest propensity score within group
>> is easily done with -psmatch2- (SSC); see e.g.
>> http://www.stata.com/statalist/archive/2011-10/msg00899.html
>> Note that -nnmatch- (SSC) can provide a different
>> matching strategy closer to your stated desiderata.
>>
>> On Wed, Mar 7, 2012 at 8:19 AM, Christoph Willing
>> <[email protected]> wrote:
>>> Dear Statalist,
>>>
>>> I am trying to find a matching untreated company for each treated
>>> company in my sample, based on pre-treatment firm characteristics.
>>> My observations are grouped by country, industry and year, and the
>>> matching should happen within a group.
>>> I am not yet interested in the treatment effect, but simply want to
>>> find the one nearest neighbour for each treated company that is most
>>> similar in its firm characteristics.
>>>
>>> I have run a pooled logit for the entire sample of the form "logit
>>> treatment firm-characteristics" and predicted the propensity scores.
>>> Now I am stuck at finding the nearest neighbours within the groups.
>>> The matter is complicated by the fact that in some groups there are
>>> more than one treated company.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```