View source: R/prop_test_OLD.R
prop_test_OLD | R Documentation |
In this old version, one-sided tests are permitted.
prop_test_OLD()
This function asks you a sequence of questions in order to execute a proportion test. It finds a confidence interval and a p-value, produces a plot, and indicates how this could be queried directly from R.
> prop_test()
Do you have a single population or are you comparing populations?
Possible answers are 'single' and 'comparing'.
single
How many trials were there in your experiment?
10
How many successes were there?
5
The statistics for your dataset are:
phat = 0.5
s = sqrt(0.5*(1-0.5)/10) = 0.1581139
What is the theoretical proportion you are testing against (called p_0)?
(If you only want a confidence interval, type 'NA')
.2
What is your desired confidence level?
.9
Are you doing a one-sided or two-sided test? Possible answers are 'less', 'greater', and 'two-sided'.
two-sided
The probability of getting this result or more extreme for phat
if the proportion really is 0.2 is
p = 0.0327935
The 90% confidence interval for the population proportion is
0.2224411 < p < 0.7775589
You can get this result by typing:
binom.test(x = 5, n = 10, p = 0.2, alternative = 'two.sided', conf.level = 0.9)
> prop_test()
Do you have a single population or are you comparing populations? Possible answers are 'single' and 'comparing'. comparing
How many trials were there in your first sample? 15
How many successes were there in your first sample? 10
How many trials were there in your second sample? 20
How many successes were there in your second sample? 10
The statistics for your dataset are:
phat1 = 0.6666667
phat2 = 0.5
s = sqrt(0.6666667*(1-0.6666667)/15+0.5*(1-0.5)/20) = 0.1652719
What is your desired confidence level? .95
Are you checking whether the proportion of the second population is less, greater, or different than the proportion of the first population? Possible answers are 'less', 'greater', and 'different'. greater
The probability of getting this result or more extreme for phat2 - phat1 if phat1 really is bigger than phat2 is
p = 0.739209
The 95% confidence interval for the difference in proportions is
-0.5489271 < p2 - p1 < 0.2155937
You can get this result by typing:
prop.test(c(10,10), c(20,15), alternative = 'greater', conf.level = 0.95)
For the confidence interval, you would type:
prop.test(c(10,10), c(20,15), alternative = 'two.sided',conf.level = 0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.