View source: R/calc_binomial_test.R
calc_binomial_test | R Documentation |
Perform a Binomial Test Using a Categorical Variable
calc_binomial_test(
data,
var,
success_value = NULL,
p_null = 0.5,
alternative = c("two.sided", "less", "greater"),
conf_level = 0.95
)
data |
A tibble or data frame containing the data. |
var |
The categorical variable to test. |
success_value |
(Optional) The value considered as "success" in the binomial test. |
p_null |
The hypothesized probability of success under the null hypothesis (default = 0.5). |
alternative |
The alternative hypothesis: "two.sided", "less", or "greater". |
conf_level |
The confidence level for the interval (default = 0.95). |
A tibble containing the binomial test results, including:
x
: Number of successes.
n
: Total trials.
estimate
: Observed success proportion.
lower_ci
: Lower confidence interval.
upper_ci
: Upper confidence interval.
p_value
: p-value for the test.
p_null
: Null hypothesis proportion.
success_value
: The value considered as success.
library(tibble)
mice_data <- tibble(
mouse_id = 1:160,
sex = c(rep("Male", 95), rep("Female", 65)),
cancer_status = rep("Cancer", 160)
)
calc_binomial_test(data = mice_data, var = sex)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.