2
$\begingroup$

I have paired data with measurement of time in seconds for unstructured type (variable clean_final_Unstructured_time_ID_only_aggregated_ordered$Time) and structured type (variable clean_final_Structured_time_ID_only_aggregated_ordered$Time).

First I calculate median differences:

(median_Unstructured_agreg <- median(clean_final_Unstructured_time_ID_only_aggregated_ordered$Time))
(median_Structured_agreg <-median(clean_final_Structured_time_ID_only_aggregated_ordered$Time))

median_Unstructured_agreg - median_Structured_agreg

output:

> (median_Unstructured_agreg <- median(clean_final_Unstructured_time_ID_only_aggregated_ordered$Time))
[1] 219
> (median_Structured_agreg <-median(clean_final_Structured_time_ID_only_aggregated_ordered$Time))
[1] 319.5
> 
> median_Unstructured_agreg - median_Structured_agreg
[1] -100.5
> 

After I am conducting "Sign Test for Two-sample Paired Data" (as described here: https://rcompanion.org/handbook/F_07.html)

library(BSDA)

SIGN.test(x = clean_final_Unstructured_time_ID_only_aggregated_ordered$Time,
          y = clean_final_Structured_time_ID_only_aggregated_ordered$Time,
          alternative = "two.sided",
          conf.level = 0.95)

output:

    Dependent-samples Sign-Test

data:  clean_final_Unstructured_time_ID_only_aggregated_ordered$Time and clean_final_Structured_time_ID_only_aggregated_ordered$Time
S = 4, p-value = 0.1185
alternative hypothesis: true median difference is not equal to 0
95 percent confidence interval:
 -224.23839   38.26659
sample estimates:
median of x-y 
          -99 

Achieved and Interpolated Confidence Intervals: 

                  Conf.Level    L.E.pt   U.E.pt
Lower Achieved CI     0.8815 -211.5000 -32.0000
Interpolated CI       0.9500 -224.2384  38.2666
Upper Achieved CI     0.9648 -227.0000  53.5000

As I understand median of x-y from my output is the same as "paired differences" from here: https://statistics.laerd.com/spss-tutorials/sign-test-using-spss-statistics.php and there they interpret that value as I understand difference of medians "The carbohydrate-protein drink elicited a statistically significant median increase in distance run (0.113 km) compared to the carbohydrate-only drink, p = .004."

Question:

  1. Why the difference of two medians that I calculated -100.5 is different from BSDA R package median of x-y value which is -99? I understand that that is not much difference but anyway it is and I want to know why.

  2. Can I present that median differences as effect size?

$\endgroup$

1 Answer 1

1
$\begingroup$
  1. There's an important distinction between what you calculated ($\text{median}(x) - \text{median}(y)$) and what the sign test looks at ($\text{median}(d)$, where $d_i=x_i-y_i$).

    The first thing is a difference of medians. The second thing is the median difference.

    Because taking the median is not a linear operation, it doesn't commute with subtraction (taking the difference) - that is a difference of medians is distinct from a median difference.

  2. Can I present that median differences as effect size?

    You could indeed present the median of the pair-differences as a raw effect size (since that's what the test looks at), but that was not what you calculated; you calculated the difference of the medians. Be careful not to conflate the two.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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