 Dataplot Vol 1 Vol 2

# BINOMIAL PROPORTION TEST

Name:
BINOMIAL PROPORTION TEST
Type:
Analysis Command
Purpose:
Perform a large sample hypothesis test for the equality of two binomial proportions.
Description:
Given a set of N1 observations in a variable X1 and a set of N2 observations in a variable X2, we can compute a normal approximation test that the two proportions are equal (or alternatively, that the difference of the two proportions is equal to 0). In the following, let p1 and p2 be the population proportion of successes for samples one and two, respectively.

The hypothesis test that the two binomial proportions are equal is

 H0: p1 = p2 Ha: p1 ≠ p2 Test Statistic: $$Z = \frac{\hat{p_1} - \hat{p_2}} {\sqrt{\hat{p}(1 - \hat{p})(1/n_1 + 1/n_2)}}$$ where $$\hat{p}$$ is the proportion of successes for the combined sample and $$\begin{array}{lcl} \hat{p} & = & \frac{n_1 \hat{p_1} + n_2 \hat{p_2}} {n_1 + n_2} \\ & = & \frac{X_1 + X_2}{n_1 + n_2} \end{array}$$ Significance Level: α Critical Region: For a two-tailed test $$Z > \Phi^{-1}(1 - \alpha/2)$$ $$Z < \Phi^{-1}(\alpha/2)$$ For a lower tailed test $$Z < \Phi^{-1}(\alpha)$$ For an upper tailed test $$Z > \Phi^{-1}(1 - \alpha)$$ Conclusion: Reject the null hypothesis if Z is in the critical region

Dataplot computes this test for a number of different significance levels.

Syntax 1:
BINOMIAL PROPORTION TEST <y1> <y2>
<SUBSET/EXCEPT/FOR qualification>
where <y1> is the first response variable;
<y2> is the second response variable;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.

This syntax is used for the case where you have raw data and want to perform a two-tailed test.

Syntax 2:
BINOMIAL PROPORTION LOWER TAILED TEST <y1> <y2>
<SUBSET/EXCEPT/FOR qualification>
where <y1> is the first response variable;
<y2> is the second response variable;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.

This syntax is used for the case where you have raw data and want to perform a lower tailed test.

Syntax 3:
BINOMIAL PROPORTION UPPER TAILED TEST <y1> <y2>
<SUBSET/EXCEPT/FOR qualification>
where <y1> is the first response variable;
<y2> is the second response variable;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.

This syntax is used for the case where you have raw data and want to perform a upper tailed test.

Syntax 4:
BINOMIAL PROPORTION TEST <p1> <n1> <p2> <n2>
where <p1> is a parameter that specifies the proportion of successes for sample 1;
<n1> is a parameter that specifies the sample size for sample 1;
<p2> is a parameter that specifies the proportion of successes for sample 2;
and      <n2> is a parameter that specifies the sample size for sample 2.

This syntax is used for the case where you have summary data and want to perform a two-tailed test.

Syntax 5:
BINOMIAL PROPORTION LOWER TAILED TEST <p1> <n1> <p2> <n2>
where <p1> is a parameter that specifies the proportion of successes for sample 1;
<n1> is a parameter that specifies the sample size for sample 1;
<p2> is a parameter that specifies the proportion of successes for sample 2;
and      <n2> is a parameter that specifies the sample size for sample 2.

This syntax is used for the case where you have summary data and want to perform a lower tailed test.

Syntax 6:
BINOMIAL PROPORTION UPPER TAILED TEST <p1> <n1> <p2> <n2>
where <p1> is a parameter that specifies the proportion of successes for sample 1;
<n1> is a parameter that specifies the sample size for sample 1;
<p2> is a parameter that specifies the proportion of successes for sample 2;
and      <n2> is a parameter that specifies the sample size for sample 2.

This syntax is used for the case where you have summary data and want to perform an upper tailed test.

Examples:
BINOMIAL PROPORTION TEST Y1 Y2
BINOMIAL PROPORTION TEST P1 N1 P2 N2
Note:
For small samples, it is recommended that the Fisher exact test be used instead of this test.
Note:
The value of the test statistic and the CDF value are saved in the internal parameters STATVAL and STATCDF, respectively. The CDF value is (Z) where is the cumulative distribution function for the standard normal distribution.

For a lower tailed test, the p-value is equal to STATCDF. For an upper tailed test, the p-value is equal to 1 - STATCDF. For a two-tailed test, the p-value is equal to 2*(1 - STATCDF).

Default:
None
Synonyms:
None
Related Commands:
 DIFFERENCE OF PROPORTION CONFIDENCE LIMITS = Compute the confidence interval for the difference of proportions. PROPORTION CONFIDENCE LIMITS = Compute the confidence interval for the difference of proportions. FISHER EXACT TEST = Perform a Fisher exact test.
References:
NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/prc/section3/prc33.htm.

Ryan (2008), "Modern Engineering Statistics", Wiley, pp. 124-126.

Applications:
Categorical Data Analysis
Implementation Date:
2008/8
Program:
LET X1 = 32
LET N1 = 38
LET P1 = X1/N1
LET X2 = 39
LET N2 = 44
LET P2 = X2/N2
SET WRITE DECIMALS 5
BINOMIAL PROPORTION TEST P1 N1 P2 N2

The following output is generated.
            Binomial Test for Equal Proportions
(Large Sample Case)

H0: P1 = P2
Ha: P1 <> P2

Sample 1:
Number of Observations:                              38
Probability of Successes:                       0.84210

Sample 2:
Number of Observations:                              44
Probability of Successes:                       0.88636

Pooled Probability of Success:                  0.86585
Pooled Standard Deviation:                      0.07547

Test Statistic:                                -0.58640
P-Value:                                        0.55760
CDF of Test Statistic:                          0.27880

------------------------------------------------------------------------------
Null Hypothesis           Null
Null     Confidence       Critical        Acceptance     Hypothesis
Hypothesis          Level    Value (+/-)          Interval     Conclusion
------------------------------------------------------------------------------
P1 = P2          50.0%           0.67     (0.250,0.750)         ACCEPT
P1 = P2          80.0%           1.28     (0.100,0.900)         ACCEPT
P1 = P2          90.0%           1.64     (0.050,0.950)         ACCEPT
P1 = P2          95.0%           1.95     (0.025,0.975)         ACCEPT
P1 = P2          97.5%           2.24   (0.0125,0.9875)         ACCEPT
P1 = P2          99.0%           2.57     (0.005,0.995)         ACCEPT


NIST is an agency of the U.S. Commerce Department.

Date created: 01/23/2009
Last updated: 10/09/2015

Please email comments on this WWW page to alan.heckert@nist.gov.