Question: I am trying to match my propensity scores, but psmatch2 won't work if I use this code format:
(Neighbour hood matching)
(I)
psmatch2 $treatment $xlist, outcome($ylist) common bw(0.06) ps(ps)
Error given:
psmatch2 $treatment $xlist, outcome(infection) common bw(0.06) ps(ps)
You cannot specify both a varlist AND a propensity score
r(198)
(II)
BUT it will work if :
psmatch2 $treatment $xlist, outcome($ylist) n(3) logit
What am I doing wrong? as the first (I) one works on probit and the second one works on logit. I know this depends on my preference (probit vs logit). But I would like to know what I'm doing wrong in the first one (i) why am I getting an error?
Here's a bit of background:
Research question:
Does smoking effect risk of infection after angioplasty?
DATA BELOW:
------------
MY CODE:
**Creating macros
global treatment smoking //intervention/treatment
global ylist infection //outcome
global xlist diabetes cancer age //variables to match on t
//Creating propensity scores
probit $treatment $xlist
predict ps
set seed 100 //sorts this out randomly
generate u=runiform()
sort u
//Matching - error given below
psmatch2 $treatment $xlist, outcome($ylist) common bw(0.06) ps(ps)
**This works but is logit not probit
psmatch2 $treatment $xlist, outcome($ylist) n(3) logit
(Neighbour hood matching)
(I)
psmatch2 $treatment $xlist, outcome($ylist) common bw(0.06) ps(ps)
Error given:
psmatch2 $treatment $xlist, outcome(infection) common bw(0.06) ps(ps)
You cannot specify both a varlist AND a propensity score
r(198)
(II)
BUT it will work if :
psmatch2 $treatment $xlist, outcome($ylist) n(3) logit
What am I doing wrong? as the first (I) one works on probit and the second one works on logit. I know this depends on my preference (probit vs logit). But I would like to know what I'm doing wrong in the first one (i) why am I getting an error?
Here's a bit of background:
Research question:
Does smoking effect risk of infection after angioplasty?
DATA BELOW:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(smoking infection diabetes age cancer ps u) byte(_n2 _n3) 1 0 0 87 0 .531945 .12884283 1 3 0 0 0 34 0 .7917001 .323584 . . 1 1 0 46 1 .8622774 .49606895 2 1 1 1 0 36 0 .7836868 .6916475 2 1 0 1 1 78 1 .4938836 .901614 . . 1 1 1 45 0 .4986039 .9556306 1 3 1 1 1 44 1 .6752168 .9616644 2 1 0 0 1 76 0 .3329607 .9732198 . . end
MY CODE:
**Creating macros
global treatment smoking //intervention/treatment
global ylist infection //outcome
global xlist diabetes cancer age //variables to match on t
//Creating propensity scores
probit $treatment $xlist
predict ps
set seed 100 //sorts this out randomly
generate u=runiform()
sort u
//Matching - error given below
psmatch2 $treatment $xlist, outcome($ylist) common bw(0.06) ps(ps)
**This works but is logit not probit
psmatch2 $treatment $xlist, outcome($ylist) n(3) logit
Comment