17.3.7.2 Algorithms (One Sample Proportion Test)


Hypotheses

Let n\! be the sample size and n_{1}\!be the number of events or successes. Then the sample proportion \tilde{p}\! can be expressed:\tilde{p}=\frac{n_{1}}{n}

Let p\! be the sample proportion and the p_{0}\! is the hypothetical proportion, this function tests the hypotheses:

H_0:p=p_{0}\! vs H_1:p \ne p_{0}\!, for a two-tailed test.

H_0: p\ge p_{0}\! vs H_1:p < p_{0}\!, for a lower-tailed test.

H_0:p\le p_{0}\! vs H_1:p > p_{0}\!, for an upper-tailed test.

Normal approximation

P Value

When n_{1}\ge10\! and n-n_{1}\ge10\!, we can compute a p-value using a normal approximation of a binomial distribution. To perform the test, compute the z\! and  p_{value}\! value by:

z=\frac{\tilde{p}-p_{0}}{\sqrt{\frac{p_{0}(1-p_{0})}{n}}}\!

p_{value}=2p(Z>|z||p=p_{0})\!,for two tailed test

p_{value}=p(Z\le z|p=p_{0})\!,for upper tailed test

p_{value}=p(Z\ge z|p=p_{0})\!for lower tailed test

Confidence Interval

confidence level is equal to 1-\alpha, the confidence interval for the sample proportion can be generated by:

Null Hypothesis Confidence Interval
H_0:p=p_{0}\! \left[\tilde{p}- Z_{\frac{\alpha}{2}}\sqrt{\frac{\tilde{p}(1-\tilde{p})}{n}}, \tilde{p}+ Z_{\frac{\alpha}{2}}\sqrt{\frac{\tilde{p}(1-\tilde{p})}{n}}\right]
H_0: p\ge p_{0}\! \left[\tilde{p}- Z_{\alpha}\sqrt{\frac{\tilde{p}(1-\tilde{p})}{n}}, 1\right]
H_0:p\le p_{0}\! \left[0, \tilde{p}+ Z_{\alpha}\sqrt{\frac{\tilde{p}(1-\tilde{p})}{n}}\right]

Binomial Test

Exact P_value

In Origin, the exact test for one proportion is based on the Binomial Test .

H_0: p\ge p_{0}\! P_{value}=p(X\le n_{1}|p_0)

H_0:p\le p_{0}\! P_{value}=p(X\ge n_{1}|p_0)

H_0:p=p_{0}\!:

Let M=n*p_0\!,

when n_1=M\! P_{value}=1\!

when n_1\le M\! P_{value}=P(X\le n_1)+P(X\ge n-y+1), where y is the count for z such that P(z)\le p(n_1) and n\ge z\ge \left \lfloor M \right \rfloor+1

when n_1\ge M\! P_{value}=P(X\le y-1)+P(X\ge n_1), where y is the count for z such that P(z)\le p(n_1) and 0\le z\le \left \lfloor M \right \rfloor

Exact Confidence Interval

Exact Confidence interval: confidence levels is 1-\alpha

Null Hypothesis Confidence Interval
H_0:p=p_{0}\!

\left[QBETA_{(1 - \alpha/2, n_1 + 1, n - n_1)}, QBETA_{(\alpha/2, n_1, n - n_1 + 1)}\right]

H_0: p\ge p_{0}\!

\left[QBETA_{(1 - \alpha, n_1 + 1, n - n_1)}, 1\right]

H_0:p\le p_{0}\!

\left[0, QBETA_{(\alpha, n_1, n - n_1 + 1)}\right]

where QBETA denotes the quantile function of Beta distribution.