#-------------------------------------------------------------------------------
# Example 1: 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)
#-------------------------------------------------------------------------------
# Example 2: Two-sided one-sample test
# H0: pi = 0.5, H1: pi != 0.5
# alpha = 0.05, beta = 0.2, delta = 0.2
# with continuity correction
size.prop(pi = 0.5, delta = 0.2, sample = "one.sample",
alternative = "two.sided", alpha = 0.05, beta = 0.2,
correct = TRUE)
#-------------------------------------------------------------------------------
# Example 3: 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)
#-------------------------------------------------------------------------------
# Example 4: 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)
#-------------------------------------------------------------------------------
# Example 5: 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)
Run the code above in your browser using DataLab