title: Wilcoxon tests as linear models in R
body: <p>I found some suggestions throughout the web that suggest that most common statistical tests can be performed using general(ized) linear models (cf. <a href="https://lindeloev.github.io/tests-as-linear/#51_independent_t-test_and_mann-whitney_u" rel="nofollow noreferrer">here</a>). The author suggests to first transform the data into signed ranks (as the wilcoxon test does) and then perform a linear model:</p>
  <pre><code>signed_rank = function(x) sign(x) * rank(abs(x))
  
  # one-sample test
  summary(lm(signed_rank(y) ~ 1))
  
  # two-sample test
  summary(lm(signed_rank(z - y) ~ 1)
  </code></pre>
  <p>However, due to this rank transformation, the residuals of the linear models are then of course no longer normal. Thus, this general assumption of linear models is not fulfilled. Thus, I wonder whether you can suggest an GLM (generalized linear model) alternative. How would the code look like in R?</p>
  <p>Thank a lot for your help in advance!</p>