<?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 replace parameter coefficient in logistic regression model in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/622121#M29962</link>
    <description>&lt;P&gt;I appreciate your message.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I'm sorry I didn't explain it clear enough.&lt;BR /&gt;The treatment estimate doesn't generate from the fitted model because it summarizes information through combines the analysis results from other samples, I only want to replace the original treatment estimate with the new calibration estimate, and estimates from other explanatory variables are reserved.&lt;/P&gt;&lt;P&gt;The problem has been solved. Thank you for providing the another information about computing predicted values of the fitted model. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Feb 2020 06:35:46 GMT</pubDate>
    <dc:creator>Pin013</dc:creator>
    <dc:date>2020-02-04T06:35:46Z</dc:date>
    <item>
      <title>How to replace parameter coefficient in logistic regression model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/621889#M29953</link>
      <description>&lt;P&gt;Greetings all.&lt;/P&gt;&lt;P&gt;I fit an logistic regression model which the variables contains treatment(binary) and some explanatory variable(continuous).&lt;BR /&gt;Now I want to edit the treatment estimate from the same model to calculate the scores for the purpose of obtaining the ROC analysis.&lt;BR /&gt;I saved model information to a data set with the OUTMODEL= option, and I'm trying to build new data set("model2") which replace the estimate and the standard error from previous model information ("mode11"), then use it to recalculate the scores.&lt;BR /&gt;But the following error is issued and the step terminates:&lt;BR /&gt;" ERROR: Computations are terminated because the INMODEL=WORK.model2 data set has lost information. "&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;My code is:&lt;/P&gt;&lt;P&gt;/*logistic model*/&lt;BR /&gt;&lt;FONT color="#808080"&gt;proc logistic data=data1 descending outmodel=model1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&amp;nbsp; class y t(ref="0")/param = ref;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&amp;nbsp; model y(event='1')=t c1 c2 u;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*output predict probability*/&lt;BR /&gt;&lt;FONT color="#999999"&gt;proc logistic inmodel=model1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; score data=data1 out=probpred1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; format P_1 10.7;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*new model (have error?)*/&lt;BR /&gt;&lt;FONT color="#999999"&gt;data model2(type=logismod); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; set model1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; if (_TYPE_='E') AND (_NAME_='EFFECT') AND (_CATEGORY_='E') AND (_NAMEIDX_=0) AND (_CATIDX_=0) then _MISC_=0.7802293905;&amp;nbsp; &amp;nbsp;/*replace treatment parameter estimate*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; if (_TYPE_='E') AND (_NAME_='EFFECT') AND (_CATEGORY_='V') AND (_NAMEIDX_=.) AND (_CATIDX_=0) then _MISC_=0.123159491;&amp;nbsp; &amp;nbsp; /*replace standard error*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*recalculate score (have error!!)*/&lt;BR /&gt;&lt;FONT color="#999999"&gt;proc logistic inmodel=mode12(type=logismod);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; score data = data1 out=probpred2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any help would be appreciated! Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 09:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/621889#M29953</guid>
      <dc:creator>Pin013</dc:creator>
      <dc:date>2020-02-03T09:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace parameter coefficient in logistic regression model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/621926#M29956</link>
      <description>&lt;P&gt;It sounds like you want to want to score a data set by using the model that fits the training data, then score the same data set by using a different (but perhaps similar) model. &lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_logistic_syntax08.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;The LOGISTIC procedure supports the CODE statement&lt;/A&gt;, which generates DATA step code that you can use the score new observations. I suggest you :&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use the CODE statement to generate the fitted model. Write the DATA step code to OrigModel.sas.&lt;/LI&gt;
&lt;LI&gt;Use a text editor to edit OrigModel.sas. Make whatever changes you want to create the second model. Save the file to NewModel.sas.&lt;/LI&gt;
&lt;LI&gt;You can now &lt;A href="https://go.documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_introcom_sect013.htm&amp;amp;docsetVersion=15.1&amp;amp;locale=en" target="_self"&gt;create two DATA steps to score the data&lt;/A&gt;. The first uses %INCLUDE OrigModel&amp;nbsp; and the second uses %INCLUDE NewModel.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 03 Feb 2020 13:03:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/621926#M29956</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2020-02-03T13:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace parameter coefficient in logistic regression model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/621975#M29957</link>
      <description>&lt;P&gt;Here's an example of what you were trying to do and you can run this code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-logistic-regression-formula-from-estimates/td-p/120780" target="_blank"&gt;https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-logistic-regression-formula-from-estimates/td-p/120780&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=Neuralgia2 outest=sample;
   class sex (ref='0') / param=ref ;
   model Pain (event='1') = age sex ;
   output out=pred p=phat
        predprob=(individual crossvalidate) ;
