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: RE: psmatch2 with the if condition

From   Austin Nichols <>
Subject   Re: st: RE: psmatch2 with the if condition
Date   Mon, 22 Mar 2010 12:02:34 -0400


I think the poster is confusing _n1 and _id, which are defined clearly
in the help file for -psmatch2-, and simple summary stats would
disabuse him of his notion that _id is capturing matches.

use, clear
psmatch2 t age educ if black==1, out(re78)
su _* if black==0
su _* if black==1
reg re78 t [aw=_w]

On Mon, Mar 22, 2010 at 9:40 AM, Nick Cox <> wrote:
> In effect you raise two new points:
> 1. Whether -psmatch2- promises, implicitly or explicitly, to match
> companies [in your case] in a specified subset only with others in the
> same subset.
> 2. How to achieve that if that is what you wish.
> On 1, the best answers will come from the program authors, who may or
> may not be currently members of this list.
> A solution 2 that is possible: You could temporarily -drop- observations
> that you don't want to be included from the dataset. That way,
> -psmatch2- will not see any others.
> However, I wouldn't implementing that until you have a good answer on 1.
> I haven't read the -psmatch2- help. But the looping you quote looks
> sound, and yours is buggy, so I recommend that you base your code more
> closely on that example.
> Nick
> Roberto Mura
> Nick,
> Thank you for your kind reply. The loop is not the main issue. Even
> if I do not specify any loop but simply code:
> use "C:\AAA.dta", clear
> catenate condition1 =  country sic2
> gen quotedcondition1=1 if quotedcompany==1
> replace quotedcondition1=0 if quotedcompany==0 & diversification_orig==1
> gen quotednumerator=.
> gen quoteddenomenator=.
> gen privatenumerator=.
> gen privatedenominator=.
> egen g=group(condition1)
> bysort condition1: gen Ncondition1=_N
> psmatch2 quotedcondition1 if g==1, pscore(size) noreplacement
> I still find that psmatch2 uses companies which do not belong to
> group 1 to look for matches. As a matter of fact, it is assigning _id
> values outside the range of group 1 (there are just 15 firms in it
> but psmatch2 reports values like 877). Also, I am not blaming
> psmatch2 for anything and I never said I discovered a bug. I am just
> trying to understand what I am doing wrong. Also, please note that my
> code is very similar to the one reported in the help of psmatch2
> which I report below for simplicity:
> Matching within strata
>     The following code illustrates how to match within exact cells
> and then calculate the average effect for the whole population.
>         g att = .
>         egen g = group(groupvars)
>         levels g, local(gr)
>         qui foreach j of local gr {
>                 psmatch2 treatvar varlist if g==`j', out(outvar)
>                 replace att = r(att) if  g==`j'
>         }
>         sum att

*   For searches and help try:

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