<?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: Scoring new data - proc LOGISTIC with OFFSET option in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632932#M30332</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;DIV class="post-info"&gt;&lt;A href="https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632779#M30327" target="_blank" rel="noopener"&gt;&lt;SPAN class="message-date"&gt;Mar 17, 2020 1:16 PM&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="message-date-views"&gt;(41 views)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="reply-author"&gt;&amp;nbsp;|&amp;nbsp;&amp;nbsp;Posted in reply to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A title="Message from 03-16-2020" href="https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632494#M30315" target="_blank" rel="noopener"&gt;message from Lahrie 03-16-2020&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;If you were going to do the scoring in SAS, I would suggest that you just write a DATA step to compute x*beta omitting the offset and then apply the inverse link as I mentioned. You can see some example code in section 4 of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://support.sas.com/kb/33307" target="_self" rel="nofollow noopener noreferrer"&gt;this note&lt;/A&gt;. But since you say you are not going to use SAS to do the scoring, then you will have to do the equivalent of that in whatever you intend to use. Still, you might find it helpful to first do it in SAS and satisfy yourself that you get the correct scores before translating that into whatever you use to score.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I've tested your suggestion but I couldn't get the correct prob.&amp;nbsp;Let me describe my steps:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc logistic data=datax;
model conc(event="0")= SU FIN gp5
/selection=stepwise offset=off;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This logistic give me the following estimates:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Parameter Estimate&lt;BR /&gt;Intercept -7.212&lt;BR /&gt;SU&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.7096&lt;BR /&gt;FIN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.5471&lt;BR /&gt;GP5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.9827&lt;BR /&gt;off&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.000&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So, I tried to score a new dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data sample;
input SU FIN GP5;
datalines;
0 0 0
1 1 0
1 0 0
1 1 1
0 0 1
;

data z;
set sample;

xbeta= - 7.2120 +
    SU * 0.7096 +
   FIN * 1.5471 +
   GP5 * 0.9827 ; /* I've ommited the offset estimate */

p = 1 / (1 + exp(-xbeta));
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;results below:&lt;BR /&gt;SU FIN GP5 xbeta p&lt;BR /&gt;0 0 0 -7.212 0.0007371365&lt;BR /&gt;1 1 0 -4.9553 0.0069966679&lt;BR /&gt;1 0 0 -6.5024 0.0014975891&lt;BR /&gt;1 1 1 -3.9726 0.0184766143&lt;BR /&gt;0 0 1 -6.2293 0.0019669545&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the P is too much small and very different from those score in logistic step. Could you help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 Mar 2020 12:12:08 GMT</pubDate>
    <dc:creator>Lahrie</dc:creator>
    <dc:date>2020-03-18T12:12:08Z</dc:date>
    <item>
      <title>Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632429#M30311</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used PROC LOGISTIC with OFFSET option, as I'm dealing with rare target data. Is it possible to score a new dataset without using &lt;EM&gt;inmodel&lt;/EM&gt; option? How to do it?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The new dataset will be scored using another program, so I can't use any SAS function to score it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 13:47:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632429#M30311</guid>
      <dc:creator>Lahrie</dc:creator>
      <dc:date>2020-03-16T13:47:07Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632432#M30312</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The new dataset will be scored using another program, so I can't use any SAS function to score it.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Explain this. Why are you asking a SAS question and then say you can't use SAS to do the scoring.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 13:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632432#M30312</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-16T13:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632455#M30313</link>
      <description>&lt;P&gt;See &lt;A href="http://support.sas.com/kb/22601" target="_self"&gt;this note&lt;/A&gt;. As shown there, predicted probabilities can be produced by removing the offset from the x*beta computation and then applying the inverse link function: 1/1+exp(-xbeta) .&amp;nbsp; The inverse link function is implemented as the LOGISTIC function in the DATA step which is used in the note.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Mar 2020 15:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632455#M30313</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2020-03-16T15:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632456#M30314</link>
      <description>Use the CODE statement within PROC LOGISTIC to get the code, check the documentation for details. You'll still have to do some 'translation' but it's much easier. If you're using SAS Enterprise Miner it can give you code in several languages.</description>
      <pubDate>Mon, 16 Mar 2020 15:16:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632456#M30314</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-03-16T15:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632494#M30315</link>
      <description>Hi. I used the CODE option and I saw that is necessary to inform the offset value. My new data have the real proportion of goods and bads. How I can get the code without using the offset value?&lt;BR /&gt;&lt;BR /&gt;Tks</description>
      <pubDate>Mon, 16 Mar 2020 17:26:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632494#M30315</guid>
      <dc:creator>Lahrie</dc:creator>
      <dc:date>2020-03-16T17:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632779#M30327</link>
      <description>&lt;P&gt;If you were going to do the scoring in SAS, I would suggest that you just write a DATA step to compute x*beta omitting the offset and then apply the inverse link as I mentioned. You can see some example code in section 4 of &lt;A href="http://support.sas.com/kb/33307" target="_self"&gt;this note&lt;/A&gt;. But since you say you are not going to use SAS to do the scoring, then you will have to do the equivalent of that in whatever you intend to use. Still, you might find it helpful to first do it in SAS and satisfy yourself that you get the correct scores before translating that into whatever you use to score.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Mar 2020 20:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632779#M30327</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2020-03-17T20:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632932#M30332</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;DIV class="post-info"&gt;&lt;A href="https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632779#M30327" target="_blank" rel="noopener"&gt;&lt;SPAN class="message-date"&gt;Mar 17, 2020 1:16 PM&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN class="message-date-views"&gt;(41 views)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="reply-author"&gt;&amp;nbsp;|&amp;nbsp;&amp;nbsp;Posted in reply to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A title="Message from 03-16-2020" href="https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632494#M30315" target="_blank" rel="noopener"&gt;message from Lahrie 03-16-2020&lt;/A&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;If you were going to do the scoring in SAS, I would suggest that you just write a DATA step to compute x*beta omitting the offset and then apply the inverse link as I mentioned. You can see some example code in section 4 of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://support.sas.com/kb/33307" target="_self" rel="nofollow noopener noreferrer"&gt;this note&lt;/A&gt;. But since you say you are not going to use SAS to do the scoring, then you will have to do the equivalent of that in whatever you intend to use. Still, you might find it helpful to first do it in SAS and satisfy yourself that you get the correct scores before translating that into whatever you use to score.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13633"&gt;@StatDave&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I've tested your suggestion but I couldn't get the correct prob.&amp;nbsp;Let me describe my steps:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;proc logistic data=datax;
