This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/prop.test.html
prop.test {base}R Documentation

Test for Equal or Given Proportions

Description

prop.test can be used for testing the null that the proportions (probabilities of success) in several groups are the same, or that they equal certain given values.

If p is NULL and there is more than one group, the null tested is that the proportions in each group are the same. If there are two groups, the alternatives are that the probability of success in the first group is less than, not equal to, or greater than the probability of success in the second group, as specified by alternative. A confidence interval for the difference of proportions with confidence level as specified by conf.level and clipped to [-1,1] is returned. Continuity correction is used only if it does not exceed the difference of the sample proportions in absolute value. Otherwise, if there are more than 2 groups, the alternative is always "two.sided", the returned confidence interval is NULL, and continuity correction is never used.

If there is only one group, then the null tested is that the underlying probability of success is p, or .5 if p is not given. The alternative is that the probability of success if less than, not equal to, or greater than p or 0.5, respectively, as specified by alternative. A confidence interval for the underlying proportion with confidence level as specified by conf.level and clipped to [0,1] is returned. Continuity correction is used only if it does not exceed the difference between sample and null proportions in absolute value.

Finally, if p is given and there are more than 2 groups, the null tested is that the underlying probabilities of success are those given by p. The alternative is always "two.sided", the returned confidence interval is NULL, and continuity correction is never used.

Usage

prop.test(x, n, p = NULL, alternative = "two.sided",
          conf.level = 0.95, correct = TRUE)

Arguments

x, n

vectors of counts of successes and trials, respectively. Only pairs with finite values are used. The elements of x must be nonnegative and not greater than the corresponding elements of n which must be positive. All elements should be integers.

p

a vector of probabilities of success. p must have the same length as x and n, and its elements must be greater than 0 and less than 1.

alternative

indicates the alternative hypothesis and must be one of "two.sided", "greater" or "less". You can specify just the initial letter. Only used for testing the null that a single proportion equals a given value, or that two proportions are equal; ignored otherwise.

conf.level

confidence level of the returned confidence interval. Must be a single number between 0 and 1. Only used when testing the null that a single proportion equals a given value, or that two proportions are equal; ignored otherwise.

correct

a logical indicating whether Yates' continuity correction should be applied.

Value

A list with class "htest" containing the following components:

statistic

the value of Pearson's chi-square test statistic.

parameter

the degrees of freedom of the approximate chi-square distribution of the test statistic.

p.value

the p-value of the test.

estimate

a vector with the sample proportions x/n.

conf.int

a confidence interval for the true proportion if there is one group, or for the difference in proportions if there are 2 groups and p is not given, or NULL otherwise. In the cases where it is not NULL, the returned confidence interval has an asymptotic confidence level as specified by conf.level, and is appropriate to the specified alternative hypothesis.

null.value

the value of p if specified by the null, or NULL otherwise.

alternative

a character string describing the alternative.

method

a character string indicating the method used, and whether Yates' continuity correction was applied.

data.name

a character string giving the names of the data.


[Package base version 0.60 ]