2

I have a total of 18 mice, 9 from Healthy group and 9 from Sick group. Since I have a very poor sample size I would like to use boostrapping or permutation test.

Is there a way to conduct a boostrapped or a permutation wilcoxon rank sum test in R ? thus obtaining a boostrapped p-value or p value from permutation test

For now I just used a classical wilcoxon rank sum :

wilcox_test(DV~ Group,paired = FALSE,data=df)

A tibble: 1 × 7

.y. group1 group2 n1 n2 statistic p

  • <chr> <chr> <chr> <int> <int> <dbl> <dbl>

1 DV G1 G2 9 9 51 0.387


I tried this (boostrapping) :

boot_wilcoxon<- function(formula, data, indices) {
    d <- data[indices,] # allows boot to select sample
    fit <- wilcox_test(formula, data=d)
    return(fit$statistic)
}

library(boot) results <- boot(data=df, statistic=boot_wilcoxon, R=1000, formula=DV~ Group)

to get the p-value:

sum(results$t>results$t0)/1000
[1] 0.406

Does it look ok? (also the boostrapped p value seems closed to the original p-value)

learners
  • 579
  • 6
  • 20

0 Answers0