<?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 add fixed effect in proc nlin in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765992#M37441</link>
    <description>&lt;P&gt;Hi SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to add the firm and year fixed effect in the PROC NLIN statement for the piecewise regression ? my current code does not have any fixed effect in the regression Xpart = a1 + b1*X; and Xpart = a1 + c*(b1-b2) + b2*X;. Thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC NLIN DATA=local.plot2 MAXITER=1000 METHOD=MARQUARDT;&lt;BR /&gt;PARMS a1=1 b1=-2 c=3 b2=4 ;&lt;BR /&gt;Xpart = a1 + b1*X;&lt;BR /&gt;IF (X &amp;gt; c) THEN DO;&lt;BR /&gt;Xpart = a1 + c*(b1-b2) + b2*X;&lt;BR /&gt;end;&lt;BR /&gt;MODEL Y = Xpart;&lt;BR /&gt;OUTPUT OUT=PIECEFIT R=RESID P=PRED;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- FIT THE POWER MODEL (FOR COMPARISON) USING NONLINEAR PROCEDURE -- *;&lt;BR /&gt;PROC NLIN DATA=local.plot2 MAXITER=1000 METHOD=MARQUARDT;&lt;BR /&gt;PARMS a=1 b1=2 b2=3;&lt;BR /&gt;MODEL Y = a1 + b1*X**b2;&lt;BR /&gt;OUTPUT OUT=POWERFIT R=PWR_RESID P=PWR_PRED;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- COMBINE OUTPUT FROM BOTH MODELS -- *;&lt;BR /&gt;DATA ALL;&lt;BR /&gt;SET PIECEFIT POWERFIT;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- PLOT DATA, PIECEWISE REGRESSION FIT, AND POWER MODEL FIT -- *;&lt;BR /&gt;SYMBOL1 f=marker v=U i=none c=blue;&lt;BR /&gt;SYMBOL2 v=none i=join line=1 w=3 c=blue;&lt;BR /&gt;SYMBOL3 v=none i=join line=2 w=3 c=black;&lt;BR /&gt;AXIS2 label = (a=90 r=0);&lt;BR /&gt;PROC GPLOT DATA=ALL;&lt;BR /&gt;PLOT Y*X=1 PRED*X=2 PWR_PRED*X=3 / OVERLAY FRAME VAXIS=AXIS2;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
    <pubDate>Sat, 04 Sep 2021 01:31:21 GMT</pubDate>
    <dc:creator>Nieves</dc:creator>
    <dc:date>2021-09-04T01:31:21Z</dc:date>
    <item>
      <title>add fixed effect in proc nlin</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765992#M37441</link>
      <description>&lt;P&gt;Hi SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to add the firm and year fixed effect in the PROC NLIN statement for the piecewise regression ? my current code does not have any fixed effect in the regression Xpart = a1 + b1*X; and Xpart = a1 + c*(b1-b2) + b2*X;. Thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC NLIN DATA=local.plot2 MAXITER=1000 METHOD=MARQUARDT;&lt;BR /&gt;PARMS a1=1 b1=-2 c=3 b2=4 ;&lt;BR /&gt;Xpart = a1 + b1*X;&lt;BR /&gt;IF (X &amp;gt; c) THEN DO;&lt;BR /&gt;Xpart = a1 + c*(b1-b2) + b2*X;&lt;BR /&gt;end;&lt;BR /&gt;MODEL Y = Xpart;&lt;BR /&gt;OUTPUT OUT=PIECEFIT R=RESID P=PRED;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- FIT THE POWER MODEL (FOR COMPARISON) USING NONLINEAR PROCEDURE -- *;&lt;BR /&gt;PROC NLIN DATA=local.plot2 MAXITER=1000 METHOD=MARQUARDT;&lt;BR /&gt;PARMS a=1 b1=2 b2=3;&lt;BR /&gt;MODEL Y = a1 + b1*X**b2;&lt;BR /&gt;OUTPUT OUT=POWERFIT R=PWR_RESID P=PWR_PRED;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- COMBINE OUTPUT FROM BOTH MODELS -- *;&lt;BR /&gt;DATA ALL;&lt;BR /&gt;SET PIECEFIT POWERFIT;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- PLOT DATA, PIECEWISE REGRESSION FIT, AND POWER MODEL FIT -- *;&lt;BR /&gt;SYMBOL1 f=marker v=U i=none c=blue;&lt;BR /&gt;SYMBOL2 v=none i=join line=1 w=3 c=blue;&lt;BR /&gt;SYMBOL3 v=none i=join line=2 w=3 c=black;&lt;BR /&gt;AXIS2 label = (a=90 r=0);&lt;BR /&gt;PROC GPLOT DATA=ALL;&lt;BR /&gt;PLOT Y*X=1 PRED*X=2 PWR_PRED*X=3 / OVERLAY FRAME VAXIS=AXIS2;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 01:31:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765992#M37441</guid>
      <dc:creator>Nieves</dc:creator>
      <dc:date>2021-09-04T01:31:21Z</dc:date>
    </item>
    <item>
      <title>fixed effect in proc nlin</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765576#M37442</link>
      <description>&lt;P&gt;Hi SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to add the fixed effect in the PROC NLIN statement for the piecewise regression ? my current code does not have any fixed effect in the regression Xpart = a1 + b1*X; and Xpart = a1 + c*(b1-b2) + b2*X;. Thanks !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PROC NLIN DATA=local.plot2 MAXITER=1000 METHOD=MARQUARDT;&lt;BR /&gt;PARMS a1=1 b1=-2 c=3 b2=4 ;&lt;BR /&gt;Xpart = a1 + b1*X;&lt;BR /&gt;IF (X &amp;gt; c) THEN DO;&lt;BR /&gt;Xpart = a1 + c*(b1-b2) + b2*X;&lt;BR /&gt;end;&lt;BR /&gt;MODEL Y = Xpart;&lt;BR /&gt;OUTPUT OUT=PIECEFIT R=RESID P=PRED;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- FIT THE POWER MODEL (FOR COMPARISON) USING NONLINEAR PROCEDURE -- *;&lt;BR /&gt;PROC NLIN DATA=local.plot2 MAXITER=1000 METHOD=MARQUARDT;&lt;BR /&gt;PARMS a=1 b1=2 b2=3;&lt;BR /&gt;MODEL Y = a1 + b1*X**b2;&lt;BR /&gt;OUTPUT OUT=POWERFIT R=PWR_RESID P=PWR_PRED;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- COMBINE OUTPUT FROM BOTH MODELS -- *;&lt;BR /&gt;DATA ALL;&lt;BR /&gt;SET PIECEFIT POWERFIT;&lt;BR /&gt;RUN;&lt;BR /&gt;* -- PLOT DATA, PIECEWISE REGRESSION FIT, AND POWER MODEL FIT -- *;&lt;BR /&gt;SYMBOL1 f=marker v=U i=none c=blue;&lt;BR /&gt;SYMBOL2 v=none i=join line=1 w=3 c=blue;&lt;BR /&gt;SYMBOL3 v=none i=join line=2 w=3 c=black;&lt;BR /&gt;AXIS2 label = (a=90 r=0);&lt;BR /&gt;PROC GPLOT DATA=ALL;&lt;BR /&gt;PLOT Y*X=1 PRED*X=2 PWR_PRED*X=3 / OVERLAY FRAME VAXIS=AXIS2;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Sep 2021 08:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765576#M37442</guid>
      <dc:creator>Nieves</dc:creator>
      <dc:date>2021-09-02T08:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: fixed effect in proc nlin</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765900#M37443</link>
      <description>&lt;P&gt;It's not clear to me what you mean with "adding a fixed effect"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL class="lia-list-style-type-square"&gt;
