<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to assess quality of prediction in a logistic regression with random effect. in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509492#M26119</link>
    <description>&lt;P&gt;Confusion Matrix ? and check the goodness of&amp;nbsp; fit statistic in its documentation.&lt;/P&gt;
&lt;P&gt;Or plot ROC curve by yourself ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/********Plot ROC curve***********/
options validvarname=any;
libname x v9 'D:\工作文件\花生好车2\备份\hs_data' access=readonly;

data have;
 set x.score_card;
 keep good_bad total_score;
run;

proc sort data=have(keep=total_score) out=score nodupkey;
by descending total_score;
run;
data score;
 set score end=last;
 output;
 if last then do;total_score=total_score-1;output;end;
run;
proc sort data=score;
by total_score;
run;

proc sort data=have;
by good_bad total_score;
run;



proc delete data=want;run;
%macro roc(score=);
data temp;
 set have;
 if total_score&amp;lt;=&amp;amp;score then score_good_bad='bad ';
  else score_good_bad='good';
run;
proc sql;
create table temp1 as
 select good_bad,sum(score_good_bad='good')/count(*) as percent
  from temp
   group by good_bad;
quit;
proc transpose data=temp1 out=temp2;
id good_bad;
var percent;
run;
data temp3;
 set temp2(rename=(good=sensitity bad=_1_minus_specifity));
 score=&amp;amp;score;
 drop _name_;
run;
proc append base=want data=temp3 force;
run;
%mend;



data _null_;
 set score;
 call execute(cats('%roc(score=',total_score,')'));
run;



data roc;
 set want;
 dx=-dif(_1_minus_specifity);
 dy=mean(sensitity,lag(sensitity));
 roc=dx*dy;
run;

proc sql noprint;
select sum(roc) into : roc from roc;
quit;




