Tutorials › VEE Mathematical Statistics › Turning Observations Into Signs

VEE Mathematical Statistics · Sign and Wilcoxon Tests · Tutorial 833 of 880

Turning Observations Into Signs

Convert observations and paired changes into signs relative to a target median, treating zero differences correctly.

Intermediate 10 min read

What You'll Learn

  • Define one-sample differences relative to a hypothesized median.
  • Define paired changes using a stated subtraction order and compare them with a target change.
  • Assign positive, negative, and zero signs consistently.
  • Exclude zero differences when calculating the effective sample size.
  • Calculate and check the positive and negative sign counts.
  • Avoid confusing a comparison with zero with a comparison to the hypothesized value.

Why Signs Begin With a Comparison

A sign procedure reduces numerical observations to their direction relative to a reference value. That makes it essential to identify the reference before counting anything. If the question concerns whether a population median differs from a proposed value, the relevant signs come from comparing each observation with that proposed median—not merely from checking whether the observation itself is positive or negative.

For paired data, the first step is to calculate a change using a clearly stated order, such as after minus before. The signs are then assigned by comparing each change with the hypothesized median change. A change equal to the target has sign zero and does not contribute to either directional count.

Definition: For one-sample observations \(X_1,\ldots,X_n\) and hypothesized median \(m_0\), define the difference \(D_i=X_i-m_0\). Observation \(i\) has a positive sign if \(D_i>0\), a negative sign if \(D_i<0\), and a zero difference if \(D_i=0\). Let \(S_+\) be the number of positive signs, \(S_-\) the number of negative signs, and \(n^*=S_++S_-\) the number of nonzero differences.

The sign records direction, not magnitude. For example, differences of \(1\) and \(100\) both contribute one positive sign. The procedure deliberately discards the size of each nonzero difference; its input is whether the observation lies above, below, or exactly at the hypothesized median.

One-Sample Signs Relative to a Hypothesized Median

Suppose a study records \(n\) observations and asks about a specified median \(m_0\). For each observation, subtract \(m_0\), or equivalently compare the observation directly with \(m_0\). Do not compare with zero unless zero is itself the hypothesized median. Once every sign has been assigned, count the positive signs, negative signs, and zeros separately.

The number of observations used in the sign calculation is the effective sample size \(n^*\), not necessarily the original sample size \(n\). Observations exactly equal to the target have no direction relative to it, so they contribute to neither \(S_+\) nor \(S_-\).

$$ S_+=\sum_{i=1}^{n} I(X_i>m_0),\qquad S_-=\sum_{i=1}^{n} I(X_i<m_0),\qquad n^*=S_++S_-=n-\#\{i:X_i=m_0\}. $$

Here \(I(A)\) equals \(1\) when statement \(A\) is true and \(0\) otherwise. Each observation either lies above the target, below it, or equals it. These three possibilities are mutually exclusive and exhaustive, so the following identity is a useful arithmetic check.

$$ S_+ + S_- + \#\{i:X_i=m_0\}=n. $$

Worked Example: A One-Sample Target Median

A hypothetical quality review records the completion times, in minutes, for 11 independent service requests: \(47, 53, 50, 62, 49, 55, 50, 44, 58, 51, 46\). Form the signs relative to the hypothesized median \(m_0=50\). Report \(S_+\), \(S_-\), the number of zeros, and \(n^*\).

Method. Compare each time with 50. The task is to record its position relative to the target; the raw time being positive does not make its sign positive.

The observations above 50 are \(53,62,55,58,51\). They produce five positive signs.

The observations below 50 are \(47,49,44,46\). They produce four negative signs.

The observations equal to 50 are \(50,50\). There are two zero differences.

Therefore \(S_+=5\), \(S_-=4\), and \(n^*=5+4=9\). The check is \(5+4+2=11\), which matches the original number of requests.

Common mistake avoided: Counting all 11 observations as positive because all recorded times are greater than zero would answer a different question. The signs are relative to 50, not relative to zero.

