<?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 Confidence intervals for difference in proportions in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Confidence-intervals-for-difference-in-proportions/m-p/905316#M106377</link>
    <description>&lt;P&gt;Hi All: I've attached an example data set to highlight an issue that confuses me.&amp;nbsp; Suppose I want a confidence interval for the difference in two proportions.&amp;nbsp; Should be easy enough. So, via Fit Y by X (JMP v18.0.0), I get three intervals under the following headings:&lt;/P&gt;
&lt;P&gt;Two Sample Test for Proportions.&lt;/P&gt;
&lt;P&gt;Risk Difference&lt;/P&gt;
&lt;P&gt;TOST Tests&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MRB3855_0-1759313531636.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/84051iDD1B6FFC4E8DDBC1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MRB3855_0-1759313531636.png" alt="MRB3855_0-1759313531636.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see, the intervals are not consistent with each other.&lt;/P&gt;
&lt;P&gt;My question(s) is this:&lt;/P&gt;
&lt;P&gt;1. Why are they not the same?&lt;/P&gt;
&lt;P&gt;2. What formulae is used for each?&lt;/P&gt;
&lt;P&gt;3. Am I missing something?&lt;/P&gt;
&lt;P&gt;I did find this for the Two Sample Proportions Report (could be more explicit IMHO).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/two-sample-test-for-proportions-report.shtml?os=win&amp;amp;source=application#ww194753" target="_blank"&gt;Two Sample Test for Proportions Report&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your learned consideration!&lt;/P&gt;</description>
    <pubDate>Wed, 01 Oct 2025 10:26:49 GMT</pubDate>
    <dc:creator>MRB3855</dc:creator>
    <dc:date>2025-10-01T10:26:49Z</dc:date>
    <item>
      <title>Confidence intervals for difference in proportions</title>
      <link>https://community.jmp.com/t5/Discussions/Confidence-intervals-for-difference-in-proportions/m-p/905316#M106377</link>
      <description>&lt;P&gt;Hi All: I've attached an example data set to highlight an issue that confuses me.&amp;nbsp; Suppose I want a confidence interval for the difference in two proportions.&amp;nbsp; Should be easy enough. So, via Fit Y by X (JMP v18.0.0), I get three intervals under the following headings:&lt;/P&gt;
&lt;P&gt;Two Sample Test for Proportions.&lt;/P&gt;
&lt;P&gt;Risk Difference&lt;/P&gt;
&lt;P&gt;TOST Tests&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MRB3855_0-1759313531636.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/84051iDD1B6FFC4E8DDBC1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MRB3855_0-1759313531636.png" alt="MRB3855_0-1759313531636.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see, the intervals are not consistent with each other.&lt;/P&gt;
&lt;P&gt;My question(s) is this:&lt;/P&gt;
&lt;P&gt;1. Why are they not the same?&lt;/P&gt;
&lt;P&gt;2. What formulae is used for each?&lt;/P&gt;
&lt;P&gt;3. Am I missing something?&lt;/P&gt;
&lt;P&gt;I did find this for the Two Sample Proportions Report (could be more explicit IMHO).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/two-sample-test-for-proportions-report.shtml?os=win&amp;amp;source=application#ww194753" target="_blank"&gt;Two Sample Test for Proportions Report&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your learned consideration!&lt;/P&gt;</description>
      <pubDate>Wed, 01 Oct 2025 10:26:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Confidence-intervals-for-difference-in-proportions/m-p/905316#M106377</guid>
      <dc:creator>MRB3855</dc:creator>
      <dc:date>2025-10-01T10:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Confidence intervals for difference in proportions</title>
      <link>https://community.jmp.com/t5/Discussions/Confidence-intervals-for-difference-in-proportions/m-p/908041#M106634</link>
      <description>&lt;P&gt;FYI, I queried tech support and received the following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The three tests use slightly different methods, which results in the difference you are observing in the confidence intervals.&amp;nbsp; The methods are all described in the SAS documentation here:&amp;nbsp;&amp;nbsp;&lt;A href="https://urldefense.com/v3/__https:/go.documentation.sas.com/doc/en/statcdc/14.2/statug/statug_freq_details53.htm*statug.freq.freqrdiffcl__;Iw!!MBaoSxY!4AG7O0UAvfx2mR4FQAOVeJ23_0WTRII6E_vmtDpkwgAe88EPOhQISYVx1uhCOPYwuWyBPwtPzZX4Uped$" target="_blank"&gt;https://go.documentation.sas.com/doc/en/statcdc/14.2/statug/statug_freq_details53.htm#statug.freq.freqrdiffcl&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;1. For the Two Sample Test for Proportions JMP is using the Agresti-Caffo limit: Script follows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x1 = 19; n1 = 20;
