Rev 63 | Blame | Last modification | View Log | Download | RSS feed
\name{prop.test}\title{Test for Equal or Given Proportions}\usage{prop.test(x, n, p = NULL, alternative = "two.sided",conf.level = 0.95, correct = TRUE)}\alias{prop.test}\arguments{\item{x, n}{vectors of counts of successes and trials, respectively.Only pairs with finite values are used. The elements of \code{x}must be nonnegative and not greater than the corresponding elementsof \code{n} which must be positive. All elements should beintegers.}\item{p}{a vector of probabilities of success. \code{p} must have thesame length as \code{x} and \code{n}, and its elements must begreater than 0 and less than 1.}\item{alternative}{indicates the alternative hypothesis and must beone of \code{"two.sided"}, \code{"greater"} or \code{"less"}. Youcan specify just the initial letter. Only used for testing the nullthat a single proportion equals a given value, or that twoproportions are equal; ignored otherwise.}\item{conf.level}{confidence level of the returned confidenceinterval. Must be a single number between 0 and 1. Only used whentesting the null that a single proportion equals a given value, orthat two proportions are equal; ignored otherwise.}\item{correct}{a logical indicating whether Yates' continuitycorrection should be applied.}}\description{\code{prop.test} can be used for testing the null that the proportions(probabilities of success) in several groups are the same, or thatthey equal certain given values.If \code{p} is \code{NULL} and there is more than one group, the nulltested is that the proportions in each group are the same. If thereare two groups, the alternatives are that the probability of successin the first group is less than, not equal to, or greater than theprobability of success in the second group, as specified by\code{alternative}. A confidence interval for the difference ofproportions with confidence level as specified by \code{conf.level}and clipped to \eqn{[-1,1]} is returned. Continuity correction isused only if it does not exceed the difference of the sampleproportions in absolute value. Otherwise, if there are more than 2groups, the alternative is always \code{"two.sided"}, the returnedconfidence interval is \code{NULL}, and continuity correction is neverused.If there is only one group, then the null tested is that theunderlying probability of success is \code{p}, or .5 if \code{p} isnot given. The alternative is that the probability of success if lessthan, not equal to, or greater than \code{p} or 0.5, respectively, asspecified by \code{alternative}. A confidence interval for theunderlying proportion with confidence level as specified by\code{conf.level} and clipped to \eqn{[0,1]} is returned. Continuitycorrection is used only if it does not exceed the difference betweensample and null proportions in absolute value.Finally, if \code{p} is given and there are more than 2 groups, thenull tested is that the underlying probabilities of success are thosegiven by \code{p}. The alternative is always \code{"two.sided"}, thereturned confidence interval is \code{NULL}, and continuity correctionis never used.}\value{A list with class \code{"htest"} containing the following components:\item{statistic}{the value of Pearson's chi-square test statistic.}\item{parameter}{the degrees of freedom of the approximate chi-squaredistribution of the test statistic.}\item{p.value}{the p-value of the test.}\item{estimate}{a vector with the sample proportions \code{x/n}.}\item{conf.int}{a confidence interval for the true proportion if thereis one group, or for the difference in proportions if there are 2groups and \code{p} is not given, or \code{NULL} otherwise. In thecases where it is not \code{NULL}, the returned confidence intervalhas an asymptotic confidence level as specified by\code{conf.level}, and is appropriate to the specified alternativehypothesis.}\item{null.value}{the value of \code{p} if specified by the null, or\code{NULL} otherwise.}\item{alternative}{a character string describing the alternative.}\item{method}{a character string indicating the method used, andwhether Yates' continuity correction was applied.}\item{data.name}{a character string giving the names of the data.}}\keyword{htest}