<?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 Survival in EM - Recreate Curves on Scored Data? in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Survival-in-EM-Recreate-Curves-on-Scored-Data/m-p/194688#M2498</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have successfully built a survival model in EM which has a K-S of 30 in both Train, Valid, and Test. So I assume the model is pretty good.&lt;/P&gt;&lt;P&gt;Here are some facts about it:&lt;/P&gt;&lt;P&gt;- built it on a sample of 500K obs&lt;/P&gt;&lt;P&gt;- unexpanded data&lt;/P&gt;&lt;P&gt;- no time vary-ing covariates&lt;/P&gt;&lt;P&gt;- Forecasting 36 month-intervals&lt;/P&gt;&lt;P&gt;- Customer base ranges from tenure of 0 months to 250 months&lt;/P&gt;&lt;P&gt;- No truncation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The curves drawn by the Node Results are very nice. I can see hazard spikes during months that make sense (at 3,12,24,48 months). The survival curve also look nice, it descends as I'd expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, now that I've scored the data, I'd like to replicate these curves by querying the results. However when I try - the curves look vastly different. When I graph _t_ (tenure of customer) vs Avg(EM_SURVEVENT) - my curve looks weird, in fact it even increases along the way!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something wrong with the way I am trying to recreate these charts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried graphing instant risk and subhazard functions against _T_ and it also did not match the model graphs, so I'm afraid there is something wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source of Model Curve:&amp;nbsp; SAS Survival Node =&amp;gt; Results =&amp;gt; click chart =&amp;gt; Tables button at top of screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source of Scored Curve:&lt;/P&gt;&lt;P&gt;SELECT _T_ AS RELATIVE_TENURE, AVG(1-((EM_SURVIVAL-EM_SURVFCST)/EM_SURVIVAL)) AS S&lt;/P&gt;&lt;P&gt;FROM [Scored Results]&lt;/P&gt;&lt;P&gt;GROUP BY _T_;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Jul 2015 21:48:49 GMT</pubDate>
    <dc:creator>JBerry</dc:creator>
    <dc:date>2015-07-02T21:48:49Z</dc:date>
    <item>
      <title>Survival in EM - Recreate Curves on Scored Data?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Survival-in-EM-Recreate-Curves-on-Scored-Data/m-p/194688#M2498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have successfully built a survival model in EM which has a K-S of 30 in both Train, Valid, and Test. So I assume the model is pretty good.&lt;/P&gt;&lt;P&gt;Here are some facts about it:&lt;/P&gt;&lt;P&gt;- built it on a sample of 500K obs&lt;/P&gt;&lt;P&gt;- unexpanded data&lt;/P&gt;&lt;P&gt;- no time vary-ing covariates&lt;/P&gt;&lt;P&gt;- Forecasting 36 month-intervals&lt;/P&gt;&lt;P&gt;- Customer base ranges from tenure of 0 months to 250 months&lt;/P&gt;&lt;P&gt;- No truncation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The curves drawn by the Node Results are very nice. I can see hazard spikes during months that make sense (at 3,12,24,48 months). The survival curve also look nice, it descends as I'd expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, now that I've scored the data, I'd like to replicate these curves by querying the results. However when I try - the curves look vastly different. When I graph _t_ (tenure of customer) vs Avg(EM_SURVEVENT) - my curve looks weird, in fact it even increases along the way!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something wrong with the way I am trying to recreate these charts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried graphing instant risk and subhazard functions against _T_ and it also did not match the model graphs, so I'm afraid there is something wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source of Model Curve:&amp;nbsp; SAS Survival Node =&amp;gt; Results =&amp;gt; click chart =&amp;gt; Tables button at top of screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source of Scored Curve:&lt;/P&gt;&lt;P&gt;SELECT _T_ AS RELATIVE_TENURE, AVG(1-((EM_SURVIVAL-EM_SURVFCST)/EM_SURVIVAL)) AS S&lt;/P&gt;&lt;P&gt;FROM [Scored Results]&lt;/P&gt;&lt;P&gt;GROUP BY _T_;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 21:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Survival-in-EM-Recreate-Curves-on-Scored-Data/m-p/194688#M2498</guid>
      <dc:creator>JBerry</dc:creator>
      <dc:date>2015-07-02T21:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: Survival in EM - Recreate Curves on Scored Data?</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Survival-in-EM-Recreate-Curves-on-Scored-Data/m-p/194689#M2499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey JBerry,&lt;/P&gt;&lt;P&gt;Not sure I get the second part, specially instant risk. But I am no expert in survival analysis. I use this node a lot, mostly to get hazard functions, but I am still very low on the learning curb.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It sounds to me like you were trying to get the survival function?&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="survival function.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/11168_survival function.png" width="450" /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I was to redo the survival function in EM, I would add something like the below in the SAS Code node. Notice that your survival node creates a dataset _ehcendata which summarizes events, event dates, and _y_.&lt;/P&gt;&lt;P&gt;You can use that to get the curves you were looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add the below in a SAS code node and connect it to your Survival node.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; data ehcendata;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set &amp;amp;EM_LIB..&amp;amp;EM_METASOURCE_NODEID._ehcendata;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; proc lifetest data=ehcendata method=LT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; time _y_*event(0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you did it in base SAS you would also get the plots (change em_lib for your workspace and em_metasource_nodeid for your survival node ID).&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;IMG alt="SurvivalPlot1.png" class="jive-image-thumbnail jive-image" src="https://communities.sas.com/legacyfs/online/11169_SurvivalPlot1.png" width="450" /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jul 2015 00:15:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Survival-in-EM-Recreate-Curves-on-Scored-Data/m-p/194689#M2499</guid>
      <dc:creator>M_Maldonado</dc:creator>
      <dc:date>2015-07-15T00:15:22Z</dc:date>
    </item>
  </channel>
</rss>

