size.prop: Sample size determination for testing the proportion

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/size.prop.R

Description

This function performs sample size computation for the one-sample and two-sample test for proportions based on precision requirements (i.e., type-I-risk, type-II-risk and an effect size).

Usage

1
2
3
size.prop(pi = NULL, delta, sample = c("two.sample", "one.sample"),
          alternative = c("two.sided", "less", "greater"),
          alpha = 0.05, beta = 0.1, correct = FALSE, output = TRUE)

Arguments

pi

a number indicating the true value of the probability under the null hypothesis (one-sample test), π.0 or a number indicating the true value of the probability in group 1 (two-sample test), π.1.

delta

minimum difference to be detected, δ.

sample

a character string specifying one- or two-sample proportion test, must be one of "two.sample" (default) or "one.sample".

alternative

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

alpha

type-I-risk, α.

beta

type-II-risk, β.

correct

a logical indicating whether continuity correction should be applied.

output

logical: if TRUE, output is shown.

Value

Returns an object of class size with following entries:

call function call
type type of the test (i.e., proportion)
spec specification of function arguments
res list with the result, i.e., optimal sample size

Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at,

References

Fleiss, J. L., Levin, B., & Paik, M. C. (2003). Statistical methods for rates and proportions (3rd ed.). New York: John Wiley & Sons.

Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.

Rasch, D., Pilz, J., Verdooren, L. R., & Gebhardt, G. (2011). Optimal experimental design with R. Boca Raton: Chapman & Hall/CRC.

See Also

seqtest.prop, size.mean, size.cor, print.size

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#--------------------------------------
# Two-sided one-sample test
# H0: pi = 0.5, H1: pi != 0.5
# alpha = 0.05, beta = 0.2, delta = 0.2

size.prop(pi = 0.5, delta = 0.2, sample = "one.sample",
          alternative = "two.sided", alpha = 0.05, beta = 0.2)

#--------------------------------------
# One-sided one-sample test
# H0: pi <= 0.5, H1: pi > 0.5
# alpha = 0.05, beta = 0.2, delta = 0.2

size.prop(pi = 0.5, delta = 0.2, sample = "one.sample",
          alternative = "less", alpha = 0.05, beta = 0.2)

#--------------------------------------
# Two-sided two-sample test
# H0: pi.1 = pi.2 = 0.5, H1: pi.1 != pi.2
# alpha = 0.01, beta = 0.1, delta = 0.2

size.prop(pi = 0.5, delta = 0.2, sample = "two.sample",
          alternative = "two.sided", alpha = 0.01, beta = 0.1)

#--------------------------------------
# One-sided two-sample test
# H0: pi.1 <=  pi.1 = 0.5, H1: pi.1 > pi.2
# alpha = 0.01, beta = 0.1, delta = 0.2

size.prop(pi = 0.5, delta = 0.2, sample = "two.sample",
          alternative = "greater", alpha = 0.01, beta = 0.1)

seqtest documentation built on May 2, 2019, 5:54 a.m.

Related to size.prop in seqtest...