Skip to content

Instantly share code, notes, and snippets.

View apcamargo's full-sized avatar
🦖

Antônio Camargo apcamargo

🦖
  • University of São Paulo
  • São Paulo, SP, Brazil
  • X @apcamargo_
View GitHub Profile
@apcamargo
apcamargo / bootstraps_mann_whitney.R
Last active July 11, 2018 02:23
Calculate the Mann-Whitney test statistic in bootstrap samples using Hodges-Lehmann shift estimator
bootstraps_mann_whitney <- function(bootstraps_number, sample_1, sample_2) {
differences <- numeric()
for (i in sample_1) {
for (j in sample_2) {
differences[1 + length(differences)] <- i - j
}
}
bootstraps_statistic <- numeric(bootstraps_number)
hodges_lehmann_estimator <- median(differences)
sample_1_delta <- sample_1 - hodges_lehmann_estimator