::Free Statistics and Forecasting Software::

v1.1.23-r3
 
  Black&White | Blue Theme | Normal Fontsize | Increase Fontsize | Decrease Fontsize | Toggle underline
Secure website (SSL) | Private
 
 


This software module is powered by R

:: 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.

Click here to edit the underlying code of this R Module.

Send output to:
Sample size 
Proportion 
Null hypothesis 
Type I error (alpha) 

Click here to edit the underlying code of this R Module.





Source code of R module
1par1 <- as.numeric(par1)
2par2 <- as.numeric(par2)
3par3 <- as.numeric(par3)
4par4 <- as.numeric(par4)
5if (par2 < par3)
6{
7ucv <- qnorm(par4)
8} else {
9ucv <- -qnorm(par4)
10}
11cv1 <- par3 + ucv * sqrt(par3 * (1-par3) / par1)
12cv2low <- par2 - abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1)
13cv2upp <- par2 + abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1)
14z21 <- qnorm(par4/2)^2 / par1
15z2 <- qnorm(par4/2)^2 / (2*par1)
16z24 <- qnorm(par4/2)^2 / (4*par1^2)
17cv2lowexact <- (par2 + z2 - abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1 + z24)) / (1 + z21)
18cv2uppexact <- (par2 + z2 + abs(qnorm(par4/2)) * sqrt(par3 * (1-par3) / par1 + z24)) / (1 + z21)
19z11 <- qnorm(par4)^2 / par1
20z1 <- qnorm(par4)^2 / (2*par1)
21z14 <- qnorm(par4)^2 / (4*par1^2)
22cv1lowexact <- (par2 + z1 - abs(qnorm(par4)) * sqrt(par3 * (1-par3) / par1 + z14)) / (1 + z11)
23cv1uppexact <- (par2 + z1 + abs(qnorm(par4)) * sqrt(par3 * (1-par3) / par1 + z14)) / (1 + z11)
24load(file="createtable")
25a<-table.start()
26a<-table.row.start(a)
27a<-table.element(a,"Testing Population Proportion (normal approximation)",2,TRUE)
28a<-table.row.end(a)
29a<-table.row.start(a)
30a<-table.element(a,"Sample size",header=TRUE)
31a<-table.element(a,par1)
32a<-table.row.end(a)
33a<-table.row.start(a)
34a<-table.element(a,"Sample Proportion",header=TRUE)
35a<-table.element(a,par2)
36a<-table.row.end(a)
37a<-table.row.start(a)
38a<-table.element(a,"Null hypothesis",header=TRUE)
39a<-table.element(a,par3)
40a<-table.row.end(a)
41a<-table.row.start(a)
42a<-table.element(a,"Type I error (alpha)",header=TRUE)
43a<-table.element(a,par4)
44a<-table.row.end(a)
45a<-table.row.start(a)
46a<-table.element(a,"1-sided critical value",header=TRUE)
47a<-table.element(a,cv1)
48a<-table.row.end(a)
49a<-table.row.start(a)
50a<-table.element(a,"1-sided test",header=TRUE)
51if (par2 < par3)
52{
53if (par2 < cv1)
54{
55a<-table.element(a,"Reject the Null Hypothesis")
56} else {
57a<-table.element(a,"Do not reject the Null Hypothesis")
58}
59} else {
60if (par2 > cv1)
61{
62a<-table.element(a,"Reject the Null Hypothesis")
63} else {
64a<-table.element(a,"Do not reject the Null Hypothesis")
65}
66}
67a<-table.row.end(a)
68a<-table.row.start(a)
69a<-table.element(a,"2-sided Confidence Interval
(sample proportion)",header=TRUE)
70dum <- paste("[",cv2low)
71dum <- paste(dum,",")
72dum <- paste(dum,cv2upp)
73dum <- paste(dum,"]")
74a<-table.element(a,dum)
75a<-table.row.end(a)
76a<-table.row.start(a)
77a<-table.element(a,"2-sided test",header=TRUE)
78if ((par3 < cv2low) | (par3 > cv2upp))
79{
80a<-table.element(a,"Reject the Null Hypothesis")
81} else {
82a<-table.element(a,"Do not reject the Null Hypothesis")
83}
84a<-table.row.end(a)
85a<-table.end(a)
86table.save(a,file="mytable.tab")
87a<-table.start()
88a<-table.row.start(a)
89a<-table.element(a,"Testing Population Proportion (Agresti-Coull method)",2,TRUE)
90a<-table.row.end(a)
91a<-table.row.start(a)
92a<-table.element(a,"Sample size",header=TRUE)
93a<-table.element(a,par1)
94a<-table.row.end(a)
95a<-table.row.start(a)
96a<-table.element(a,"Sample Proportion",header=TRUE)
97a<-table.element(a,par2)
98a<-table.row.end(a)
99a<-table.row.start(a)
100a<-table.element(a,"Null hypothesis",header=TRUE)
101a<-table.element(a,par3)
102a<-table.row.end(a)
103a<-table.row.start(a)
104a<-table.element(a,"Type I error (alpha)",header=TRUE)
105a<-table.element(a,par4)
106a<-table.row.end(a)
107a<-table.row.start(a)
108a<-table.element(a,"Left 1-sided confidence interval",header=TRUE)
109dum <- paste("[",cv1lowexact)
110dum <- paste(dum,", 1 ]")
111a<-table.element(a,dum)
112a<-table.row.end(a)
113a<-table.row.start(a)
114a<-table.element(a,"Right 1-sided confidence interval",header=TRUE)
115dum <- paste("[ 0 ,",cv1uppexact)
116dum <- paste(dum," ]")
117a<-table.element(a,dum)
118a<-table.row.end(a)
119a<-table.row.start(a)
120a<-table.element(a,"2-sided Confidence Interval
(sample proportion)",header=TRUE)
121dum <- paste("[",cv2lowexact)
122dum <- paste(dum,",")
123dum <- paste(dum,cv2uppexact)
124dum <- paste(dum,"]")
125a<-table.element(a,dum)
126a<-table.row.end(a)
127a<-table.end(a)
128table.save(a,file="mytable.tab")
129library(Hmisc)
130re <- binconf(par2*par1,par1,par4,method="exact")
131re1 <- binconf(par2*par1,par1,par4*2,method="exact")
132rw <- binconf(par2*par1,par1,par4,method="wilson")
133rw1 <- binconf(par2*par1,par1,par4*2,method="wilson")
134a<-table.start()
135a<-table.row.start(a)
136a<-table.element(a,"Testing Population Proportion (Exact and Wilson method)",2,TRUE)
137a<-table.row.end(a)
138a<-table.row.start(a)
139a<-table.element(a,"Sample size",header=TRUE)
140a<-table.element(a,par1)
141a<-table.row.end(a)
142a<-table.row.start(a)
143a<-table.element(a,"Sample Proportion",header=TRUE)
144a<-table.element(a,par2)
145a<-table.row.end(a)
146a<-table.row.start(a)
147a<-table.element(a,"Null hypothesis",header=TRUE)
148a<-table.element(a,par3)
149a<-table.row.end(a)
150a<-table.row.start(a)
151a<-table.element(a,"Type I error (alpha)",header=TRUE)
152a<-table.element(a,par4)
153a<-table.row.end(a)
154a<-table.row.start(a)
155a<-table.element(a,"Left 1-sided confidence interval
(Exact method)",header=TRUE)
156dum <- paste("[",re1[2])
157dum <- paste(dum,", 1 ]")
158a<-table.element(a,dum)
159a<-table.row.end(a)
160a<-table.row.start(a)
161a<-table.element(a,"Right 1-sided confidence interval
(Exact method)",header=TRUE)
162dum <- paste("[ 0 ,",re1[3])
163dum <- paste(dum," ]")
164a<-table.element(a,dum)
165a<-table.row.end(a)
166a<-table.row.start(a)
167a<-table.element(a,"2-sided Confidence Interval
(Exact method)",header=TRUE)
168dum <- paste("[",re[2])
169dum <- paste(dum,",")
170dum <- paste(dum,re[3])
171dum <- paste(dum,"]")
172a<-table.element(a,dum)
173a<-table.row.end(a)
174a<-table.row.start(a)
175a<-table.element(a,"Left 1-sided confidence interval
(Wilson method)",header=TRUE)
176dum <- paste("[",rw1[2])
177dum <- paste(dum,", 1 ]")
178a<-table.element(a,dum)
179a<-table.row.end(a)
180a<-table.row.start(a)
181a<-table.element(a,"Right 1-sided confidence interval
(Wilson method)",header=TRUE)
182dum <- paste("[ 0 ,",rw1[3])
183dum <- paste(dum," ]")
184a<-table.element(a,dum)
185a<-table.row.end(a)
186a<-table.row.start(a)
187a<-table.element(a,"2-sided Confidence Interval
(Wilson method)",header=TRUE)
188dum <- paste("[",rw[2])
189dum <- paste(dum,",")
190dum <- paste(dum,rw[3])
191dum <- paste(dum,"]")
192a<-table.element(a,dum)
193a<-table.row.end(a)
194a<-table.end(a)
195table.save(a,file="mytable.tab")
Top | Output | Charts | References | History | Feedback



Cite this software as:
Wessa P., (2008), Testing Population Proportion (Critical values) (v1.0.3) in Free Statistics Software (v1.1.23-r3), 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 | History | Feedback
Delete history
Server DateModuleCommand
Fri, 03 Jul 2009 15:14:32 -0600Start of session-
Top | Output | Charts | References | History | Feedback

Please, send us your feedback!
Overall rating
What do you think about the response time?
Rate the facility with which you interact with our software.
Is the output presented in an understandable (clear) form?
How did you find this website/module?
Do you have any comments or suggestions for our site?
Please enter the code that is displayed in this picture: captcha

To cite Wessa.net in publications use:
Wessa, P. (2009), Free Statistics Software, Office for Research Development and Education,
version 1.1.23-r3, URL http://www.wessa.net/

© Resa R&D, and the 'Office for Research, Development, and Education' - All rights reserved. Academic license for non-commercial use only.
This website is an intellectual and physical property of Resa R&D. This includes: html content, graphical illustrations (gif files), computer software, online or electronic documentation, associated media, and printed materials. 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 of Resa R&D or the Office for Research, Development, and Education.

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. However, Resa R&D makes 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 Resa R&D 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.1.23-r3
Algorithms & Software : Prof. dr. P. Wessa
Facilities : Resa R&D - Office for Research, Development, and Education
Server : www.wessa.net

Comments, Feedback & Errors | Privacy Policy | Statistics Resources | Wessa.net Home

 © Wessa.Net 2002-2009  
 
 

Home Page
Equation Plotter
Time Series Analysis (new)
Time Series Analysis (old)
Multiple Regression (new)
Multiple Regression (old)
Descriptive Statistics
Statistical Distributions
Hypothesis Testing
Statistics Education

Academic citations
Computations Archive
Search Computations
R Project
FAQ
About Wessa.net
Powered by Linux

Server status page
History list
Edit R Code
Google
Web wessa.net



Resa R&D provides this service to the internet community free of charge. Support this project with your contribution.