two_proportion_test | R Documentation |
This function will run a simulation-based hypothesis test for a difference in proportion of successes between two independent groups.
two_proportion_test( formula, data, first_in_subtraction, response_value_numerator, as_extreme_as, direction = c("greater", "less", "two-sided"), number_repetitions = 1, add_normal = FALSE )
formula |
Formula of the form |
data |
Data frame with columns for response and predictor variables. |
first_in_subtraction |
Value of predictor variable that should be first in order of subtraction for computing difference in proportions. |
response_value_numerator |
Value of response that corresponds to "success" when computing proportions. |
as_extreme_as |
Value of observed difference in proportions. |
direction |
Direction of alternative hypothesis.
Allowed values are |
number_repetitions |
Number of simulated samples. |
add_normal |
Logical value indicating whether to superimpose a normal curve on the histogram. Defaults to FALSE. |
Returns plot of distribution of simulated statistics, with values as or more extreme than specified value highlighted, and reports proportion of simulations as or more extreme than specified as subtitle on plot.
data(pt) pt$twoSeconds <- ifelse(pt$responses >= 2, "Yes", "No") two_proportion_test(twoSeconds ~ brand, data = pt, first_in_subtraction = "B1", response_value_numerator = "Yes", as_extreme_as = -.4, direction = "two-sided", number_repetitions = 1000 )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.