title: Bootstrapped standard errors and p-value from weighted mann-whitney test
body: <p>I would like to bootstrap the p-value and standard errors from weighted Mann-Whitney U test.</p>
  <p>I can run the test as: <em>weighted_mannwhitney(c12hour ~ c161sex + weight, efc)</em> which works fine, but am not entirely sure how I can run a bootstrapped version of the same to obtain a bootstrapped p-value for instance.</p>
  <pre><code>library(sjstats) # weighted Mann-Whitney
  library(tidyverse) # main workflow, which has purrr and forcats (IIRC)
  # library(broom) # for tidying model output, but not directly loaded
  library(modelr) # for bootstrap
  
  
  data(efc)
  efc$weight &lt;- abs(rnorm(nrow(efc), 1, .3))
  
  # weighted Mann-Whitney-U-test ----
  weighted_mannwhitney(c12hour ~ c161sex + weight, efc)
  
  
  # Bootstrapping
  
  set.seed(1000) # for reproducibility
  
  boot_efc &lt;- efc %&gt;% bootstrap(1000) 
  
  
  # Throws error!
  boot_efc %&gt;% 
    dplyr::mutate(c12hour = map(strap, ~weighted_mannwhitney(c12hour ~ c161sex + weight, data = .)),
                  tidy = map(c12hour, broom::tidy)) -&gt; boot_efc_out
  </code></pre>
  <p><strong>SIDE NOTE:</strong> The package for the weighted Mann-Whitney test has its own bootstrap function which can be used as shown below to obtain <strong>bootstrapped standard error</strong> and <strong>bootstrapped p-value</strong>, but this is running a different function (mean), I could not adapt that for the weighted Mann-Whitney. Not sure if this helps</p>
  <pre><code># or as tidyverse-approach
  if (require(&quot;dplyr&quot;) &amp;&amp; require(&quot;purrr&quot;)) {
    bs &lt;- efc %&gt;%
      bootstrap(100) %&gt;%
      mutate(
        c12hour = map_dbl(strap, ~mean(as.data.frame(.x)$c12hour, na.rm = TRUE))
      )
  
    # bootstrapped standard error
    boot_se(bs, c12hour)
  
      # bootstrapped p-value
    boot_p(bs, c12hour)
  }
  </code></pre>