1
$\begingroup$

I am comparing the median values of "A" between two conditions? The samples are taken from different groups, for the variable A. How can I test for significance for this median values?

$\endgroup$
  • $\begingroup$ As in height measurements of 67 plants with fertilizer A vs 41 plants with fertilizer B? $\endgroup$ – Dave Jun 5 at 11:48
  • $\begingroup$ en.wikipedia.org/wiki/Median_test? $\endgroup$ – user2974951 Jun 5 at 11:49
  • $\begingroup$ @user2974951 rdrr.io/cran/MultNonParam/man/mood.median.test.html not good enough $\endgroup$ – amarykya_ishtmella Jun 5 at 12:03
  • $\begingroup$ @Dave exactly!! I'm looking at, let's say the height of these plants A and B. $\endgroup$ – amarykya_ishtmella Jun 5 at 12:05
  • $\begingroup$ That Wikipedia article on Mood’s test gives some alternatives and their advantages and disadvantages. Permutation testing or bootstrap confidence intervals could make sense, too. However, why you’re interested in the median matters. Why compare medians? Why not t-test the means? $\endgroup$ – Dave Jun 5 at 12:17
1
$\begingroup$

Mood's median test could be used for this, but if this is not good enough you could try quantile regression, where you can specify exactly which quantile you want. Below is an example in R for some made up data.

library(quantreg)

A=c(1,2,3,4,5,6,6,6,7,8,9,10)
B=c(1,1,1,1,6,6,6,6,6,10,10,10)
df=data.frame(value=c(A,B),
              group=c(rep("A",length(A)),rep("B",length(A))))

summary(rq(value~group,data=df),se="boot")

Call: rq(formula = value ~ group, data = df)

tau: [1] 0.5

Coefficients:
            Value   Std. Error t value Pr(>|t|)
(Intercept) 6.00000 0.81290    7.38100 0.00000 
groupB      0.00000 1.75195    0.00000 1.00000 
Warning message:
In rq.fit.br(x, y, tau = tau, ...) : Solution may be nonunique
| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ The “quantile you want” is the default of tau=0.5. This is what I meant in my comment by bootstrap confidence intervals, too, as I think quantreg’s default confidence intervals are calculated via bootstrap. $\endgroup$ – Dave Jun 5 at 12:20
  • $\begingroup$ @Dave thank you so much.!! $\endgroup$ – amarykya_ishtmella Jun 8 at 6:25
  • $\begingroup$ @user2974951 this worked pefectly :) Thank you $\endgroup$ – amarykya_ishtmella Jun 8 at 6:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.