<?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: SAS code for a model with 3 change points in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/877843#M43412</link>
    <description>&lt;P&gt;You might want to start by reading the article, "Piecewise regression models and spline effects":&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/04/05/nonsmooth-models-spline-effects.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/04/05/nonsmooth-models-spline-effects.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that article, there is one CLAS variable that describes the time intervals. I guess your intervals are&lt;/P&gt;
&lt;P&gt;"Before 1",&amp;nbsp;&lt;BR /&gt;"After 1 before 2"&lt;/P&gt;
&lt;P&gt;"After 2 before 3"&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;"After 3"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You did not tell us whether the model is continuous at the changepoints. The article shows how to use GLM&amp;nbsp; and a CLASS statement for models that have a jump discontinuity at the intervention point. For continuous models, you can move to PROC GLMMIX and use the EFFECT statement to create a spline effect where the knots are placed at the intervention locations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, your model can also be handled by PROC GLM.&lt;/P&gt;</description>
    <pubDate>Sat, 27 May 2023 10:12:43 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2023-05-27T10:12:43Z</dc:date>
    <item>
      <title>SAS code for a model with 3 change points</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/877621#M43402</link>
      <description>&lt;P&gt;Hello SAS experts and enthusiasts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to translate the following modeled equation into a proc genmod function for running a regression for the purpose of an interrupted time series analysis. There are 3 change points that I am interested in, hence 7 Beta coefficients .&lt;/P&gt;
&lt;DIV id="tinyMceEditormmaximos_0" class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2023-05-25 at 9.07.12 PM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/84335i830F807708DECB43/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2023-05-25 at 9.07.12 PM.png" alt="Screen Shot 2023-05-25 at 9.07.12 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Where:&lt;/P&gt;
&lt;P&gt;y= prescriptions&lt;/P&gt;
&lt;P&gt;Bo= y-intercept&lt;/P&gt;
&lt;P&gt;Bx*time(t)= estimated level change in prescriptions from start of observation period&lt;/P&gt;
&lt;P&gt;Bx*time after intervention X (t)= time after the intervention has occurred in months (slope change)&lt;/P&gt;
&lt;P&gt;Et= random variability error term&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the code that I've generated to test the fitted model:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="none"&gt;proc&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;STRONG&gt;&lt;SPAN data-contrast="none"&gt;genmod&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN data-contrast="none"&gt;data&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;=&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;its&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;;&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{&amp;quot;201341983&amp;quot;:0,&amp;quot;335559739&amp;quot;:0,&amp;quot;335559740&amp;quot;:240}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;model&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;prescriptions&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;=&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt; obs intervention t_int1 intervention2 t_int2&amp;nbsp; intervention3 t_int3&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;/&lt;/SPAN&gt; &lt;SPAN data-contrast="none"&gt;link&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;=&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;identity &lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;dist&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;=&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;normal&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;;&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{&amp;quot;201341983&amp;quot;:0,&amp;quot;335559739&amp;quot;:0,&amp;quot;335559740&amp;quot;:240}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;output&lt;/SPAN&gt; &lt;SPAN data-contrast="none"&gt;pred&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;=&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;pred&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;;&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{&amp;quot;201341983&amp;quot;:0,&amp;quot;335559739&amp;quot;:0,&amp;quot;335559740&amp;quot;:240}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN data-contrast="none"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN data-contrast="none"&gt;;&lt;/SPAN&gt;&lt;SPAN data-contrast="none"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN data-ccp-props="{&amp;quot;201341983&amp;quot;:0,&amp;quot;335559739&amp;quot;:0,&amp;quot;335559740&amp;quot;:240}"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would this be sufficient or do I have to enter the SAS code in the same manner as the model is written and if so, what would that look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 01:19:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/877621#M43402</guid>
      <dc:creator>mmaximos</dc:creator>
      <dc:date>2023-05-26T01:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code for a model with 3 change points</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/877843#M43412</link>
      <description>&lt;P&gt;You might want to start by reading the article, "Piecewise regression models and spline effects":&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/04/05/nonsmooth-models-spline-effects.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2017/04/05/nonsmooth-models-spline-effects.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In that article, there is one CLAS variable that describes the time intervals. I guess your intervals are&lt;/P&gt;
&lt;P&gt;"Before 1",&amp;nbsp;&lt;BR /&gt;"After 1 before 2"&lt;/P&gt;
&lt;P&gt;"After 2 before 3"&lt;/P&gt;
&lt;P&gt;and&lt;/P&gt;
&lt;P&gt;"After 3"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You did not tell us whether the model is continuous at the changepoints. The article shows how to use GLM&amp;nbsp; and a CLASS statement for models that have a jump discontinuity at the intervention point. For continuous models, you can move to PROC GLMMIX and use the EFFECT statement to create a spline effect where the knots are placed at the intervention locations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, your model can also be handled by PROC GLM.&lt;/P&gt;</description>
      <pubDate>Sat, 27 May 2023 10:12:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/877843#M43412</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-05-27T10:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code for a model with 3 change points</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/878444#M43429</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp; for your guidance and I will read the article. The model is continuous at the changepoints. I am aware I can use the PROC GLM function, thank you; I was hoping to use the PROC GENMOD function for the purpose of practice.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 14:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/SAS-code-for-a-model-with-3-change-points/m-p/878444#M43429</guid>
      <dc:creator>mmaximos</dc:creator>
      <dc:date>2023-05-31T14:38:37Z</dc:date>
    </item>
  </channel>
</rss>

