<?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: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750092#M93070</link>
    <description>&lt;P&gt;Maybe the&lt;/P&gt;
&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;NormalContour = sqrt(ChiSquare Quantile( 0.95, 2 ));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;idea from &lt;LI-MESSAGE title="Ellipse" uid="21242" url="https://community.jmp.com/t5/Uncharted/Ellipse/m-p/21242#U21242" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; will point you in the right direction. I do pictures, not statistics, so I might be way off. But to make the ellipse picture I had to answer a similar question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2024 11:08:40 GMT</pubDate>
    <dc:creator>Craige_Hales</dc:creator>
    <dc:date>2024-04-26T11:08:40Z</dc:date>
    <item>
      <title>Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/749701#M93015</link>
      <description>&lt;P&gt;Apologies for the transgression, which is; ironically; a direct result of my personal progress in JSL.&lt;/P&gt;&lt;P&gt;A very helpful computer scientist in my organization is trying to translate something initially written in JSL to Python. Specifically, the challenge is how to reproduce what the JSL function '&lt;FONT face="book antiqua,palatino"&gt;Vec Quadratic()&lt;/FONT&gt;' is doing? See also the attached example table .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Background&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;The JSL application to be translated creates formula columns for the confidence and prediction intervals. The formulas are then used to calculate the values of the confidence and prediction intervals for some user specified value of &lt;EM&gt;x&lt;/EM&gt;, aka independent variable.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Questions&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is numpy.polyfit (&lt;A href="https://numpy.org/doc/stable/reference/generated/numpy.polyfit.html" target="_blank" rel="noopener"&gt;https://numpy.org/doc/stable/reference/generated/numpy.polyfit.html&lt;/A&gt;) the right choice for this?&lt;/LI&gt;&lt;LI&gt;If it is, anyone who knows how to use numpy.polyfit to reproduce the results for Lower &amp;amp; Upper 95% Mean &amp;amp; Indiv columns in the attached table or can point us into the right direction?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Screenshots for orientation&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;What we want to achieve in Python (results inside the red frame)&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ressel_1-1714051995324.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/63685iEBF2AE679E031595/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ressel_1-1714051995324.png" alt="Ressel_1-1714051995324.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;How the columns shown above were generated&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ressel_2-1714052092940.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/63686i43EDE1B8073EF29C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ressel_2-1714052092940.png" alt="Ressel_2-1714052092940.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 13:41:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/749701#M93015</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-25T13:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/749722#M93018</link>
      <description>&lt;P&gt;Have you ask the Python community about this.&amp;nbsp; Personally, it seems counter productive to the JMP Community to put effort into assisting in moving someone away from JMP.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 14:00:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/749722#M93018</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-04-25T14:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/749930#M93045</link>
      <description>&lt;P&gt;True on the one hand. On the other hand, though, Python is integrated into JMP18, which suggests there must be people getting to terms with this reality. I was hoping for someone in the community being able to explain, since I consider it infinitely more likely that a JSL user would know the Python equivalent of '&lt;FONT face="times new roman,times"&gt;&lt;SPAN&gt;Vec Quadratic()&lt;/SPAN&gt;&lt;/FONT&gt;', rather than vice versa. (And what will the Python community tell me when I ask them?)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 19:10:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/749930#M93045</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-25T19:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750003#M93054</link>
      <description>&lt;P&gt;While the jmp.DataTable object will enable some user's an easier path to export JMP data, the improved Python integration is focused on benefiting the JMP user. &amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;It provides an environment that users new to JMP, but familiar with Python can be productive immediately.&lt;/LI&gt;
&lt;LI&gt;The design of the Python integration focuses on improving JMP's capability at being the hub of the workflow. At reducing the need to leave JMP to get the job done. The hope / desire is that the JMP environment becomes more convenient, more enticing, that work will be brought into JMP rather than exported away from JMP. &amp;nbsp;That JMP / Python integration becomes greater than simply the aggregation of JMP and Python. &amp;nbsp;For example:
&lt;UL&gt;
&lt;LI&gt;File formats not yet supported by JMP can be opened using external Python packages, parquet, hdf5, ...&lt;/LI&gt;
&lt;LI&gt;Allow JMP users to utilize desktop GPUs through packages such as pyopencl, and pyCUDA.&lt;/LI&gt;
&lt;LI&gt;Additional statistical capabilities such as hierarchical density clustering (HDBSCAN)&lt;/LI&gt;
&lt;LI&gt;Additional plotting and graphing capabilities with packages such as matplotlib, plotly, ...&lt;/LI&gt;
&lt;LI&gt;Integration with other software systems through the Python interface. &amp;nbsp;SAS, MatLab, R, ...&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;The JMP statisticians and testers put a lot of effort into creating code that is reliable, accurate and well tested. &amp;nbsp;That is the value proposition. &amp;nbsp;We focus on the statistics so you can focus on your application, rather than having to reinvent the statistical 'wheel'. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 00:11:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750003#M93054</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2024-04-26T00:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750065#M93067</link>
      <description>&lt;P&gt;I don't doubt that JMP statisticians put a lot of effort into creating reliable code. What I doubt is the expectation to keep this forum free from Python related questions.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 08:44:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750065#M93067</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-26T08:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750092#M93070</link>
      <description>&lt;P&gt;Maybe the&lt;/P&gt;
&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;NormalContour = sqrt(ChiSquare Quantile( 0.95, 2 ));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;idea from &lt;LI-MESSAGE title="Ellipse" uid="21242" url="https://community.jmp.com/t5/Uncharted/Ellipse/m-p/21242#U21242" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp; will point you in the right direction. I do pictures, not statistics, so I might be way off. But to make the ellipse picture I had to answer a similar question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 11:08:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750092#M93070</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2024-04-26T11:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750179#M93078</link>
      <description>&lt;P&gt;Thanks, that's very kind! It is possible we found a solution:&amp;nbsp;&lt;A href="https://numpy.org/doc/stable/reference/generated/numpy.cov.html" target="_blank" rel="noopener"&gt;https://numpy.org/doc/stable/reference/generated/numpy.cov.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: The title of this posting is misleading. numpy.polyfit is probably no suitable for emulating&amp;nbsp;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;FONT face="book antiqua,palatino"&gt;Vec Quadratic()&lt;/FONT&gt;&lt;SPAN&gt;'.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 13:56:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750179#M93078</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-26T13:56:37Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750201#M93084</link>
      <description>&lt;P&gt;We welcome Python questions in the JMP blogs. &amp;nbsp;I have been answering a lot of them lately. &amp;nbsp;Including sample code, and discussions on how best to use Python in JMP to its best advantage. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2687"&gt;@txnelson&lt;/a&gt;&amp;nbsp;comment on asking the Python community is a valid one, as would asking statistical blogs. &amp;nbsp;Though instead of asking how to replicate JSL's 'Vec Quadratic()' you phrase it in terms of asking how to graph the results you want, how to do the statistics you want in Python.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for answering this specific ask, I can't help you. &amp;nbsp;I have no knowledge of how 'Vec Quadratic()' works internally. &amp;nbsp;But I can tell you what the Scripting Index says. &amp;nbsp;The scripting index definition of Vec Quadratic( S, X ) states it evaluates as Vec Diag ( X * S * X ). &amp;nbsp;Vec Diag( X ) description in the Scripting index is Returns the diagonal elements of the square matrix as a vector. Unless I'm missing something that appears to be straightforward matrix math. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for how do I call 'Vec Quadriatic()' from my Python program running in JMP so I can further process the results... That is the kind of question that would be interesting. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use a numpy array for S and X and you can do the Python Get(S), Python Get(X) to get the numpy array values into JSL environment as a JSL Matrix. And you can call jmp.run_jsl( 'Vec Quadratic( S, X)' ). &amp;nbsp; &amp;nbsp;Then from Python in JMP you can get the column results directly from the data table in Python. &amp;nbsp;See the Scripting Index on jmp.DataTable and jmp.DataTable.Column objects.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Derived from the JSL "Vec Quadratic()' example in the Scripting Index.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import jmp
import numpy as np

s = np.array( [[1,3,5],[3,2,6], [5,6,1] ])
x = np.array( [[1,3,5],[2,4,6] ])
jmp.run_jsl('''
S = Python Get(s);
X = Python Get(x);
show(Vec Quadratic(S, X));
''')&lt;/LI-CODE&gt;
&lt;P&gt;giving results&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*:

//:*/

S = Python Get(s);
X = Python Get(x);
show(Vec Quadratic(S, X));

/*:

Vec Quadratic(S, X) = [292, 528];&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 14:17:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750201#M93084</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2024-04-26T14:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750291#M93096</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7172"&gt;@Paul_Nelson&lt;/a&gt;, thank you. I already knew what the JSL function 'Vec Quadratic()' did before posting. Apologies for inadequately phrasing my question in this post. Not everyone is this forum is an English native speaker. And just for completeness:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your comment:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;Though instead of asking how to replicate JSL's 'Vec Quadratic()'&amp;nbsp; ...&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;My original question:&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;How to use numpy.polyfit to reproduce Vec Quadratic() results?&lt;/SPAN&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;Is it the use of "reproduce" that is offensive?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 17:32:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750291#M93096</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-26T17:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750296#M93097</link>
      <description>&lt;P&gt;if you ask Copilot:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hogi_0-1714153432076.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/63748i34ABD2B095C50D34/image-size/medium?v=v2&amp;amp;px=400" role="button" title="hogi_0-1714153432076.png" alt="hogi_0-1714153432076.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 17:44:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750296#M93097</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-04-26T17:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750297#M93098</link>
      <description>&lt;P&gt;... you notice that it has some issues with matrix manipulations :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after adjusting the brackets, you get:&lt;/P&gt;&lt;PRE&gt;import numpy as np

s = np.array( [[1.,3.,5.],[3.,2.,6.], [5.,6.,1.] ])
x = np.array( [[1.,3.,5.],[2.,4.,6.] ])

res= x @ (s @ x.T)
print(res)
print(res.diagonal())&lt;/PRE&gt;&lt;P&gt;... which fits to&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
exS = [1 3 5, 3 2 6, 5 6 1];
exX = [1 3 5, 2 4 6];

Print(r= exX * exS * exX`);

tmp=as list(r);
print(tmp[1][1],tmp[2][2])&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 17:48:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750297#M93098</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-04-26T17:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750298#M93099</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/15435"&gt;@Ressel&lt;/a&gt;&amp;nbsp; I think the confusing part of your request is that Vec Quadratic() is simply performing matrix math as described by the Scripting Index. &amp;nbsp;The results of Vec Quadratic() is simply the output of matrix operations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The formulas themselves, which give the 95% values, are generated by the Fit Y by X platform. 'Fit y By X' is also what is responsible for creating the plot. &amp;nbsp;So the question as I understand it, is more accurately; &lt;EM&gt;How do I do a Bivariate Fit of y By x with confidence levels in Python or numpy?&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the &lt;EM&gt;Vec Quadratic()&lt;/EM&gt; is the wrong focus since it didn't create the formula or the constants, it's just a mathematical operation in the generated formula.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 17:51:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750298#M93099</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2024-04-26T17:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750300#M93100</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7172"&gt;@Paul_Nelson&lt;/a&gt;, this is correct, which I only figured out later (and shamelessly exploited to accept my own answer as solution). With regards to this as well as the exact phrasing of the question, I honestly didn't have it in me. The more one learns ... Thank you very much for sharing &amp;amp; have a good weekend.&lt;BR /&gt;(P.s.: As a sophisticated, statistical software company you'd almost count on engineers without computational talent being part of the business model. For better or worse.)&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 19:09:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750300#M93100</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-26T19:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750303#M93101</link>
      <description>&lt;P&gt;I applaud the openness of Jmp for Python :)&lt;/img&gt;&lt;BR /&gt;As &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7172"&gt;@Paul_Nelson&lt;/a&gt;&amp;nbsp;&amp;nbsp;mentions - now with Jmp18, if a functionality is missing in JMP, every user can easily grab it from Python - with 2-3 lines of code. amazingly useful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On the other hand, some Wikipedia knowledge about matrix manipulation, DOEs, regression, neural networks, etc. is nothing to worry about being "stolen".&lt;/P&gt;&lt;P&gt;With the "functionality" coming from state-of-the-art, up-to-date Python packages, it will be the "soft skills", the absence of bugs, the intuitive interface, the superior &lt;STRONG&gt;user experience&lt;/STRONG&gt; that will speak for JMP and separate it from the competition:&lt;/P&gt;&lt;P&gt;&lt;LI-MESSAGE title="Re: Wish list - new Label: user experience" uid="746912" url="https://community.jmp.com/t5/Community-Wish-List/Wish-list-new-Label-user-experience/m-p/746912#U746912" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 18:49:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750303#M93101</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2024-04-26T18:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750305#M93102</link>
      <description>&lt;P&gt;Moreover, I think it's only natural that users getting into data analytical &amp;amp; automation work via JMP are unlikely to have a firm grasp of Python, or any other programing &amp;amp; scripting language for that matter. JMP is proactively trying to recruit this type of user and makes it (I think) easy to step into scripting in JSL. Once the user develops and learns, though, this can be expected to trigger the wish for additional knowledge, at least in some cases and after the initial barrier of understanding a few basic, computational concepts is overcome. Of course the first intuition for this kind of user will be to ask the community for help, especially after the advertised Python integration in JMP 18. Finally, the fact that a professional data scientist is tasked with copying what a lay statistician has developed in JMP for use in an actual business setting speaks for itself. Although, I might be getting it all wrong.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 19:05:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/750305#M93102</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-04-26T19:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Long shot: How to use numpy.polyfit to reproduce Vec Quadratic() results?</title>
      <link>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/760827#M93910</link>
      <description>&lt;P&gt;If anyone's interested, the below Python code looks like it will exactly reproduce what JMP is doing in terms of calculating the confidence interval around a regression. This code block can be pasted into a Jupyter notebook directly. Besides calculating the Y- coordinates of the confidence interval for every X in the linear regression it does also create a plot, calculates the regression coefficient, intercept, associated uncertainties and tabulates the results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Don't believe I wrote this myself, but still useful for learning.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt

# the data as array
x_coordinate = np.array([0, 1, 2, 3])
y_coordinate = np.array([0.0, 0.5, 1.2, 5.1])

# linear model
func = lambda x, a, b: a * x + b

# model fit
best_fit_ab, covar = curve_fit(func, x_coordinate, y_coordinate)
sigma_ab = np.sqrt(np.diagonal(covar))

# extract fitted parameters and uncertainties
a, b = best_fit_ab
a_err, b_err = sigma_ab
text_res = f"Best fit parameters:\na = {a:.10f} ± {a_err:.10f}\nb = {b:.10f} ± {b_err:.10f}"
print(text_res)

# calculate the standard error of the regression
residuals = y_coordinate - func(x_coordinate, a, b)
s_err = np.sqrt(np.sum(residuals**2) / (len(x_coordinate) - 2))

# define a function to calculate the confidence intervals
def predict_ci(x, func, popt, pcov, s_err, alpha=0.05): # adjust alpha here
    from scipy.stats import t
    df = len(x_coordinate) - 2
    t_val = t.ppf(1 - alpha / 2, df)  # t-value for the given confidence level and degrees of freedom
    y = func(x, *popt)
    ci = t_val * s_err * np.sqrt(1/len(x_coordinate) + (x - np.mean(x_coordinate))**2 / np.sum((x_coordinate - np.mean(x_coordinate))**2))
    return y - ci, y + ci

# generate points for high-resolution x-axis
hires_x = np.linspace(x_coordinate.min(), x_coordinate.max(), 100)

# calculate confidence intervals
ci_lower_orig, ci_upper_orig = predict_ci(x_coordinate, func, best_fit_ab, covar, s_err)

# tabulate the original data and confidence intervals
table_orig = np.column_stack((x_coordinate, y_coordinate, ci_lower_orig, ci_upper_orig))
print("\nTabulated values (original data):")
print("X Coordinate\tY Coordinate\t\tCI Lower\t\tCI Upper")
for row in table_orig:
    print(f"{row[0]:.2f}\t\t{row[1]:.10f}\t\t{row[2]:.10f}\t{row[3]:.10f}") # adjust decimals for tabulation

# plotting the data
plt.scatter(x_coordinate, y_coordinate, label='Data', color='blue')

# plotting the fitted model
plt.plot(hires_x, func(hires_x, *best_fit_ab), 'black', label='Fitted model')

# plotting the confidence intervals
ci_lower, ci_upper = predict_ci(hires_x, func, best_fit_ab, covar, s_err)
plt.fill_between(hires_x, ci_lower, ci_upper, color='black', alpha=0.15, label='Confidence interval')

# adding text with parameters
plt.text(x_coordinate.min() + 0.5, y_coordinate.max() - 0.5, text_res)

# customize plot
plt.xlabel('X Coordinate')
plt.ylabel('Y Coordinate')
plt.title('Y Coordinate vs. X Coordinate')
plt.legend()
plt.show()&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 18:51:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Long-shot-How-to-use-numpy-polyfit-to-reproduce-Vec-Quadratic/m-p/760827#M93910</guid>
      <dc:creator>Ressel</dc:creator>
      <dc:date>2024-05-23T18:51:22Z</dc:date>
    </item>
  </channel>
</rss>

