Performs a one- or two-sample test of proportions using counts of successes and trials, rather than binary data. This test can be approximate or exact.
proptesti(
x1,
n1,
x2 = NULL,
n2 = NULL,
exact = FALSE,
null.hypoth = ifelse(is.null(x2) && is.null(n2), 0.5, 0),
conf.level = 0.95,
alternative = "two.sided",
correct = FALSE,
more.digits = 0
)
A list of class proptesti
. The print method lays out the information in an easy-to-read
format.
A formatted table of descriptive and inferential results (total number of observations, sample proportion, standard error of the proportion estimate), along with a confidence interval for the underlying proportion.
the value of the test statistic, if using an approximate test.
the p-value for the test
A vector of information about the type of test (null hypothesis, alternative hypothesis, etc.)
Number of successes in first sample
Number of trials in first sample
Number of successes in second sample
Number of trials in second sample
If true, performs a test of equality of proportions with Exact Binomial based confidence intervals.
a number specifying the null hypothesis for the mean (or difference in means if performing a two-sample test). Defaults to 0.5 for one-sample and 0 for two-sample.
confidence level of the test. Defaults to 0.95
a string: one of
"less"
, "two.sided"
, or "greater"
specifying the form
of the test. Defaults to a two-sided test. When either "less"
or "greater"
is
used, the corresponding one-sided confidence interval is returned.
a logical indicating whether to perform a continuity correction
a numeric value specifying whether or not to display more or fewer digits in the output. Non-integers are automatically rounded down.
If x2
or n2
are specified, then both must be specified, and a two-sample test is run.
# Two-sample test
proptesti(10, 100, 15, 200, alternative = "less")
Run the code above in your browser using DataLab