proc sgplot data=want aspect=1 noautolegend;
lineparm x=0 y=0 slope=1/lineattrs=(color=grey);
series x=_1_minus_specifity y=sensitity;
inset "ROC = &amp;amp;roc"/position=topleft;
xaxis grid;
yaxis grid;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 01 Nov 2018 12:51:16 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-11-01T12:51:16Z</dc:date>
    <item>
      <title>How to assess quality of prediction in a logistic regression with random effect.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509442#M26113</link>
      <description>&lt;P&gt;Dear list,&lt;/P&gt;&lt;P&gt;I am trying to predict a dichotomous variable using several covariates (2 continuous covariates, 1 dichotomous variable) using a random effect from clustering (ie animals are coming from different farms and farm (n=19; total of 280 individual data).&lt;/P&gt;&lt;P&gt;I fit my model using proc GLIMMIX using a logit link.&lt;/P&gt;&lt;P&gt;I am used with proc logistic diagnostics using area under curve and looking for quality of predictions in terms of sensitivity and specificity of the model for determining the prediction accuracy.&lt;/P&gt;&lt;P&gt;I am not aware of these types of procedure in PROC GLIMMIX and especially if the same assumptions hold when we add a random effect to a logistic regression model.&lt;/P&gt;&lt;P&gt;Any specific clue/guide to assess the accuracy of prediction in a GLMM?&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 10:32:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509442#M26113</guid>
      <dc:creator>SBuc</dc:creator>
      <dc:date>2018-11-01T10:32:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to assess quality of prediction in a logistic regression with random effect.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509491#M26118</link>
      <description>&lt;P&gt;Confusion Matrix ? and check the goodness of&amp;nbsp; fit statistic in its documentation.&lt;/P&gt;
&lt;P&gt;Or plot ROC curve by yourself ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/********Plot ROC curve***********/
options validvarname=any;
libname x v9 'D:\工作文件\花生好车2\备份\hs_data' access=readonly;

data have;
 set x.score_card;
 keep good_bad total_score;
run;

proc sort data=have(keep=total_score) out=score nodupkey;
by descending total_score;
run;
data score;
 set score end=last;
 output;
 if last then do;total_score=total_score-1;output;end;
run;
proc sort data=score;
by total_score;
run;

proc sort data=have;
by good_bad total_score;
run;



proc delete data=want;run;
%macro roc(score=);
data temp;
 set have;
 if total_score&amp;lt;=&amp;amp;score then score_good_bad='bad ';
  else score_good_bad='good';
run;
proc sql;
create table temp1 as
 select good_bad,sum(score_good_bad='good')/count(*) as percent
  from temp
   group by good_bad;
quit;
proc transpose data=temp1 out=temp2;
id good_bad;
var percent;
run;
data temp3;
 set temp2(rename=(good=sensitity bad=_1_minus_specifity));
 score=&amp;amp;score;
 drop _name_;
run;
proc append base=want data=temp3 force;
run;
%mend;



data _null_;
 set score;
 call execute(cats('%roc(score=',total_score,')'));
run;



data roc;
 set want;
 dx=-dif(_1_minus_specifity);
 dy=mean(sensitity,lag(sensitity));
 roc=dx*dy;
run;

proc sql noprint;
select sum(roc) into : roc from roc;
quit;




proc sgplot data=want aspect=1 noautolegend;
lineparm x=0 y=0 slope=1/lineattrs=(color=grey);
series x=_1_minus_specifity y=sensitity;
inset "ROC = &amp;amp;roc"/position=topleft;
xaxis grid;
yaxis grid;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Nov 2018 12:49:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509491#M26118</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-01T12:49:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to assess quality of prediction in a logistic regression with random effect.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509492#M26119</link>
      <description>&lt;P&gt;Confusion Matrix ? and check the goodness of&amp;nbsp; fit statistic in its documentation.&lt;/P&gt;
&lt;P&gt;Or plot ROC curve by yourself ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/********Plot ROC curve***********/
options validvarname=any;
libname x v9 'D:\工作文件\花生好车2\备份\hs_data' access=readonly;

data have;
 set x.score_card;
 keep good_bad total_score;
run;

proc sort data=have(keep=total_score) out=score nodupkey;
by descending total_score;
run;
data score;
 set score end=last;
 output;
 if last then do;total_score=total_score-1;output;end;
run;
proc sort data=score;
by total_score;
run;

proc sort data=have;
by good_bad total_score;
run;



proc delete data=want;run;
%macro roc(score=);
data temp;
 set have;
 if total_score&amp;lt;=&amp;amp;score then score_good_bad='bad ';
  else score_good_bad='good';
run;
proc sql;
create table temp1 as
 select good_bad,sum(score_good_bad='good')/count(*) as percent
  from temp
   group by good_bad;
quit;
proc transpose data=temp1 out=temp2;
id good_bad;
var percent;
run;
data temp3;
 set temp2(rename=(good=sensitity bad=_1_minus_specifity));
 score=&amp;amp;score;
 drop _name_;
run;
proc append base=want data=temp3 force;
run;
%mend;



data _null_;
 set score;
 call execute(cats('%roc(score=',total_score,')'));
run;



data roc;
 set want;
 dx=-dif(_1_minus_specifity);
 dy=mean(sensitity,lag(sensitity));
 roc=dx*dy;
run;

proc sql noprint;
select sum(roc) into : roc from roc;
quit;




proc sgplot data=want aspect=1 noautolegend;
lineparm x=0 y=0 slope=1/lineattrs=(color=grey);
series x=_1_minus_specifity y=sensitity;
inset "ROC = &amp;amp;roc"/position=topleft;
xaxis grid;
yaxis grid;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Nov 2018 12:51:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509492#M26119</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-01T12:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to assess quality of prediction in a logistic regression with random effect.</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509529#M26120</link>
      <description>&lt;P&gt;An ROC analysis can be done by using the predicted probabilities from the GLIMMIX model in PROC LOGISTIC as discussed and illustrated in &lt;A href="http://support.sas.com/kb/41364" target="_self"&gt;this note&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Nov 2018 14:20:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-assess-quality-of-prediction-in-a-logistic-regression/m-p/509529#M26120</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2018-11-01T14:20:06Z</dc:date>
    </item>
  </channel>
</rss>

