<?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: Get value x given mspline(x) value from transreg in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/435255#M22955</link>
    <description>It was a great pleasure to have this discussion with the author of transreg! Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;!&lt;BR /&gt;&lt;BR /&gt;Thanks for confirming that I cannot get Y from PTY. Also what you recommended is what I am doing now. However, it triggers more questions:&lt;BR /&gt;1. I did a manual piece wise linear regression line between PTY and Y and get predicted Y. Then I compared with the results with results generated from the regression without spline transformation in terms of average residual. What I found, very surprisingly, transreg prodcued much higher R square on transformed predicted value, but also much much higher average residual on untransforned predicted value. What does this tell you?&lt;BR /&gt;&lt;BR /&gt;2. I try to understand how transreg works on a high level. Suppose now my transreg looks like is spline(y) = spline(x1) spline(x1). Translated to words, does it say that transreg will do transformation on X1 X2 and Y and then do linear regression on the three transformed value? If that is the case, does spline(x1) transform X1 based on Y? How about spline(Y)?&lt;BR /&gt;&lt;BR /&gt;Sorry for all my questions! Just want to get a more clear picture of Transreg and want to use it correctly.&lt;BR /&gt;&lt;BR /&gt;-Shelly</description>
    <pubDate>Thu, 08 Feb 2018 13:57:46 GMT</pubDate>
    <dc:creator>NaNaN</dc:creator>
    <dc:date>2018-02-08T13:57:46Z</dc:date>
    <item>
      <title>Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434348#M22895</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran the following code to generate the non-linear regression fit. Does anyone know how to get predicted Y based on predicted transformed Y?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods graphics on;&lt;BR /&gt;ods output details=d;&lt;BR /&gt;proc transreg data=edaniat.fee_t solve details ss2 short nomiss plots=all;&lt;BR /&gt;ods output splinecoef=c;&lt;BR /&gt;model mspline(Y / nknots=9) = mspline(x1 / nknots=9)&lt;BR /&gt;mspline(x2/ nknots=9) spline(x3/ nknots=9) mspline(x4/ nknots=9);&lt;BR /&gt;output out=y PREDICTED;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any inputs are welcome!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 19:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434348#M22895</guid>
      <dc:creator>NaNaN</dc:creator>
      <dc:date>2018-02-05T19:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434349#M22896</link>
      <description>&lt;P&gt;Include the point in your original data, with a missing dependent variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use the PREDICTED option to get the predicted value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=14.3&amp;amp;docsetTarget=statug_transreg_syntax21.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?docsetId=statug&amp;amp;docsetVersion=14.3&amp;amp;docsetTarget=statug_transreg_syntax21.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This blog post covers the methods for scoring data:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and specifically this one is the method I'm suggesting.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2014/02/17/the-missing-value-trick-for-scoring-a-regression-model.html&lt;/A&gt;&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/191558"&gt;@NaNaN&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran the following code to generate the non-linear regression fit. Does anyone know how to get predicted Y based on predicted transformed Y?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods graphics on;&lt;BR /&gt;ods output details=d;&lt;BR /&gt;proc transreg data=edaniat.fee_t solve details ss2 short nomiss plots=all;&lt;BR /&gt;ods output splinecoef=c;&lt;BR /&gt;model mspline(Y / nknots=9) = mspline(x1 / nknots=9)&lt;BR /&gt;mspline(x2/ nknots=9) spline(x3/ nknots=9) mspline(x4/ nknots=9);&lt;BR /&gt;output out=y PREDICTED;&lt;BR /&gt;run;&lt;BR /&gt;ods graphics off;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any inputs are welcome!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 19:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434349#M22896</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-05T19:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434361#M22897</link>
      <description>&lt;P&gt;Thanks, Reeza!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Still not clear to me how to get predicted Y value from predicted transformed Y value. In my code, I output the result to dataset Y, which contains Ty, which is transformed Y value by mspline(Y). How do I get Y based on Ty?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is no "code" option for proc transreg.&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 20:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434361#M22897</guid>
      <dc:creator>NaNaN</dc:creator>
      <dc:date>2018-02-05T20:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434538#M22907</link>
      <description>&lt;P&gt;I wrote transreg, but I am not sure what you want.&amp;nbsp; You can apply the coefficients from the model to the transformed Xs and you get predicted values for the transformed Y.&amp;nbsp; You can transform the Xs and not transform Y and get predicted values for Y.&amp;nbsp;You already know all that. The only other thing I can think of is you can fit a second regression model given the transformed Xs from the model that transforms the Xs and Y and then find the predicted values for Y from a regression model that uses the transformed Xs.&amp;nbsp; Is that what you want?&amp;nbsp; If so, why? If that is what you want, you can do it in two steps.&amp;nbsp; If that is not what you want, then I need more explanation.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 14:28:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434538#M22907</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2018-02-06T14:28:40Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434595#M22909</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;, for your comments. Here is what I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the TRANSREG, I transformed the target attribute&amp;nbsp;&lt;SPAN&gt;Y by using mspline(Y / nknots=9). I dumped the output to a data set and over there I can find predicted transformed Y (PTY). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example. if Y=10 and TY=mspline(Y)=30, the TRANSREG returns the predicted transformed Y PTY=35. I want to figure out the predicted value of Y. Also I believe the R square in TRANSREG is calculated on TY (transformed Y) and PY (predicted transformed Y)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please let me know if I am not still clear enough.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-Shelly&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 17:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434595#M22909</guid>
      <dc:creator>NaNaN</dc:creator>
      <dc:date>2018-02-06T17:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434654#M22916</link>
      <description>&lt;P&gt;Sorry.&amp;nbsp; I wrote this code decades ago, and I don't hear much about how people use it.&amp;nbsp; At the end of the processing, there is a model based on the transformation of Y and the transformations of the Xs.&amp;nbsp; Transreg has knowledge of the degrees of freedom involved in the transformations and produces statistical tests based on them.&amp;nbsp; It will plot transformations that use the original variables and do lots of other stuff.&amp;nbsp; But, at the end of the iterations, in the statistical calculations, it knows nothing about Y.&amp;nbsp; It only knows about TY.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So there is nothing in Transreg that does what you want.&amp;nbsp; The only thing I can think of is you can look at the graph of the transformation of Y.&amp;nbsp; If it looks like some functional form (say quadratic or square root), then you can try a new model that uses that transformation instead.&amp;nbsp; If that works reasonably well, then you can develop a formula that maps values from Y to TY and back to Y.&amp;nbsp; Then you could apply that formula to predicted values (as long as it is mathematically valid, e.g. no logs of negative numbers).&amp;nbsp; I cannot speak to the statistical properties of such an approach.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe there is a user out there who has done what you want who can help more than me.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 18:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/434654#M22916</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2018-02-06T18:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/435255#M22955</link>
      <description>It was a great pleasure to have this discussion with the author of transreg! Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16777"&gt;@WarrenKuhfeld&lt;/a&gt;!&lt;BR /&gt;&lt;BR /&gt;Thanks for confirming that I cannot get Y from PTY. Also what you recommended is what I am doing now. However, it triggers more questions:&lt;BR /&gt;1. I did a manual piece wise linear regression line between PTY and Y and get predicted Y. Then I compared with the results with results generated from the regression without spline transformation in terms of average residual. What I found, very surprisingly, transreg prodcued much higher R square on transformed predicted value, but also much much higher average residual on untransforned predicted value. What does this tell you?&lt;BR /&gt;&lt;BR /&gt;2. I try to understand how transreg works on a high level. Suppose now my transreg looks like is spline(y) = spline(x1) spline(x1). Translated to words, does it say that transreg will do transformation on X1 X2 and Y and then do linear regression on the three transformed value? If that is the case, does spline(x1) transform X1 based on Y? How about spline(Y)?&lt;BR /&gt;&lt;BR /&gt;Sorry for all my questions! Just want to get a more clear picture of Transreg and want to use it correctly.&lt;BR /&gt;&lt;BR /&gt;-Shelly</description>
      <pubDate>Thu, 08 Feb 2018 13:57:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/435255#M22955</guid>
      <dc:creator>NaNaN</dc:creator>
      <dc:date>2018-02-08T13:57:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get value x given mspline(x) value from transreg</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/435270#M22956</link>
      <description>&lt;P&gt;Thanks for the kind words, Shelly!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A key component of an alternating least-squares algorithm like the one in Transreg is scaling.&amp;nbsp; At every step, it needs to recscale each variable to maintain a constant mean and variance.&amp;nbsp; Transreg does try to maximize R square. So if you use it to suggest alternative models involving logs, square roots, polynomials, and so on, the original Transreg R square will be higher (unless you deliberately construct something weird).&amp;nbsp; Residuals depend on the scale of the variable.&amp;nbsp; You need to ensure everything is on the same scale (mean and variance) before comparing residuals.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a model like spline(y) = spline(x1) spline(x2), the transformation of each variable does in fact depend on every other variable, and in the end, Transreg fits a regression model using the three transformed variables.&amp;nbsp; For many models (excluding monotone, untie, mspline, pbspline, and some others), Transreg can directly solve for a solution without iterating.&amp;nbsp; That would be the case when all variables come from spline, opscore, class, linear, identity, etc.&amp;nbsp; If you specify the SOLVE option, Transreg will fit a canonical correlation model using a B-spline basis for Y on one side and B-spline bases for X1 and X2 on the other.&amp;nbsp; Then the canonical coefficients for the first canonical variable can be used to directly find the optimal transformations.&amp;nbsp; I don't know if you find that helpful or not, but it is another way of saying that Transreg is trying to find linear combinations of basis functions that optimize R-square, and yes, depend on all the variables.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best,&lt;/P&gt;
&lt;P&gt;Warren&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 14:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Get-value-x-given-mspline-x-value-from-transreg/m-p/435270#M22956</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2018-02-08T14:38:24Z</dc:date>
    </item>
  </channel>
</rss>

