prop_test
compares proportion in one group to a
specified population proportion.
prop_test(n, prob = 0.5, alternative = c("both", "less", "greater", "all"), ...) # S3 method for default prop_test(n, prob = 0.5, alternative = c("both", "less", "greater", "all"), phat, ...) # S3 method for factor prop_test(n, prob = 0.5, alternative = c("both", "less", "greater", "all"), ...)
prop_test
returns an object of class "prop_test"
.
An object of class "prop_test"
is a list containing the
following components:
Sheskin, D. J. 2007. Handbook of Parametric and Nonparametric Statistical Procedures, 4th edition. : Chapman & Hall/CRC.
# use as a calculator prop_test(200, prob = 0.5, phat = 0.3)#> Test Statistics #> -------------------------- #> Sample Size 200 #> Exp Prop 0.5 #> Obs Prop 0.3 #> z -5.6569 #> Pr(|Z| > |z|) 0 #> #> ----------------------------------------------------------------- #> Category Observed Expected % Deviation Std. Residuals #> ----------------------------------------------------------------- #> 0 140 100 40.00 4.00 #> 1 60 100 -40.00 -4.00 #> -----------------------------------------------------------------# using data set prop_test(as.factor(hsb$female), prob = 0.5)#> Test Statistics #> ------------------------- #> Sample Size 200 #> Exp Prop 0.5 #> Obs Prop 0.545 #> z 1.2728 #> Pr(|Z| > |z|) 0.2031 #> #> ----------------------------------------------------------------- #> Category Observed Expected % Deviation Std. Residuals #> ----------------------------------------------------------------- #> 0 91 100 -9.00 -0.90 #> 1 109 100 9.00 0.90 #> -----------------------------------------------------------------