Reputation: 30517
> prop.test(6,10)
1-sample proportions test with continuity correction
data: 6 out of 10, null probability 0.5
X-squared = 0.1, df = 1, p-value = 0.7518
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
0.2736697 0.8630694
sample estimates:
p
0.6
Please help me with, How to calculate this manually?
Here is what I have tried,
> se = sqrt(0.6*0.4*10/9)/sqrt(10)
> mean = 6/10
> z = qnorm(0.975)
> from95 = mean - z*se
> to95 = mean + z*se
> from95
[1] 0.2799392
> to95
[1] 0.9200608
Upvotes: 0
Views: 809
Reputation: 99361
All the information you need is in the source code of the function. You can separate it into parts with as.list(body(prop.test))
. Or sending it to a file with sink
so you can study it separately may help also.
For example, you can view the thirty-first element of the function body with
> as.list(body(prop.test))[[31]]
# if (alternative == "two.sided") PVAL <- pchisq(STATISTIC, PARAMETER,
# lower.tail = FALSE) else {
# if (k == 1)
# z <- sign(ESTIMATE - p) * sqrt(STATISTIC)
# else z <- sign(DELTA) * sqrt(STATISTIC)
# PVAL <- pnorm(z, lower.tail = (alternative == "less"))
# }
Upvotes: 2