Paired Signs and the Direction of Change

For paired observations, calculate one difference for each pair. The subtraction order determines what a positive change means, so state it before assigning signs. For example, if \(D_i=\text{after}_i-\text{before}_i\), then a positive \(D_i\) means the measured quantity increased after the intervention. If the proposed median change is \(\Delta_0\), compare each calculated \(D_i\) with \(\Delta_0\). The sign is the sign of \(D_i-\Delta_0\), not necessarily the sign of \(D_i\).

Definition: For \(n\) pairs, let \(D_i\) be the change for pair \(i\), calculated in the stated order, and let \(\Delta_0\) be the hypothesized median change. The paired sign is positive when \(D_i>\Delta_0\), negative when \(D_i<\Delta_0\), and zero when \(D_i=\Delta_0\). The counts are \(S_+\) and \(S_-\), and the effective sample size is \(n^*=S_++S_-\).

This paired construction turns each pair into one change and then treats those changes as the observations to be compared with the target. It does not treat the two measurements in a pair as separate signs. When the target change is zero, a positive sign means an increase under the chosen subtraction order; with a nonzero target, a positive sign instead means a change greater than that target.

Worked Example: Paired Changes Compared With a Nonzero Target

For 10 hypothetical paired measurements, the changes, defined as after minus before, are \(4,6,3,5,4,7,2,4,5,3\). Form the signs relative to a target median change of \(\Delta_0=4\). Report the sign sequence, \(S_+\), \(S_-\), the number of zeros, and \(n^*\).

Method. Compare every change with 4. A change of 5 is positive relative to the target, a change of 3 is negative, and a change of 4 is zero. Comparing the changes with zero instead would not answer the question.

In the given order, the comparisons are:

$$ 4-4=0,\quad 6-4=2,\quad 3-4=-1,\quad 5-4=1,\quad 4-4=0,\quad 7-4=3,\quad 2-4=-2,\quad 4-4=0,\quad 5-4=1,\quad 3-4=-1. $$

Thus the signs are \(0,+,-,+,0,+,-,0,+,-\). There are four positive signs, from changes \(6,5,7,5\), and three negative signs, from changes \(3,2,3\). Three changes equal the target and therefore have zero signs.

The results are \(S_+=4\), \(S_-=3\), and \(n^*=4+3=7\). The check is \(4+3+3=10\), the original number of pairs.

Common mistake avoided: The changes \(4,6,3,5,4,7,2,4,5,3\) are not being compared with zero. For instance, a change of 3 is positive as a raw number but negative relative to the target change of 4.

Worked Example: Calculate Paired Changes Before Signing

A hypothetical study records a measurement before and after a procedure for eight participants. The before values are \(12,10,15,8,11,9,14,13\), and the after values are \(15,11,19,10,11,14,15,15\). Define change as after minus before. Form signs relative to a target median change of \(\Delta_0=2\), then report the counts and effective sample size.

Step 1: Calculate each paired change. Subtract the before value from the after value within each pair:

$$ D_i=(15-12,\ 11-10,\ 19-15,\ 10-8,\ 11-11,\ 14-9,\ 15-14,\ 15-13) =(3,1,4,2,0,5,1,2). $$

Step 2: Compare each change with 2. The differences from the target are \(D_i-2=(1,-1,2,0,-2,3,-1,0)\), so the sign sequence is \(+,-,+,0,-,+,-,0\).

Step 3: Count and check. There are three positive signs and three negative signs. Two changes equal 2, so there are two zero differences. Thus \(S_+=3\), \(S_-=3\), and \(n^*=3+3=6\). The check \(3+3+2=8\) agrees with the number of pairs.

Common mistake avoided: The fifth participant has a change of zero, but the zero sign in this example applies to changes equal to the target of 2. The fifth participant's change of 0 is actually below 2, so it has a negative sign. The zero signs belong to the fourth and eighth participants, whose changes are both 2.

