get_pvalues | R Documentation |
This function calculates p-values based on the comparison of a test statistic against a null distribution. It can perform either empirical or parametric p-value calculations and supports both left-tailed and right-tailed tests.
get_pvalues(
dist,
test_statistic,
parametric = FALSE,
tail = c("left", "right")
)
dist |
Numeric vector. Represents the null distribution of the test statistic. |
test_statistic |
Numeric. The observed test statistic for which the p-value is to be calculated. |
parametric |
Logical. If TRUE, calculates parametric p-values assuming the null distribution is normal. If FALSE, calculates empirical p-values. Default is FALSE. |
tail |
Character. Specifies whether to calculate left-tailed or right-tailed p-values. Must be either "left" or "right". Default is "left". |
Numeric. The calculated p-value.
set.seed(123)
null_dist <- rnorm(1000)
observed_stat <- 1.5
p_value <- get_pvalues(null_dist, observed_stat, parametric = FALSE, tail = "right")
print(p_value)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.