<?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: is there a way to find the area common to two different normal distribution curve using JMP? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/212463#M42536</link>
    <description>&lt;P&gt;Can anyone help problem solve this script. My JSL is simply not good enough to understand what is going wrong when we use a real data set and the chart scales incorrectly and doesn't display / calculate OVL?&lt;BR /&gt;&lt;BR /&gt;example data:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;mean1 = 46.17&lt;/TD&gt;&lt;TD&gt;std1 = 16.27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;mean2 = 82.08&lt;/TD&gt;&lt;TD&gt;std2 = 17.68&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Errors observed&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using the above data OVL isn't displayed / calculated (I'm not sure which is true)&lt;/LI&gt;&lt;LI&gt;The axes are set to the wrong scale&amp;nbsp; (an auto function would help)&lt;/LI&gt;&lt;LI&gt;When scales are adjusted in code or using hand tool we see the PDF curves but no shaded area&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Mon, 10 Jun 2019 07:21:46 GMT</pubDate>
    <dc:creator>alxh</dc:creator>
    <dc:date>2019-06-10T07:21:46Z</dc:date>
    <item>
      <title>is there a way to find the area common to two different normal distribution curve using JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/20621#M18746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to find the area under the common portion of two different normal distribution curve. How can I do that using JMP? Any simple way to do so?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 17:25:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/20621#M18746</guid>
      <dc:creator>gupta_gyanesh_y</dc:creator>
      <dc:date>2016-09-23T17:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to find the area common to two different normal distribution curve using JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/20622#M18747</link>
      <description>&lt;P&gt;In JMP 12 there is an quite efficient Integrate() function that can be used for calculating the area confined by the minimum of the two curves.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The example below is not very useful (you'd probably want to get the parameters from the distribution platform) but may give you some ideas...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier; color: #032ce4;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
// Define curves and calculate overlap area
N1 = Expr(Normal Density(x, 1, 2));
N2 = Expr(Normal Density(x, 0, 1));
ovl = Integrate(Min(N1, N2), x, ., .);
Show(ovl);


//––––––––––
// Illustration
ym = xm = (-500 :: 500) / 100;
For(i = 1, i &amp;lt;= N Col(xm), i++,
&amp;nbsp;&amp;nbsp;&amp;nbsp; ym[i] = Min(Normal Density(xm[i], 1, 2), Normal Density(xm[i], 0, 1))
);
New Window("Overlap Coefficient",
&amp;nbsp;&amp;nbsp;&amp;nbsp; y = Graph Box(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y Scale(0, 1),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; X Scale(-5, 5),
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y Function(N1, x);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Y Function(N2, x);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Text({0, 0.6}, "OVL = ", ovl);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fill Color(1);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Polygon(xm, ym);
&amp;nbsp;&amp;nbsp;&amp;nbsp; )
);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;SPAN style="color: #011993;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;SPAN style="color: #011993;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="margin: 0px; font-size: 14px; line-height: normal; font-family: Courier;"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;IMG style="color: #575757; font-family: arial, helvetica, sans-serif; font-size: 10pt; float: left;" border="0" /&gt;&lt;IMG border="0" /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 13:13:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/20622#M18747</guid>
      <dc:creator>ms</dc:creator>
      <dc:date>2019-06-10T13:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to find the area common to two different normal distribution curve using JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/86379#M38500</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/182"&gt;@ms&lt;/a&gt;&amp;nbsp; Thanks for sharing this!&amp;nbsp; I checked this script against an example given on the following website thanks to a colleague of mine:&amp;nbsp;&lt;A href="https://stats.stackexchange.com/questions/103800/calculate-probability-area-under-the-overlapping-area-of-two-normal-distributi" target="_blank" rel="noopener"&gt;https://stats.stackexchange.com/questions/103800/calculate-probability-area-under-the-overlapping-area-of-two-normal-distributi&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With the mean and sigma parameters for the first and second distributions respectively:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"For your example, with&amp;nbsp;&lt;SPAN class="MathJax" style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: normal; font-stretch: inherit; line-height: normal; font-family: inherit; font-size: 15px; vertical-align: baseline; box-sizing: inherit; display: inline; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; position: relative;"&gt;&lt;SPAN class="math"&gt;&lt;SPAN class="mrow"&gt;&lt;SPAN class="texatom"&gt;&lt;SPAN class="msubsup"&gt;&lt;SPAN class="mi"&gt;μ&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;5.28&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;,&lt;/SPAN&gt;&lt;SPAN class="msubsup"&gt;&lt;SPAN class="mi"&gt;μ&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;8.45&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;,&lt;/SPAN&gt;&lt;SPAN class="msubsup"&gt;&lt;SPAN class="mi"&gt;σ&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;1&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;0.91&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;,&lt;/SPAN&gt;&lt;SPAN class="msubsup"&gt;&lt;SPAN class="mi"&gt;σ&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;2&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;1.36&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="MJX_Assistive_MathML"&gt;μ1=5.28,μ2=8.45,σ1=0.91,σ2=1.36&lt;/SPAN&gt;&lt;/SPAN&gt;, this yields:&amp;nbsp;&lt;SPAN class="MathJax" style="margin: 0px; padding: 0px; border: 0px; font-variant: inherit; font-weight: normal; font-stretch: inherit; line-height: normal; font-family: inherit; font-size: 15px; vertical-align: baseline; box-sizing: inherit; display: inline; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; position: relative;"&gt;&lt;SPAN class="math"&gt;&lt;SPAN class="mrow"&gt;&lt;SPAN class="mi"&gt;c&lt;/SPAN&gt;&lt;SPAN class="mo"&gt;=&lt;/SPAN&gt;&lt;SPAN class="mn"&gt;6.70458...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="MJX_Assistive_MathML"&gt;c=6.70458...&lt;/SPAN&gt;&lt;/SPAN&gt;, and the area of the green section is: 0.158413"&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The .JSL script gives the exact same result for the area of the overlapped section!&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

// Define curves and calculate overlap area

mean1 =  5.28;
stdev1 = 0.91;

mean2  = 8.45; 
stdev2 = 1.36; 

N1 = Expr(Normal Density(x, mean1, stdev1));

N2 = Expr(Normal Density(x, mean2, stdev2));

ovl = Integrate(Min(N1, N2), x, ., .);

Show(ovl);

//––––––––––

// Illustration

ym = xm = (-1000 :: 1000) / 100;

For(i = 1, i &amp;lt;= N Col(xm), i++,

    ym[i] = Min(Normal Density(xm[i], mean1, stdev1), Normal Density(xm[i], mean2, stdev2))

);

New Window("Overlap Coefficient",

    y = Graph Box(

        Y Scale(0, 1),

        X Scale(-5, 12),

        Y Function(N1, x);

        Y Function(N2, x);

        Text({0, 0.6}, "OVL% = ", ovl*100);

        Fill Color(1);

        Polygon(xm, ym);

    )

);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="overlap percent  = 15.84%.png" style="width: 388px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/17676i6354829D779DD2C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="overlap percent  = 15.84%.png" alt="overlap percent  = 15.84%.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 14:57:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/86379#M38500</guid>
      <dc:creator>PatrickGiuliano</dc:creator>
      <dc:date>2019-06-10T14:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to find the area common to two different normal distribution curve using JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/86383#M38503</link>
      <description>&lt;P&gt;The graph from JMP (thanks&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/182"&gt;@ms&lt;/a&gt;) . Nice to know there is also an analytical solution.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="overlap" style="width: 392px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/14917i67E6A66CAA734241/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="overlap" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;overlap&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Dec 2018 13:23:07 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/86383#M38503</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2018-12-22T13:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to find the area common to two different normal distribution curve using JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/212463#M42536</link>
      <description>&lt;P&gt;Can anyone help problem solve this script. My JSL is simply not good enough to understand what is going wrong when we use a real data set and the chart scales incorrectly and doesn't display / calculate OVL?&lt;BR /&gt;&lt;BR /&gt;example data:&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;mean1 = 46.17&lt;/TD&gt;&lt;TD&gt;std1 = 16.27&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;mean2 = 82.08&lt;/TD&gt;&lt;TD&gt;std2 = 17.68&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Errors observed&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using the above data OVL isn't displayed / calculated (I'm not sure which is true)&lt;/LI&gt;&lt;LI&gt;The axes are set to the wrong scale&amp;nbsp; (an auto function would help)&lt;/LI&gt;&lt;LI&gt;When scales are adjusted in code or using hand tool we see the PDF curves but no shaded area&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 10 Jun 2019 07:21:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/212463#M42536</guid>
      <dc:creator>alxh</dc:creator>
      <dc:date>2019-06-10T07:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: is there a way to find the area common to two different normal distribution curve using JMP?</title>
      <link>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/212478#M42541</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The graph range was hard-coded means in the single digits rather than in the double digits, so the plot was "off-the-page" so to speak. I added code to calculate appropriate axes for the graph so the curves show up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also had trouble with the Integrate() function used here, and settled instead for Riemann sums under the polygon. It will be reasonably accurate this way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default to Here( 1 );

// Define curves and calculate overlap area

mean1 =  46.17;
stdev1 = 16.27;

mean2  = 82.08; 
stdev2 = 17.68; 
&lt;BR /&gt;N1 = Expr(Normal Density(x, mean1, stdev1));&lt;BR /&gt;N2 = Expr(Normal Density(x, mean2, stdev2));

//––––––––––

// calculate graph ranges

rangemin = Minimum(mean1-6*stdev1,mean2-6*stdev2);
rangemax = Maximum(mean1+6*stdev1,mean2+6*stdev2);

// Illustration

ym = zm = 1 :: 2000;  // 2000 has to do with how detailed the plot should be
multiplier = (rangemax-rangemin)/(Maximum(ym)-Minimum(ym));
xm = (ym-Minimum(ym))*multiplier+rangemin;

ovl = 0;

For(i = 1, i &amp;lt;= N Col(xm), i++,

    ym[i] = Minimum(Normal Density(xm[i], mean1, stdev1), Normal Density(xm[i], mean2, stdev2));
    zm[i] = Maximum(Normal Density(xm[i], mean1, stdev1), Normal Density(xm[i], mean2, stdev2));
    If(i&amp;gt;1, ovl += 0.5*(ym[i-1]+ym[i])*(xm[i]-xm[i-1]));

);

New Window("Overlap Coefficient",

    y = Graph Box(

        Y Scale(0, 1.2*Maximum(zm)),

        X Scale(rangemin, rangemax),

        Y Function(N1, x);

        Y Function(N2, x);

        Text({Mean(xm), 0.6*Maximum(zm)}, "OVL% = ", ovl*100);

        Fill Color(1);

        Polygon(xm, ym);

    )

);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 10 Jun 2019 12:39:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/is-there-a-way-to-find-the-area-common-to-two-different-normal/m-p/212478#M42541</guid>
      <dc:creator>mjoner</dc:creator>
      <dc:date>2019-06-10T12:39:59Z</dc:date>
    </item>
  </channel>
</rss>

