dear All
when the 2 codes are run I don't find the same predictive probability that is supposed to be used as propensity score.
Any idea?
Here is the code:
data School;
Music= 'Yes';
do j=1 to 60;
if (ranuni(1312) > 0.4) then Gender='Female';
else Gender='Male';
Absence = ranexp(99);
if (Absence < 0.5) then GPA= 4 + rannor(99)/3.5;
else GPA= 4 - abs(rannor(99)/3.5);
if (Gender='Female') then GPA= GPA + 0.02;
id1= ranuni(99);
id2= ranuni(99);
output;
end;
Music= 'No';
do j=1 to 100;
Absence= ranexp(99);
if (ranuni(99) > 0.45) then Gender='Female';
else Gender='Male';
if (Absence < 0.5) then GPA= 4 + rannor(99)/4.2;
else GPA= 4 - abs(rannor(99)/4.2);
id1= ranuni(99);
id2= ranuni(99);
output;
end;
do j=1 to 40;
Absence= 2 + ranexp(99);
if (ranuni(99) > 0.5) then Gender='Female';
else Gender='Male';
GPA= 3.4 - abs(rannor(99)/4.2);
id1= ranuni(99);
id2= ranuni(99);
output;
end;
run;
proc sort data=school;
by id1;
run;
data school;
set school;
StudentID= _n_;
Absence= int(Absence*100+0.5) / 100;
GPA= int(GPA*100+0.5) / 100;
run;
proc sort data=school;
by id2;
run;
data Grades;
set school;
keep StudentID GPA;
run;
data School;
set school;
drop j id1 id2 GPA;
run;
proc sort data=School out=School1;
by StudentID;
run;
proc sort data=Grades out=Grades1;
by StudentID;
run;
data SchoolGrades;
merge School1 Grades1;
by StudentID;
run;
ods graphics on;
proc psmatch data=School region=treated;
class Music Gender;
psmodel Music(Treated='Yes')= Gender Absence;
match distance=lps method=greedy(k=1) exact=Gender caliper=0.5;
assess lps var=(Gender Absence)
/ stddev=pooled(allobs=no) stdbinvar=no
plots(nodetails)=all weight=none;
output out(obs=match)=OutEx4 matchid=_MatchID;
run;
****** logistic ****;
proc logistic data=School descending;
class Music Gender;
model Music(Event='Yes')= Gender Absence /
link=cloglog rsquare;
output out = ps_los pred = ps xbeta=logit_ps;
run;
So this is the example from the SAS documentation.
I'm not sure I understand your question though - are you saying the PSMATCH results don't match with what's in the documentation?
@mcasa wrote:
dear All
when the 2 codes are run I don't find the same predictive probability that is supposed to be used as propensity score.
Any idea?
Hi Sorry I will try to explain.
The pSmodel statement in the PSMAtch procedure is supposed to generate a logistic regression to get the predictive probabilities that should be used to generate later the propensity score. If you don't use any weights , you would expect to find the same predictive probability if you run a proc logistic. My concern is that I have closed results but not exact match. I am wondering if you have observed similar things.
The propensity score model fit by PROC PSMATCH uses the logit link whereas the model you are fitting with PROC LOGISTIC is using the complementary log-log link function as requested by the link=cloglog option in the MODEL statement. The two models are therefore not the same and you would not expect to get the same propensity score values.
You are right. Thank you . I misread the documentation and I was sure that the cloglog was used in the psmatch procedure.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.