Basic Statistical Analysis Using the R Statistical PackageBy Andrie de Vries, Prop.test in r example Meys. The following example is based on real research, published by Robert Rutledge, MD, and his colleagues in the Annals of Surgery In a hospital in North Carolina, the doctors registered the patients who were involved in a car accident and whether they used seat belts. The following matrix represents the number e survivors anova back ribs deceased patients in each group:. To know prop.tedt seat belts made a difference in the chances of surviving, you can carry out a proportion test. This test tells how probable it is that prop.test in r example proportions are the same.
R: Test of Equal or Given Proportions
The length of p must be the same as the number of groups specified by x , and its elements must be greater than 0 and less than 1. 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. 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. Only groups with finite numbers of successes and failures are used.
Counts of successes and failures must be nonnegative and hence not greater than the corresponding numbers of trials which must be positive. All finite counts should be integers. 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. 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. If there is only one group, then the null tested is that the underlying probability of success is p , or. The alternative is that the probability of success is less than, not equal to, or greater than p or 0.
A confidence interval for the underlying proportion with confidence level as specified by conf. Continuity correction is used only if it does not exceed the difference between sample and null proportions in absolute value.
The confidence interval is computed by inverting the score test. 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. In the cases where it is not NULL , the returned confidence interval has an asymptotic confidence level as specified by conf.
Comparison of Seven Methods. Statistics in Medicine 17 , Comparison of Eleven Methods. Test of Equal or Given Proportions prop. The null hypothesis is that the four populations from which the patients were drawn have the same true proportion of smokers.
The alternative is that this proportion is different in at least one of the populations. Community examples Looks like there are no examples yet. Post a new example: Learn R at work Try it free.