Test for a Difference in Medians Between Two Groups

Top  Previous  Next

How To... > Create Simulations > Simulation Examples > Test for a Difference in Medians Between Two Groups

_img148

Here we work through a simulation in which scrambling helps us decide whether or not an observed relationship between two attributes is significant.

Suppose we have conducted an experiment in which we drop crumpled-up paper from a certain height above a target. After each drop, we measure the distance of the paper from the target. There are two kinds of paper, copier paper and paper towels, and we are interested in whether there is a difference in the distances they land from the target.

The data are shown here. To work through this example, create this collection (or use a similar collection of your own data).

We’ll use the difference between the two medians, 3.6 in., as our measure of difference. How likely is this value to occur by chance?

1.Define a measure in the OrbEx collection as shown below.

_img469

 

The formula for diffMedians is:

_img470

_img471

2.With the OrbEx collection selected, choose Collection | Scramble Attribute Values.

A new collection, Scrambled OrbEx, is created.

3.Graph distance split by paper for the scrambled collection.

In the scrambled collection’s inspector, notice that the diffMedians measure is defined and that it computes the difference of medians for the two groups.

4.Look at the Scramble panel in the scrambled collection’s inspector. See Scramble Panel

_img472

 

You could have used the pop-up menu to scramble distance instead of paper. (Would it make a difference?)

5.With the scrambled collection selected, choose Collection | Collect Measures.

_img473

 

The results of 100 scramblings are shown. Of the 100 scramblings, 11 have a difference of medians greater than those in the original collection; thus we cannot rule out chance with much confidence.