model conc(event="0")= SU FIN gp5
/selection=stepwise offset=off;
run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This logistic give me the following estimates:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Parameter Estimate&lt;BR /&gt;Intercept -7.212&lt;BR /&gt;SU&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.7096&lt;BR /&gt;FIN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.5471&lt;BR /&gt;GP5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.9827&lt;BR /&gt;off&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.000&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So, I tried to score a new dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;data sample;
input SU FIN GP5;
datalines;
0 0 0
1 1 0
1 0 0
1 1 1
0 0 1
;

data z;
set sample;

xbeta= - 7.2120 +
    SU * 0.7096 +
   FIN * 1.5471 +
   GP5 * 0.9827 ; /* I've ommited the offset estimate */

p = 1 / (1 + exp(-xbeta));
run;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;results below:&lt;BR /&gt;SU FIN GP5 xbeta p&lt;BR /&gt;0 0 0 -7.212 0.0007371365&lt;BR /&gt;1 1 0 -4.9553 0.0069966679&lt;BR /&gt;1 0 0 -6.5024 0.0014975891&lt;BR /&gt;1 1 1 -3.9726 0.0184766143&lt;BR /&gt;0 0 1 -6.2293 0.0019669545&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the P is too much small and very different from those score in logistic step. Could you help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2020 12:12:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/632932#M30332</guid>
      <dc:creator>Lahrie</dc:creator>
      <dc:date>2020-03-18T12:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Scoring new data - proc LOGISTIC with OFFSET option</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/633065#M30334</link>
      <description>&lt;P&gt;Using the example in the first note I referred to (22601: Adjusting for oversampling the event level in a binary logistic model), these statements compute (in POFF2) essentially the same values as those computed using the logistic function after removing the offset. They differ slightly because the POFF2 computation does not use the full precision of the parameter estimates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;      proc logistic data=sub;
        model y(event="1")=x / offset=off;
        output out=out xbeta=xboff;
        title2 "Offset-adjusted Model";
        run;
      data out;
        set out;
        poff=logistic(xboff-off);
        poff2=1/(1+exp(-( -3.4596 + 2.3149*x )));
        run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Mar 2020 19:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Scoring-new-data-proc-LOGISTIC-with-OFFSET-option/m-p/633065#M30334</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2020-03-18T19:43:52Z</dc:date>
    </item>
  </channel>
</rss>

