Tests on the equality of proportions using large-sample statistics. It tests that a sample has the same proportion within two independent groups or two samples have the same proportion.

ts_prop_test(var1, var2, alternative = c("both", "less", "greater", "all"),
  ...)

ts_prop_grp(var, group, alternative = c("both", "less", "greater", "all"))

ts_prop_calc(n1, n2, p1, p2, alternative = c("both", "less", "greater",
  "all"), ...)

Arguments

var1
a categorical variable
var2
a categorical variable
alternative
a character string specifying the alternative hypothesis, must be one of "both" (default), "greater", "less" or "all". You can specify just the initial letter
...
additional arguments passed to or from other methods
var
a categorical variable
group
a categorical variable
n1
sample 1 size
n2
sample 2 size
p1
sample 1 proportion
p2
sample 2 proportion

Value

an object of class "prop_test". An object of class "prop_test" is a list containing the following components:

References

Sheskin, D. J. 2007. Handbook of Parametric and Nonparametric Statistical Procedures, 4th edition. : Chapman & Hall/CRC.

See also

prop.test

Examples

# using variables # lower tail ts_prop_test(var1 = treatment$treatment1, var2 = treatment$treatment2, alternative = 'less')
#> Test Statistics #> ------------------------ #> Sample Size 50 #> z 0.403 #> Pr(Z < z) 0.656 #>
# upper tail ts_prop_test(var1 = treatment$treatment1, var2 = treatment$treatment2, alternative = 'greater')
#> Test Statistics #> ------------------------ #> Sample Size 50 #> z 0.403 #> Pr(Z > z) 0.344 #>
# both tails ts_prop_test(var1 = treatment$treatment1, var2 = treatment$treatment2, alternative = 'both')
#> Test Statistics #> ------------------------ #> Sample Size 50 #> z 0.403 #> Pr(|Z| > |z|) 0.687 #>
# all tails ts_prop_test(var1 = treatment$treatment1, var2 = treatment$treatment2, alternative = 'all')
#> Test Statistics #> ------------------------ #> Sample Size 50 #> z 0.403 #> Pr(|Z| > |z|) 0.687 #> Pr(Z < z) 0.656 #> Pr(Z > z) 0.344 #>
# using groups # lower tail ts_prop_grp(var = treatment2$outcome, group = treatment2$female, alternative = 'less')
#> Test Statistics #> ------------------------ #> Sample Size 91 #> z 0.351 #> Pr(Z < z) 0.637 #>
# upper tail ts_prop_grp(var = treatment2$outcome, group = treatment2$female, alternative = 'greater')
#> Test Statistics #> ------------------------ #> Sample Size 91 #> z 0.351 #> Pr(Z > z) 0.363 #>
# both tails ts_prop_grp(var = treatment2$outcome, group = treatment2$female, alternative = 'both')
#> Test Statistics #> ------------------------ #> Sample Size 91 #> z 0.351 #> Pr(|Z| > |z|) 0.726 #>
# # all tails ts_prop_grp(var = treatment2$outcome, group = treatment2$female, alternative = 'all')
#> Test Statistics #> ------------------------ #> Sample Size 91 #> z 0.351 #> Pr(|Z| > |z|) 0.726 #> Pr(Z < z) 0.637 #> Pr(Z > z) 0.363 #>
# using sample size and proportions # lower tail ts_prop_calc(n1 = 30, n2 = 25, p1 = 0.3, p2 = 0.5, alternative = 'less')
#> Test Statistics #> ------------------------- #> Sample Size 30 #> z -1.514 #> Pr(Z < z) 0.065 #>
# upper tail ts_prop_calc(n1 = 30, n2 = 25, p1 = 0.3, p2 = 0.5, alternative = 'greater')
#> Test Statistics #> ------------------------- #> Sample Size 30 #> z -1.514 #> Pr(Z > z) 0.935 #>
# both tails ts_prop_calc(n1 = 30, n2 = 25, p1 = 0.3, p2 = 0.5, alternative = 'both')
#> Test Statistics #> ------------------------- #> Sample Size 30 #> z -1.514 #> Pr(|Z| > |z|) 0.13 #>
# all tails ts_prop_calc(n1 = 30, n2 = 25, p1 = 0.3, p2 = 0.5, alternative = 'all')
#> Test Statistics #> ------------------------- #> Sample Size 30 #> z -1.514 #> Pr(|Z| > |z|) 0.13 #> Pr(Z < z) 0.065 #> Pr(Z > z) 0.935 #>