BMTest: Brunner-Munzel Test for Two Independent Samples

View source: R/BrunnerMunzelTest.R

BMTestR Documentation

Brunner-Munzel Test for Two Independent Samples

Description

Performs the Brunner-Munzel nonparametric test for two independent groups, which estimates the probability that a randomly selected value from one group is less than a randomly selected value from the other group.

Usage

BMTest(
  grupo1,
  grupo2,
  alpha = 0.05,
  alternative = c("two.sided", "less", "greater")
)

Arguments

grupo1

Numeric vector of values from group 1.

grupo2

Numeric vector of values from group 2.

alpha

Significance level (default = 0.05).

alternative

Character string specifying the alternative hypothesis. One of "two.sided" (default), "greater", or "less".

Details

This test is suitable when group variances are unequal and/or sample sizes differ. It does not assume equal variances and is often used as a more robust alternative to the Wilcoxon test.

Advantages: - Handles unequal variances and non-normality. - Recommended when variance homogeneity is questionable.

Disadvantages: - Less well-known and supported. - Requires large sample sizes for accurate inference.

Value

An object of class "comparacion" and "brunnermunzel", containing:

  • Resultados: A data frame with test statistics, p-value, and estimated effect size.

  • Promedios: A named numeric vector of group means.

  • Orden_Medias: Group names ordered by their mean values (descending).

  • Metodo: A character string describing the test and hypothesis.

  • p_hat: Estimated probability that a value from grupo1 is less than a value from grupo2 (plus 0.5 * ties).

References

Brunner, E., & Munzel, U. (2000). "The nonparametric Behrens-Fisher problem: Asymptotic theory and a small-sample approximation." Biometrical Journal, 42(1), 17–25. <https://doi.org/10.1002/(SICI)1521-4036(200001)42:1

Examples

data(d_e, package = "Analitica")
g1 <- d_e$Sueldo_actual[d_e$labor == 1]
g2 <- d_e$Sueldo_actual[d_e$labor == 2]
resultado <- BMTest(g1, g2, alternative = "greater")
summary(resultado)


Analitica documentation built on June 14, 2025, 9:07 a.m.