<?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: how to get the x-value which gives me 50% of area under a curve in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/how-to-get-the-x-value-which-gives-me-50-of-area-under-a-curve/m-p/418567#M66758</link>
    <description>&lt;P&gt;I use this &lt;A href="https://www.jmp.com/support/help/en/16.1/index.shtml#page/jmp/knotted-spline-effect-example.shtml" target="_self"&gt;example&lt;/A&gt; to illustrate one approach. I follow the instructions up to step 7. Then from the red triangle menu of the report, I choose "Save Columns" &amp;gt; "Prediction Formula". Now I get a new column, and the formula is the function of the curve. Copy the formula from the column.&lt;/P&gt;
&lt;P&gt;Now go to Scripting Index, and find "Integrate" function.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_1-1631762883318.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35852i2FE6BCA02301B5C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_1-1631762883318.png" alt="peng_liu_1-1631762883318.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now paste the formula and replace the highlighted part, get this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_2-1631762981590.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35853i981E93B8AA9A7454/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_2-1631762981590.png" alt="peng_liu_2-1631762981590.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now remove all the colon symbols, by replacing colon by empty string.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_3-1631763183428.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35854i8FCD7A8DDEBB9C46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_3-1631763183428.png" alt="peng_liu_3-1631763183428.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Also replace "x" by "age", my x variable name.&lt;/P&gt;
&lt;P&gt;Now decide where the upper limit of the integration (100%), say 80. And the result is 69.783 for 100%.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_5-1631763270010.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35856i9285E4DB7A646E5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_5-1631763270010.png" alt="peng_liu_5-1631763270010.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now the task is to find a number to replace 80, and give me 50%: 69.783/2=34.8915. I got 44.228 after maybe a dozen try and error.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_6-1631763432932.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35857iED72FE1B7223CAE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_6-1631763432932.png" alt="peng_liu_6-1631763432932.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It requires JSL programming, but not much, to get more precise result quickly. Mostly still copy and paste. See the following screenshot.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_9-1631764338721.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35860i35CEB26C3BD53D54/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_9-1631764338721.png" alt="peng_liu_9-1631764338721.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The key is to find the value that minimize the squared difference between integral and the target value 34.8919. So I wrap the difference between integral and the target inside of a square, then call minimize function. Check out the function documentation for the syntax. The result for 50% is 44.226900491921.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Sep 2021 03:52:29 GMT</pubDate>
    <dc:creator>peng_liu</dc:creator>
    <dc:date>2021-09-16T03:52:29Z</dc:date>
    <item>
      <title>how to get the x-value which gives me 50% of area under a curve</title>
      <link>https://community.jmp.com/t5/Discussions/how-to-get-the-x-value-which-gives-me-50-of-area-under-a-curve/m-p/418487#M66749</link>
      <description>&lt;P&gt;I have some continuous data and I fit a curve using "Fit Model" and used attributes "Knotted Spline Effect" and 50 knots. Then I save the prediction formula to the table. What I want to do next is to find the fragment size (x-value) which gives me 5%, 10%, 25%, 50%, 75%, 90% and 95% of area. I have 10 samples and so I have 10 very complicated equations.&lt;/P&gt;&lt;P&gt;How do I get the fragment size (x-value) with different area under the curve? I am not familiar with scripts so I prefer learning the mouse clicking way if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2021-09-15 161811.png" style="width: 414px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35837iAEE33E38FA310F7E/image-dimensions/414x636?v=v2" width="414" height="636" role="button" title="Screenshot 2021-09-15 161811.png" alt="Screenshot 2021-09-15 161811.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 00:38:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-to-get-the-x-value-which-gives-me-50-of-area-under-a-curve/m-p/418487#M66749</guid>
      <dc:creator>dtsang</dc:creator>
      <dc:date>2023-06-09T00:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: how to get the x-value which gives me 50% of area under a curve</title>
      <link>https://community.jmp.com/t5/Discussions/how-to-get-the-x-value-which-gives-me-50-of-area-under-a-curve/m-p/418567#M66758</link>
      <description>&lt;P&gt;I use this &lt;A href="https://www.jmp.com/support/help/en/16.1/index.shtml#page/jmp/knotted-spline-effect-example.shtml" target="_self"&gt;example&lt;/A&gt; to illustrate one approach. I follow the instructions up to step 7. Then from the red triangle menu of the report, I choose "Save Columns" &amp;gt; "Prediction Formula". Now I get a new column, and the formula is the function of the curve. Copy the formula from the column.&lt;/P&gt;
&lt;P&gt;Now go to Scripting Index, and find "Integrate" function.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_1-1631762883318.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35852i2FE6BCA02301B5C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_1-1631762883318.png" alt="peng_liu_1-1631762883318.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now paste the formula and replace the highlighted part, get this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_2-1631762981590.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35853i981E93B8AA9A7454/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_2-1631762981590.png" alt="peng_liu_2-1631762981590.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now remove all the colon symbols, by replacing colon by empty string.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_3-1631763183428.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35854i8FCD7A8DDEBB9C46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_3-1631763183428.png" alt="peng_liu_3-1631763183428.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Also replace "x" by "age", my x variable name.&lt;/P&gt;
&lt;P&gt;Now decide where the upper limit of the integration (100%), say 80. And the result is 69.783 for 100%.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_5-1631763270010.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35856i9285E4DB7A646E5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_5-1631763270010.png" alt="peng_liu_5-1631763270010.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Now the task is to find a number to replace 80, and give me 50%: 69.783/2=34.8915. I got 44.228 after maybe a dozen try and error.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_6-1631763432932.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35857iED72FE1B7223CAE5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_6-1631763432932.png" alt="peng_liu_6-1631763432932.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;It requires JSL programming, but not much, to get more precise result quickly. Mostly still copy and paste. See the following screenshot.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="peng_liu_9-1631764338721.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/35860i35CEB26C3BD53D54/image-size/medium?v=v2&amp;amp;px=400" role="button" title="peng_liu_9-1631764338721.png" alt="peng_liu_9-1631764338721.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The key is to find the value that minimize the squared difference between integral and the target value 34.8919. So I wrap the difference between integral and the target inside of a square, then call minimize function. Check out the function documentation for the syntax. The result for 50% is 44.226900491921.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 03:52:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/how-to-get-the-x-value-which-gives-me-50-of-area-under-a-curve/m-p/418567#M66758</guid>
      <dc:creator>peng_liu</dc:creator>
      <dc:date>2021-09-16T03:52:29Z</dc:date>
    </item>
  </channel>
</rss>

