# ::Free Statistics and Forecasting Software::

v1.2.1

### :: Testing Population Proportion - Critical Value - Free Statistics Software (Calculator) ::

All rights reserved. The non-commercial (academic) use of this software is free of charge. The only thing that is asked in return is to cite this software when results are used in publications.

This free online software (calculator) computes the critical values for one- and two-sided hypothesis tests about the population proportion. This computation assumes that the number of successes and sample measurements is large enough (normal approximation is used).

In addition the Agresti-Coull approach is used to compute better intervals.

One advantage of this procedure is that its worth does not strongly depend upon the value of n and/or p, and indeed was recommended by Agresti and Coull for virtually all combinations of n and p. Another advantage is that the lower limit cannot be negative.

source: NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/, 2006-11-16.

Finally, the confidence intervals are computed with the Exact (binomial distribution) and the method of Wilson as implemented in the Hmisc package of R.

 Send output to: Browser Blue - Charts White Browser Black/White CSV Sample size Proportion Null hypothesis Type I error (alpha)

 Source code of R module par1 <- as.numeric(par1) par2 <- as.numeric(par2) par3 <- as.numeric(par3) par4 <- as.numeric(par4) if (par2 < par3) { ucv <- qnorm(par4) } else { ucv <- -qnorm(par4) } cv1 <- par3 + ucv * sqrt(par3 * (1-par3) / par1) cv2low <- par2 - abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1) cv2upp <- par2 + abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1) z21 <- qnorm(par4/2)^2 / par1 z2 <- qnorm(par4/2)^2 / (2*par1) z24 <- qnorm(par4/2)^2 / (4*par1^2) cv2lowexact <- (par2 + z2 - abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1 + z24)) / (1 + z21) cv2uppexact <- (par2 + z2 + abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1 + z24)) / (1 + z21) z11 <- qnorm(par4)^2 / par1 z1 <- qnorm(par4)^2 / (2*par1) z14 <- qnorm(par4)^2 / (4*par1^2) cv1lowexact <- (par2 + z1 - abs(qnorm(par4)) * sqrt(par3 * (1-par3) / par1 + z14)) / (1 + z11) cv1uppexact <- (par2 + z1 + abs(qnorm(par4)) * sqrt(par3 * (1-par3) / par1 + z14)) / (1 + z11) load(file="createtable") a<-table.start() a<-table.row.start(a) a<-table.element(a,"Testing Population Proportion (normal approximation)",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Sample size",header=TRUE) a<-table.element(a,par1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Sample Proportion",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Null hypothesis",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Type I error (alpha)",header=TRUE) a<-table.element(a,par4) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"1-sided critical value",header=TRUE) a<-table.element(a,cv1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"1-sided test",header=TRUE) if (par2 < par3) { if (par2 < cv1) { a<-table.element(a,"Reject the Null Hypothesis") } else { a<-table.element(a,"Do not reject the Null Hypothesis") } } else { if (par2 > cv1) { a<-table.element(a,"Reject the Null Hypothesis") } else { a<-table.element(a,"Do not reject the Null Hypothesis") } } a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"2-sided Confidence Interval
