You need to learn how to use prop.test properly.
Is this a ONE-sample test or TWO-sample test?
Perhaps this will help:
#"hand" calculation
phat <- 58/691
p <- 56/691
q <- 1-p
n <- 691
z <- (phat-p)/sqrt(p*q/n)
z
[1] 0.2787970
pnorm(-z)*2
[1] 0.7804006
#"prop.test"
prop.test(x=58, n=691, p=56/691, correct = FALSE)
1-sample proportions test without continuity correction
data: 58 out of 691, null probability 56/691
X-squared = 0.0777, df = 1, p-value = 0.7804
alternative hypothesis: true p is not equal to 0.08104197
# Note the 'without' continuity correction part
-Peter Ehlers
Roslina Zakaria wrote:> Hi r-users,
> ?
> I would like to use prop.test code and I also calculate manually to test
the proportions for 2 groups.? The problem is the answer for the
p-value?calculated manually are different from prop.test.? Here are the results:
> ?
> ## Manually
> ?
> z value: z= (phat-p)/sqrt(pq/n) = (.084-.081)/sqrt(.081(1-.081)/691)=0.289,
pvalue=0.7718
> ?
>
> ## Using prop.test code
>> low <- c(56,58)
>> tot <- c(691,691)
>> prop.test(low, tot, p = c(56/691,58/691), alternative =
"two.sided", conf.level = 0.95, correct = TRUE)
> ??????? 2-sample test for given proportions with continuity correction
> data:? low out of tot, null probabilities c(56/691, 58/691)
> X-squared = 0.0096, df = 2, p-value = 0.9952
> alternative hypothesis: two.sided
> null values:
> ??? prop 1???? prop 2
> 0.08104197 0.08393632
> sample estimates:
> ??? prop 1???? prop 2
> 0.08104197 0.08393632
> ?
> ?
> Thank you so much for any help given.
>
>
>
> [[alternative HTML version deleted]]
>
>
>
> ------------------------------------------------------------------------
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Peter Ehlers
University of Calgary
403.202.3921