run ;


/* the formula I am trying to replicate in Excel is the 'myformula' variable
   in the below data set
                                                                            */
data logformula (keep= age sex pain ip_1 myformula difference);
    set pred;
    if _n_=1 then set sample (keep = intercept age sex1 rename = (age=age_estimate sex1=sex_estimate));
    length sex_estimate age_estimate intercept myformula 8. ;
   
    myformula = 1/(1+exp(-1*(intercept+(sex_estimate*sex) + (age_estimate*age)))); *&amp;lt;&amp;lt;&amp;lt; can't get this to match ip_1;
    difference=phat-myformula;
   
    format difference 12.8;
run;


proc print data=logformula (obs=25) ;
    var sex age pain ip_1 myformula ; * I need to be able to replicate ip_1 given MLE values;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could probably generalize this, if it's something you do often.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/310223"&gt;@Pin013&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Greetings all.&lt;/P&gt;
&lt;P&gt;I fit an logistic regression model which the variables contains treatment(binary) and some explanatory variable(continuous).&lt;BR /&gt;Now I want to edit the treatment estimate from the same model to calculate the scores for the purpose of obtaining the ROC analysis.&lt;BR /&gt;I saved model information to a data set with the OUTMODEL= option, and I'm trying to build new data set("model2") which replace the estimate and the standard error from previous model information ("mode11"), then use it to recalculate the scores.&lt;BR /&gt;But the following error is issued and the step terminates:&lt;BR /&gt;" ERROR: Computations are terminated because the INMODEL=WORK.model2 data set has lost information. "&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;My code is:&lt;/P&gt;
&lt;P&gt;/*logistic model*/&lt;BR /&gt;&lt;FONT color="#808080"&gt;proc logistic data=data1 descending outmodel=model1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&amp;nbsp; class y t(ref="0")/param = ref;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;&amp;nbsp; model y(event='1')=t c1 c2 u;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808080"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*output predict probability*/&lt;BR /&gt;&lt;FONT color="#999999"&gt;proc logistic inmodel=model1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; score data=data1 out=probpred1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; format P_1 10.7;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*new model (have error?)*/&lt;BR /&gt;&lt;FONT color="#999999"&gt;data model2(type=logismod); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; set model1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; if (_TYPE_='E') AND (_NAME_='EFFECT') AND (_CATEGORY_='E') AND (_NAMEIDX_=0) AND (_CATIDX_=0) then _MISC_=0.7802293905;&amp;nbsp; &amp;nbsp;/*replace treatment parameter estimate*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; if (_TYPE_='E') AND (_NAME_='EFFECT') AND (_CATEGORY_='V') AND (_NAMEIDX_=.) AND (_CATIDX_=0) then _MISC_=0.123159491;&amp;nbsp; &amp;nbsp; /*replace standard error*/&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/*recalculate score (have error!!)*/&lt;BR /&gt;&lt;FONT color="#999999"&gt;proc logistic inmodel=mode12(type=logismod);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;&amp;nbsp; score data = data1 out=probpred2;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#999999"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Any help would be appreciated! Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 16:10:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/621975#M29957</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-02-03T16:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace parameter coefficient in logistic regression model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/622113#M29961</link>
      <description>&lt;P&gt;Thank you for your help &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;! It works perfectly. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Best wishes.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 05:57:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/622113#M29961</guid>
      <dc:creator>Pin013</dc:creator>
      <dc:date>2020-02-04T05:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace parameter coefficient in logistic regression model</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/622121#M29962</link>
      <description>&lt;P&gt;I appreciate your message.&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I'm sorry I didn't explain it clear enough.&lt;BR /&gt;The treatment estimate doesn't generate from the fitted model because it summarizes information through combines the analysis results from other samples, I only want to replace the original treatment estimate with the new calibration estimate, and estimates from other explanatory variables are reserved.&lt;/P&gt;&lt;P&gt;The problem has been solved. Thank you for providing the another information about computing predicted values of the fitted model. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 06:35:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/How-to-replace-parameter-coefficient-in-logistic-regression/m-p/622121#M29962</guid>
      <dc:creator>Pin013</dc:creator>
      <dc:date>2020-02-04T06:35:46Z</dc:date>
    </item>
  </channel>
</rss>