(sample proportion)",header=TRUE) dum <- paste("[",cv2low) dum <- paste(dum,",") dum <- paste(dum,cv2upp) dum <- paste(dum,"]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"2-sided test",header=TRUE) if ((par3 < cv2low) | (par3 > cv2upp)) { a<-table.element(a,"Reject the Null Hypothesis") } else { a<-table.element(a,"Do not reject the Null Hypothesis") } a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab") a<-table.start() a<-table.row.start(a) a<-table.element(a,"Testing Population Proportion (Agresti-Coull method)",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Sample size",header=TRUE) a<-table.element(a,par1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Sample Proportion",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Null hypothesis",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Type I error (alpha)",header=TRUE) a<-table.element(a,par4) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Left 1-sided confidence interval",header=TRUE) dum <- paste("[",cv1lowexact) dum <- paste(dum,", 1 ]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Right 1-sided confidence interval",header=TRUE) dum <- paste("[ 0 ,",cv1uppexact) dum <- paste(dum," ]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"2-sided Confidence Interval
(sample proportion)",header=TRUE) dum <- paste("[",cv2lowexact) dum <- paste(dum,",") dum <- paste(dum,cv2uppexact) dum <- paste(dum,"]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab") library(Hmisc) re <- binconf(par2*par1,par1,par4,method="exact") re1 <- binconf(par2*par1,par1,par4*2,method="exact") rw <- binconf(par2*par1,par1,par4,method="wilson") rw1 <- binconf(par2*par1,par1,par4*2,method="wilson") a<-table.start() a<-table.row.start(a) a<-table.element(a,"Testing Population Proportion (Exact and Wilson method)",2,TRUE) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Sample size",header=TRUE) a<-table.element(a,par1) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Sample Proportion",header=TRUE) a<-table.element(a,par2) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Null hypothesis",header=TRUE) a<-table.element(a,par3) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Type I error (alpha)",header=TRUE) a<-table.element(a,par4) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Left 1-sided confidence interval
(Exact method)",header=TRUE) dum <- paste("[",re1[2]) dum <- paste(dum,", 1 ]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Right 1-sided confidence interval
(Exact method)",header=TRUE) dum <- paste("[ 0 ,",re1[3]) dum <- paste(dum," ]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"2-sided Confidence Interval
(Exact method)",header=TRUE) dum <- paste("[",re[2]) dum <- paste(dum,",") dum <- paste(dum,re[3]) dum <- paste(dum,"]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Left 1-sided confidence interval
(Wilson method)",header=TRUE) dum <- paste("[",rw1[2]) dum <- paste(dum,", 1 ]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"Right 1-sided confidence interval
(Wilson method)",header=TRUE) dum <- paste("[ 0 ,",rw1[3]) dum <- paste(dum," ]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.row.start(a) a<-table.element(a,"2-sided Confidence Interval
(Wilson method)",header=TRUE) dum <- paste("[",rw[2]) dum <- paste(dum,",") dum <- paste(dum,rw[3]) dum <- paste(dum,"]") a<-table.element(a,dum) a<-table.row.end(a) a<-table.end(a) table.save(a,file="mytable.tab")
 Top | Output | Charts | References

 Cite this software as: Wessa P., (2016), Testing Population Proportion (Critical values) (v1.0.4) in Free Statistics Software (v1.2.1), Office for Research Development and Education, URL http://www.wessa.net/rwasp_hypothesisprop1.wasp/ The R code is based on : Xycoon, Statistics - Econometrics - Forecasting, Office for Research Development and Education, http://www.xycoon.com/ht_pop_proportion.htm#ex1 NIST/SEMATECH e-Handbook of Statistical Methods, http://www.itl.nist.gov/div898/handbook/, 2006-11-16 A. Agresti and B.A. Coull, Approximate is better than exact for interval estimation of binomial proportions, American Statistician, 52:119-126, 1998. R.G. Newcombe, Logit confidence intervals and the inverse sinh transformation, American Statistician, 55:200-202, 2001. L.D. Brown, T.T. Cai and A. DasGupta, Interval estimation for a binomial proportion (with discussion), Statistical Science, 16:101-133, 2001. Frank E Harrell Jr and with contributions from many other users. (2006). Hmisc: Harrell Miscellaneous. R package version 3.1-1.http://biostat.mc.vanderbilt.edu/s/Hmisc,http://biostat.mc.vanderbilt.edu/twiki/pub/Main/RS/sintro.pdf,http://biostat.mc.vanderbilt.edu/twiki/pub/Main/StatReport/summary.pdf
 Top | Output | Charts | References
 To cite Wessa.net in publications use:Wessa, P. (2024), Free Statistics Software, Office for Research Development and Education, version 1.2.1, URL https://www.wessa.net/ © All rights reserved. Academic license for non-commercial use only. The free use of the scientific content, services, and applications in this website is granted for non commercial use only. In any case, the source (url) should always be clearly displayed. Under no circumstances are you allowed to reproduce, copy or redistribute the design, layout, or any content of this website (for commercial use) including any materials contained herein without the express written permission. Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. We make no warranties or representations as to the accuracy or completeness of such information (or software), and it assumes no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site. Software Version : 1.2.1Algorithms & Software : Patrick Wessa, PhDServer : www.wessa.net
 © Wessa.Net 2002-2024