What the Sign Counts Do—and Do Not—Establish

The counts \(S_+\) and \(S_-\) summarize how many nonzero differences fall on either side of the reference value. The sign sequence preserves the order of observations if that is useful for checking the work, while the counts provide the basic numerical summary. Neither count retains the magnitude of a difference: a value just above the target contributes the same one positive sign as a value far above it.

The sign construction itself is a data transformation. To use the counts for a formal test, an inferential null model and its assumptions are also needed. In the standard continuous one-sample setting, a null median \(m_0\) implies equal probabilities of falling above and below \(m_0\). If the distribution has a point mass at \(m_0\), the treatment of ties and the assumptions supporting the null calculation require care. Forming the signs correctly does not, by itself, establish that a particular null distribution applies.

For paired data, the corresponding signs are based on the paired changes and their hypothesized median \(\Delta_0\). The pairs must be matched as described, and the subtraction order must be consistent. These requirements ensure that a positive sign has the same interpretation across all pairs.

Common Errors to Avoid

  • Using zero as the reference automatically. Compare \(X_i\) with \(m_0\), or \(D_i\) with \(\Delta_0\). Zero is the reference only when it is the stated target.
  • Signing the raw paired measurements. First calculate one change per pair in the stated order; then compare each change with the target change.
  • Counting target matches as positive or negative. An observation equal to the hypothesized value has a zero difference and contributes to neither sign count.
  • Using the original sample size after removing zeros. The effective sample size is \(n^*=S_++S_-\), not the number of observations before zero differences are excluded.
  • Reversing the paired subtraction order midway. If change is defined as after minus before, use that order for every pair. Reversing it changes the interpretation of every nonzero sign.
  • Confusing direction with size. Sign counts use only whether a difference is positive, negative, or zero relative to the target; they do not measure how large the difference is.
Key takeaway: State the reference value and, for paired data, the subtraction order. Compare every observation or change with that reference, count positive and negative signs separately, remove zero differences from the effective sample size, and verify that the three categories add to the original total.

Check Your Understanding

For each problem, form signs only after identifying the stated reference value. Check that the positive, negative, and zero counts sum to the original sample or pair count.

  1. A one-sample data set is \(18,20,17,22,20,19\), with hypothesized median \(m_0=20\). Give the sign sequence, \(S_+\), \(S_-\), the number of zeros, and \(n^*\). (Answer: signs \(-,0,-,+,0,-\); \(S_+=1,\ S_-=3\), 2 zeros, \(n^*=4\).)
  2. For observations \(4,8,6,3,6,10,5\), form signs relative to \(m_0=6\) and report the counts and effective sample size. (Answer: signs \(-,+,0,-,0,+,-\); \(S_+=2,\ S_-=3\), 2 zeros, \(n^*=5\).)
  3. Five paired measurements have before values \(20,15,18,22,17\) and after values \(23,14,20,22,21\). Define change as after minus before and use target change \(\Delta_0=2\). Report the sign sequence, sign counts, number of zeros, and \(n^*\). (Answer: changes \(3,-1,2,0,4\); signs \(+,-,0,-,+\); \(S_+=2,\ S_-=2\), 1 zero, \(n^*=4\).)
  4. Seven paired changes, defined as after minus before, are \(-3,-1,0,2,1,-2,3\). Compare them with target change \(\Delta_0=0\). Report \(S_+\), \(S_-\), the number of zeros, and \(n^*\). (Answer: signs \(-,-,0,+,+,-,+\); \(S_+=3,\ S_-=3\), 1 zero, \(n^*=6\).)
  5. A one-sample set is \(6,9,7,11,8,9,5,12,9\), with hypothesized median \(m_0=8\). Give the sign sequence and all counts, including the effective sample size. (Answer: signs \(-,+,-,+,0,+,-,+,+\); \(S_+=5,\ S_-=3\), 1 zero, \(n^*=8\).)
Clinical Biostats