View source: R/MannWhitneyTest.R
MWTest | R Documentation |
Performs the Mann-Whitney U test (Wilcoxon rank-sum) for two independent groups, using a manual implementation. Suitable when the assumptions of parametric tests (normality, homogeneity of variances) are not met.
MWTest(
grupo1,
grupo2,
alpha = 0.05,
alternative = c("two.sided", "less", "greater"),
continuity = TRUE
)
grupo1 |
Numeric vector for the first group. |
grupo2 |
Numeric vector for the second group. |
alpha |
Significance level (default = 0.05). |
alternative |
Character string specifying the alternative hypothesis.
Options are |
continuity |
Logical indicating whether to apply continuity correction (default = TRUE). |
Advantages: - Does not assume normality. - More powerful than t-test for skewed distributions.
Disadvantages: - Only compares two groups at a time. - Sensitive to unequal variances or shapes.
This implementation allows one- or two-sided alternatives and optionally applies a continuity correction.
An object of class "comparacion"
and "mannwhitney"
, containing:
Resultados
: A data frame with the comparison name, difference in means, p-value, and significance.
Promedios
: A named numeric vector of group means.
Orden_Medias
: A character vector of group names ordered from highest to lowest mean.
Metodo
: A string describing the test and hypothesis direction.
Mann, H. B., & Whitney, D. R. (1947). "On a Test of Whether One of Two Random Variables is Stochastically Larger than the Other." Annals of Mathematical Statistics, 18(1), 50–60.
data(d_e, package = "Analitica")
g1 <- d_e$Sueldo_actual[d_e$labor == 1]
g2 <- d_e$Sueldo_actual[d_e$labor == 2]
resultado <- MWTest(g1, g2, alternative = "greater")
summary(resultado)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.