&lt;LI&gt;Is your code giving errors (then provide us with the LOG)?&lt;/LI&gt;
&lt;LI&gt;Is your code not giving errors but not doing what you want either, then explain further!&lt;/LI&gt;
&lt;LI&gt;Do you have other effects that you want to account for in Y (besides X) and you do not know how to integrate them in the formulas?&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;FONT color="#00FF00"&gt;[EDIT]&lt;/FONT&gt; Also better to move this topic thread to the "Statistical Procedures" board!&lt;/P&gt;
&lt;P&gt;Analytics (header) &amp;gt; Statistical procedures.&lt;/P&gt;
&lt;P&gt;Can someone with superpowers do so?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Fri, 03 Sep 2021 17:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765900#M37443</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-09-03T17:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: fixed effect in proc nlin</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765991#M37444</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Koen,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you very much for your reply. My&lt;/SPAN&gt;&amp;nbsp;code is not giving errors but not doing what I want. I would like to add firm and year fixed effect in the regression. Currently, I only have explanatory variable x in the regression. I'm not sure how to include firm and year fixed effect in the proc nlin process.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 01:28:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/765991#M37444</guid>
      <dc:creator>Nieves</dc:creator>
      <dc:date>2021-09-04T01:28:29Z</dc:date>
    </item>
    <item>
      <title>Re: fixed effect in proc nlin</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/766029#M37445</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/153186"&gt;@Nieves&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you just have to add FIRM and YEAR to&amp;nbsp;&lt;SPAN&gt;Xpart = (both Xpart-s!).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But it seems you are doing econometrics and having panel data (time series cross-sectional) data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For panel data (and for having correct parameter estimation methods for non-independent observations and clusters in the data), there is PROC MIXED (or PROC GLIMMIX), PROC PANEL, PROC TSCSREG and PROC CPANEL (SAS VIYA Econometrics).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But these 4 procedures do not allow for the segmented regression (broken-stick regression) you are aiming at.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Segmented regression (Segmented Models) is also known as 'broken-stick regression' or 'Change Point Models'.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can also use PROC MCMC (&lt;EM&gt;Markov chain Monte Carlo&lt;/EM&gt;) for&amp;nbsp;'Change Point Models'. See the doc for PROC MCMC.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope you can sort it out.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Kind regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 04 Sep 2021 11:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/add-fixed-effect-in-proc-nlin/m-p/766029#M37445</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2021-09-04T11:50:35Z</dc:date>
    </item>
  </channel>
</rss>

