R: 1-Proportion Z Test & Confidence Interval
Code Only
|
Code with Rweb Output
|
### prop.test(x, n, p = NULL, alternative = c("t", "l", "t"), conf.level = 0.95)
### 1-Proportion Test where p > .5 ### alternative="l" refers to GREATER binom.test(57, 100, .5, alternative="g", conf.level=0.9) ### 1-Proportion Test where p < .5 ### alternative="l" refers to LESS ### con.level undefined, therefore assumed to be 0.95 binom.test(40, 100, .5, alternative="l") ### 1-Proportion Test where p not equal to .5 ### alternative="t" refers to TWO-SIDED TEST binom.test(45, 100, .5, alternative="t") |
> ### prop.test(x, n, p = NULL, alternative = c("t", "l", "t"), conf.level = 0.95)
> > ### 1-Proportion Test where p > .5 > ### alternative="l" refers to GREATER > binom.test(57, 100, .5, alternative="g", conf.level=0.9) Exact binomial test data: 57 and 100 number of successes = 57, number of trials = 100, p-value = 0.09667 alternative hypothesis: true probability of success is greater than 0.5 90 percent confidence interval: 0.5009583 1.0000000 sample estimates: probability of success 0.57 > ### 1-Proportion Test where p < .5 > ### alternative="l" refers to LESS > ### con.level undefined, therefore assumed to be 0.95 > binom.test(40, 100, .5, alternative="l") Exact binomial test data: 40 and 100 number of successes = 40, number of trials = 100, p-value = 0.02844 alternative hypothesis: true probability of success is less than 0.5 95 percent confidence interval: 0.0000000 0.4870242 sample estimates: probability of success 0.4 > ### 1-Proportion Test where p not equal to .5 > ### alternative="t" refers to TWO-SIDED TEST > binom.test(45, 100, .5, alternative="t") Exact binomial test data: 45 and 100 number of successes = 45, number of trials = 100, p-value = 0.3682 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.3503202 0.5527198 sample estimates: probability of success 0.45 |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.