<?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: Fitting data to equation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654488#M196537</link>
    <description>&lt;P&gt;Re estimating the "fixed" equation with new coefficients for the independent variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The old&amp;nbsp;coefficients fits to&amp;nbsp;an old dataset,&amp;nbsp;and the task is to re estimate the&amp;nbsp;coefficients given a new dataset with the same "old" equation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS&amp;nbsp;code did 'nt re estimate the independent variables coefficients, maybe the code or generel approach is 'nt correct for re estimating&amp;nbsp; a given equations. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2020 12:10:23 GMT</pubDate>
    <dc:creator>HAHN1989</dc:creator>
    <dc:date>2020-06-08T12:10:23Z</dc:date>
    <item>
      <title>Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654482#M196533</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I want to estimate the following f"ixed" equation; y = a*(b + c + f + g) + a with new coefficients;&lt;/P&gt;&lt;P&gt;Where Y is the depend variable, a is a&amp;nbsp;dummy variable and b, c, f and g are the independent variables.&lt;/P&gt;&lt;P&gt;I have tried the following code without success. The old coefficients are&amp;nbsp;&amp;nbsp;&lt;FONT face="Courier New" size="2"&gt;a=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0.3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; b=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; c=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; f=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; g=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;18. &amp;nbsp;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;nlin&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=work1; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;parms&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0.3&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; b=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; c=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;0.1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; f=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;7&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt; g=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#008080"&gt;18&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;ods&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; ParameterEstimates=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;model&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; salt_tons= a*(b + c + f + g) + a;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions or help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 11:58:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654482#M196533</guid>
      <dc:creator>HAHN1989</dc:creator>
      <dc:date>2020-06-08T11:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654483#M196534</link>
      <description>&lt;P&gt;Define "Without Success". What went wrong? And what did you expect?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 12:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654483#M196534</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-06-08T12:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654488#M196537</link>
      <description>&lt;P&gt;Re estimating the "fixed" equation with new coefficients for the independent variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The old&amp;nbsp;coefficients fits to&amp;nbsp;an old dataset,&amp;nbsp;and the task is to re estimate the&amp;nbsp;coefficients given a new dataset with the same "old" equation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The SAS&amp;nbsp;code did 'nt re estimate the independent variables coefficients, maybe the code or generel approach is 'nt correct for re estimating&amp;nbsp; a given equations. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 12:10:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654488#M196537</guid>
      <dc:creator>HAHN1989</dc:creator>
      <dc:date>2020-06-08T12:10:23Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654593#M196558</link>
      <description>&lt;P&gt;Please post the LOG from the execution of the above code.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 16:44:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654593#M196558</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-06-08T16:44:01Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654683#M196598</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/332778"&gt;@HAHN1989&lt;/a&gt;&amp;nbsp;(and welcome to the SAS Support Communities :-)),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your PARMS statement specifies that &lt;FONT face="courier new,courier"&gt;a&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;b&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;c&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;f&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;g&lt;/FONT&gt; are coefficients to be estimated in order to fit the model to the data. But your equation leaves room for only &lt;EM&gt;one&lt;/EM&gt; variable in "the data": &lt;FONT face="courier new,courier"&gt;y&lt;/FONT&gt; (or really &lt;FONT face="courier new,courier"&gt;salt_tons&lt;/FONT&gt;). In the absence of any "&lt;FONT face="courier new,courier"&gt;x&lt;/FONT&gt;" variables the best fit (in the sense of least squares) would be a solution where&amp;nbsp;&lt;FONT face="courier new,courier"&gt;a*(b + c + f + g) + a&lt;/FONT&gt; equals the &lt;EM&gt;mean&lt;/EM&gt; of &lt;FONT face="courier new,courier"&gt;salt_tons&lt;/FONT&gt;. This is exactly what PROC NLIN did when I applied your code to random data. Only parameter &lt;FONT face="courier new,courier"&gt;a&lt;/FONT&gt; was modified to achieve that almost trivial goal. Obviously, the solution is anything, but unique. &lt;FONT face="courier new,courier"&gt;b=c=f=g=0&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;a=mean(salt_tons)&lt;/FONT&gt; would fit equally "well."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, you need to introduce independent variables from your input dataset &lt;FONT face="courier new,courier"&gt;work1&lt;/FONT&gt; into the model equation (factors suitable for predicting&amp;nbsp;&lt;FONT face="courier new,courier"&gt;salt_tons&lt;/FONT&gt;) and these must not be mentioned in the PARMS statement.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 21:01:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/654683#M196598</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-06-08T21:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/655321#M196628</link>
      <description>&lt;P&gt;Thank you very much for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The model I am intended to describe is&amp;nbsp;the relation between used tons salt on highroads (winter), where the depended variabel Y = used salt, a (dummy- snow or not), b = how&amp;nbsp;many times the road temperatur is below 0,&amp;nbsp;C&amp;nbsp;= equals the temperatur,&amp;nbsp;f= snow below&amp;nbsp;zero degrees and g=&amp;nbsp; smooth&amp;nbsp;&lt;SPAN&gt;roads. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Following the equation --&amp;gt;&amp;nbsp; y=&amp;nbsp;&lt;FONT face="Courier New"&gt;a*(b + c + f + g) + a. &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But after some reading, the proc model statement seems more convenient?&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;model&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;data&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=work1;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;parms&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; a b c f g f;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;salt_tons=&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;a*(b + c + f + g) + a;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;fit&lt;/FONT&gt; &lt;FONT face="Courier New" size="2" color="#800080"&gt;"Salt_tons"&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the following code doens't return any meaningful estimates, is the formular correct (expression)?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 08:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/655321#M196628</guid>
      <dc:creator>HAHN1989</dc:creator>
      <dc:date>2020-06-09T08:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/655458#M196630</link>
      <description>&lt;P&gt;PROC MODEL is part of SAS/ETS, which I haven't licensed and never used. But its documentation&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=etsug&amp;amp;docsetTarget=etsug_model_sect003.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank" rel="noopener"&gt;Nonlinear Regression Analysis&lt;/A&gt;&amp;nbsp;is consistent with the point I tried to make in my previous post: If there is a non-trivial functional relationship between a dependent variable &lt;FONT face="courier new,courier"&gt;y&lt;/FONT&gt; (here: &lt;FONT face="courier new,courier"&gt;salt_tons&lt;/FONT&gt;) and explanatory variables &lt;FONT face="courier new,courier"&gt;x&lt;SUB&gt;1&lt;/SUB&gt;&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;x&lt;SUB&gt;2&lt;/SUB&gt;&lt;/FONT&gt;, ... such as temperature in your case, the right side of the (mathematical) model equation must contain &lt;EM&gt;both&lt;/EM&gt; the explanatory variables (dummy variables in the case of categorical &lt;FONT face="courier new,courier"&gt;x&lt;SUB&gt;i&lt;/SUB&gt;&lt;/FONT&gt;)&amp;nbsp;&amp;nbsp;&lt;EM&gt;and&lt;/EM&gt; parameters to be estimated (like c in a linear regression model Y=cx+&lt;FONT face="symbol"&gt;e&lt;/FONT&gt;). You need to distinguish between these two. See also&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_nlin_gettingstarted01.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_blank" rel="noopener"&gt;Nonlinear or Linear Model&lt;/A&gt; in PROC NLIN documentation.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 10:34:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/655458#M196630</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2020-06-09T10:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fitting data to equation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/655592#M196689</link>
      <description>&lt;P&gt;It looks like you need a different model equation. Contrary to the syntax of linear model fitting procedures, the parameters in &lt;STRONG&gt;proc nlin&lt;/STRONG&gt; must be explicitly named and included in the model equation. You would need something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc nlin data=work1;
parms xa=0.3 xb=10 xc=0.1 xf=7 xg=18 x0=0;
model salt_tons= a*xa*(b*xb + c*xc + f*xf + g*xg) + a*x0;
ods output ParameterEstimates=select;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;where xa, xb, xc, xf, xg, and x0 are the unknown parameters and a, b, c, f, and g are your observed variables.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 16:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Fitting-data-to-equation/m-p/655592#M196689</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2020-06-09T16:47:48Z</dc:date>
    </item>
  </channel>
</rss>