x2 = 18; n2 = 20;

/* proportion difference */
diff = x1/n1 - x2/n2;

/* Calculation for CI for Two Sample Test for Proportion */
p1 = (x1+1)/(n1+2);
p2 = (x2+1)/(n2+2);
pdiff= p1 - p2;
lower = pdiff - normalquantile(.95)*sqrt(p1*(1-p1)/(n1+2)+p2*(1-p2)/(n2+2));
upper = pdiff + normalquantile(.95)*sqrt(p1*(1-p1)/(n1+2)+p2*(1-p2)/(n2+2));

show(lower, upper);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. The Confidence interval for Risk Difference uses the Wald interval: Script follows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/* Calculation for CI for Risk Difference */
p1 = (x1)/(n1);
p2 = (x2)/(n2);
diff = x1/n1 - x2/n2;
lower = diff - normalquantile(.95)*sqrt(p1*(1-p1)/(n1)+p2*(1-p2)/(n2));
upper = diff + normalquantile(.95)*sqrt(p1*(1-p1)/(n1)+p2*(1-p2)/(n2));

show(lower, upper);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. The confidence limits for the risk difference in equivalence test uses the Miettinen-Nurminen (score) confidence limits: Script follows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;/*  Calculation for CI for Equivalence Test */

/* mnStdEquivDiff is a function to calculate the standard deviation of se(p1-p2) */

mnStdEquivDiff=Function({n11, n21, n1, n2, n, margin },
{default local},

p1_hat=n11/n1;
p2_hat=n21/n2;

theta=n2/n1;

d=-p1_hat*margin*(1+margin);
c=margin^2+margin*(2*p1_hat+theta+1) + p1_hat + theta*p2_hat;
b=-(1+theta+p1_hat + theta*p2_hat + margin*(theta+2));
a=1+theta;

v=b^3/(3*a)^3-b*c/(6*a^2) + d/(2*a);
if(v&amp;gt;0, sign=1, sign=-1);

u=sign*root(b^2/(3*a)^2 -c/(3*a));
w=(pi()+ArcCosine(v/u^3))/3;

p1_tlt=2*u*cosine(w)-b/(3*a);
p2_tlt =p1_tlt -margin;

var1=p1_tlt*(1-p1_tlt)/n1;
var2=p2_tlt*(1-p2_tlt)/n2;

correct=n/(n-1);
correct=1;

std_diff=root(correct*(var1+var2));
std_diff;
);


/* Calculation using the example data */
n11=19;
n21=18;

n1=20;
n2=20;
n=40;
alpha=0.05;

p1=n11/n1;
p2=n21/n2;
diff=p1-p2;
show(diff);

maxit=100;
conv = .00000001;

z=ChiSquare Quantile( 0.9, 1 );
pdiff = diff; 
correct=1;

//calculate the lower confidence limit
inc=1+diff;
converged = 0;
for (i = 0, i &amp;lt; maxit, i++, 
	inc *= 0.5;
	lcl = pdiff - inc;
	var = mnStdEquivDiff(n11, n21, n1, n2, n, lcl); 
	var = var * var;
	var *= correct;

	d = diff - lcl;
	
	if( var &amp;gt; 0, score=(d * d) / var,  score=. );
	
	if (score &amp;lt; z, pdiff = lcl);

	if ((inc &amp;lt; conv) | abs(z - score) &amp;lt; conv,  
		converged = 1;
		break();
	);
);

if ((i == maxit) &amp;amp; converged==0, lcl = MACMISSING);


//calculate the upper confidence limit
inc=1-diff;
converged = 0;
for (i = 0, i &amp;lt; maxit, i++, 
	inc *= 0.5;
	ucl = pdiff + inc;
	var = mnStdEquivDiff(n11, n21, n1, n2, n, ucl); 
	var = var * var;
	var *= correct;

	d = diff - ucl;
	
	if( var &amp;gt; 0, score=(d * d) / var,  score=. );
	
	if (score &amp;lt; z, pdiff = ucl);

	if (   (inc &amp;lt; conv) | abs(z - score) &amp;lt; conv,  
		converged = 1;
		break();
	);
);

if ((i == maxit) &amp;amp; converged==0, ucl = MACMISSING);

show(lcl, ucl);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;They also said they would: "open two requests with the development team. One for the documentation team, to add the references (and statistical details) for each of the different methods. For the other I will add a feature request to the development team to allow user to choose the desired method."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As usual, tech support is very helpful, thorough, and professional.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2025 14:01:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Confidence-intervals-for-difference-in-proportions/m-p/908041#M106634</guid>
      <dc:creator>MRB3855</dc:creator>
      <dc:date>2025-10-16T14:01:03Z</dc:date>
    </item>
  </channel>
</rss>

