proportion.test: Large Sample Test for a Population Proportion

Description Usage Arguments Details Value Examples

View source: R/proportion.test.R

Description

proportion.test allows to compute a hypothesis test for a population proportion.

Usage

1
2
proportion.test(x, n, p0, alternative = "two.sided", alpha = 0.05,
  plot = TRUE, lwd = 1)

Arguments

x

a positive number indicating the counts of successes or, if number between 0 and 1, probability of success.

n

a single positive integer corresponding with the sample size.

p0

a positive number in (0,1) corresponding with the proportion to test.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

alpha

a single number in (0,1) corresponding with significance level.

plot

a logical value indicating whether to display a graph including the test statistic value for the sample, its distribution, the rejection region and p-value.

lwd

a single number indicating the line width of the plot.

Details

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 the number of successes is given, then the proportion estimate is computed.

Value

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

statistic

the value of the test statistic.

parameter

the sample size n.

p.value

the p-value of the test.

estimate

the sample proportion.

null.value

the value of p0 specified by the null.

alternative

a character string describing the alternative.

method

a character string indicating the method used.

data.name

a character string giving the names of the data.

alpha

the significance level.

dist.name

a character string indicating the distribution of the test statistic.

statformula

a character string with the statistic's formula.

reject.region

a character string with the reject region.

Examples

1
2
3
x <- rbinom(1, 120, 0.6)
proportion.test(x, 120, 0.5, alternative = "greater")
proportion.test(0.6, 120, 0.5, alternative = "greater")

LearningStats documentation built on April 21, 2021, 9:06 a.m.