Tutorials › Stochastic Processes › Upcrossings of a Real-Valued Sequence

Martingale Inequalities and Convergence · Tutorial 751 of 994

Upcrossings of a Real-Valued Sequence

Learn to define and count completed upcrossings of a real-valued sequence, including when its first or last observations lie inside the interval.

Advanced 9 min read

What You'll Learn

  • Define a completed upcrossing using ordered observation indices and closed-interval thresholds.
  • Apply a greedy rule to count upcrossings in a finite sequence.
  • Handle sequences that begin inside or above the interval.
  • Distinguish a completed crossing from an unfinished attempt at the final observation.
  • Check that the greedy count is the maximum number of disjoint lower-to-upper pairs.
  • Avoid overcounting by reusing observations or counting repeated upper-threshold visits.

What Counts as a Completed Upcrossing?

When a real-valued sequence moves around a fixed interval, it may repeatedly go from below the interval to above it. The number of such completed upward passages is a useful way to describe how a sequence oscillates. Counting them requires care: a sequence can start partway through a passage, end partway through one, or visit a threshold more than once. A precise definition settles which observations count and gives a reliable procedure for finite sequences.

Let \((\Omega,\mathcal{F},\mathbb{P})\) be a probability space, and let \((X_n)_{n\ge0}\) be a real-valued sequence of random variables on it. Fix a finite observation horizon \(N\) and real numbers \(a<b\). For each outcome \(\omega\), the observed finite sequence is \(X_0(\omega),\ldots,X_N(\omega)\). The count is defined separately for each such sequence; no assumptions about independence, a Markov property, or a filtration are needed.

Definition: For a finite real sequence \(x_0,\ldots,x_N\) and thresholds \(a<b\), a completed upcrossing of \([a,b]\) is a pair of indices \(s<t\) such that \(x_s\le a\) and \(x_t\ge b\). The completed upcrossing count \(U_N[a,b]\) is the largest number \(k\ge0\) for which there are indices \(s_1<t_1<\cdots<s_k<t_k\) with \(x_{s_r}\le a\) and \(x_{t_r}\ge b\) for every \(r\). The count is zero if no such pair exists.

The ordered indices make the pairs disjoint: an observation used to finish one upcrossing cannot also be used to finish another, and the next lower-threshold observation must occur after the previous upper-threshold observation. Since the interval is closed, equality counts: \(x_s=a\) is a qualifying lower observation and \(x_t=b\) is a qualifying upper observation. The requirement \(a<b\) ensures that one observation cannot satisfy both threshold conditions.

This definition counts completed passages, not partial ones. A sequence that starts with \(x_0>a\) has not yet supplied a lower observation for an upcrossing. Similarly, a sequence that reaches \(x_s\le a\) but has no later observation at least \(b\) has an unfinished attempt, not a completed upcrossing.

A Greedy Counting Rule

To count the upcrossings, scan the observations from left to right. Initially, wait for the first value at most \(a\). After finding one, wait for the first later value at least \(b\); that completes a crossing. Then start waiting for a new lower observation. Repeated upper observations do not count again unless a new lower observation has occurred after the last completed crossing.

Theorem: For any finite sequence \(x_0,\ldots,x_N\) and \(a<b\), the greedy rule gives exactly \(U_N[a,b]\), the maximum number of ordered, disjoint completed upcrossing pairs.

Proof. Let the greedy procedure produce pairs \((s_1,t_1),\ldots,(s_g,t_g)\), in order. Each pair meets the threshold conditions, and after \(t_r\) the procedure waits for a new lower observation before choosing \(s_{r+1}\). Thus \(t_r<s_{r+1}\), so these pairs are admissible in the definition and \(g\le U_N[a,b]\). To show that no admissible collection has more pairs, consider any collection \((u_1,v_1),\ldots,(u_k,v_k)\) with \(u_1<v_1<\cdots<u_k<v_k\), \(x_{u_r}\le a\), and \(x_{v_r}\ge b\). The first greedy lower index \(s_1\) is no later than \(u_1\), since \(u_1\) is itself a qualifying lower index. The greedy upper index \(t_1\) is the first qualifying upper index after \(s_1\); since \(v_1>u_1\ge s_1\), it satisfies \(t_1\le v_1\). Suppose for some \(r<k\) that the greedy procedure has produced its \(r\)-th pair and \(t_r\le v_r\). The next admissible lower index satisfies \(u_{r+1}>v_r\ge t_r\), so it is available after the greedy procedure resumes. Therefore the next greedy lower index satisfies \(s_{r+1}\le u_{r+1}\); its next upper index satisfies \(t_{r+1}\le v_{r+1}\), by the same first-upper argument. By induction, the greedy procedure produces at least \(k\) pairs. This holds for every admissible collection, so \(g\ge U_N[a,b]\). Combining the inequalities gives \(g=U_N[a,b]\). \(\square\)

The earliest available lower and upper observations are convenient, but the theorem says more than that they are easy to find: their number of completed pairs is maximal. This matters when a sequence offers several possible choices of indices. Choosing a later lower observation cannot create extra room for additional completed pairs, because it cannot make the next upper observation occur earlier.

Proposition: The greedy count can be updated one observation at a time. Before reading \(x_n\), keep a status indicating whether the procedure is waiting for a lower observation or is holding one while waiting for an upper observation. If waiting for a lower observation, switch to holding when \(x_n\le a\). If holding, add one to the count and switch back to waiting for a lower observation when \(x_n\ge b\). In all other cases leave the status and count unchanged.

Proof. Start before \(x_0\) in the waiting-for-a-lower-observation status, with count zero. Suppose the status is waiting when \(x_n\) is read. The new observation can start a qualifying pair exactly when \(x_n\le a\); it cannot complete a pair that has not started, and if \(x_n>a\) it does not change the available information. Suppose instead the status is holding a lower observation. The new observation completes the current pair exactly when \(x_n\ge b\). In that case the count increases by one and the procedure waits for a fresh lower observation. If \(x_n<b\), the pair is not yet complete, so the count and status remain unchanged. Because \(a<b\), the two threshold conditions cannot hold at the same observation. These updates implement the greedy rule at every index, and the theorem shows that its final count is \(U_N[a,b]\). \(\square\)

Worked Counts

Worked Example: Starting Inside and Ending with an Unfinished Attempt

Take \(a=1\), \(b=4\), and the finite sequence \(x_0,\ldots,x_8=(2,0,2,4,3,1,4,0,2)\). Count its completed upcrossings and identify any unfinished attempt.

At index \(0\), the value \(2\) is inside the interval, so no lower observation has yet been selected. At index \(1\), the value is \(0\le1\), and the procedure starts holding. The value at index \(2\) is \(2<4\), so the first attempt is still unfinished; at index \(3\), the value \(4\ge4\) completes the first upcrossing, using indices \(1\) and \(3\).

The procedure then waits again. At index \(4\), \(3>1\), so it does not start a new pair. At index \(5\), \(1\le1\), so a second attempt begins. The value \(4\) at index \(6\) completes it. At index \(7\), \(0\le1\) starts a third attempt, but the final value \(2\) at index \(8\) is below \(4\), so this last attempt is unfinished.

Check: The completed pairs are \((1,3)\) and \((5,6)\), so the greedy count is \(2\). Both pairs satisfy the threshold conditions and are ordered with \(3<5\). The attempt starting at index \(7\) has no qualifying upper index after it, so it contributes no completed pair. The sequence starts inside the interval and ends inside it; neither fact changes the count.

Worked Example: Equality at the Thresholds and Repeated Upper Visits

Take \(a=0\), \(b=2\), and \(x_0,\ldots,x_6=(-1,0,2,2,0,1,2)\). Find the count, treating equality at either threshold correctly.

At index \(0\), \(-1\le0\), so the procedure starts holding. At index \(1\), \(0\le0\) as well, but the procedure is already holding; this observation does not create a second simultaneous attempt. At index \(2\), \(2\ge2\), so the first pair completes. The value at index \(3\) is also \(2\), but without a new lower observation after index \(2\), it completes no additional pair.

At index \(4\), the value \(0\) starts a second attempt. Index \(5\) has value \(1<2\), so it does not finish the attempt. Index \(6\) has value \(2\ge2\), completing the second pair.

Check: The pairs \((0,2)\) and \((4,6)\) are admissible, giving count \(2\). The sequence has no lower-threshold observation after index \(4\) and before index \(6\), so there is no way to form a third ordered pair. Both endpoint equalities, \(x_1=a\) and \(x_2=b\), are handled by the inclusive inequalities in the definition.

Worked Example: Beginning Above the Upper Threshold

Take \(a=-1\), \(b=3\), and \(x_0,\ldots,x_7=(4,2,-2,0,3,5,-1,2)\). Determine which values can start or finish a completed upcrossing.

The initial value \(4\ge3\) cannot finish an upcrossing: there has been no earlier lower-threshold observation. The value \(2\) at index \(1\) is neither at most \(-1\) nor at least \(3\). Index \(2\) has value \(-2\le-1\), so it starts an attempt. The value at index \(3\) is \(0<3\), and the value \(3\) at index \(4\) completes the first pair. Index \(5\), with value \(5\), is another upper-threshold visit, but it does not complete a new pair because no new lower observation has occurred after index \(4\).

At index \(6\), the value \(-1\) starts another attempt. The last value, \(2\), is below \(3\), so it does not complete that attempt. The count is therefore \(1\), with a final unfinished attempt.

Check: The pair \((2,4)\) satisfies \(-2\le-1\) and \(3\ge3\). After index \(4\), the only later lower-threshold observation is at index \(6\), and there is no upper-threshold observation after it. Thus no second completed pair is possible. The initial upper value at index \(0\) cannot be paired with any later lower value, because an upcrossing requires the lower observation to come first.

Common Mistakes and Why the Count Is Useful

A common error is to count every visit to the upper threshold as a new completion, or to reuse one observation in multiple pairs. For example, in the sequence \((-1,0,2,2,0,1,2)\) with thresholds \(0\) and \(2\), one might count \((0,2)\), \((1,2)\), and \((4,6)\), obtaining \(3\). This is invalid: the first two proposed pairs both use the upper observation at index \(2\), and their indices are not strictly ordered as required. The correct disjoint pairs are \((0,2)\) and \((4,6)\), so the count is \(2\). The greedy rule prevents this error by resetting only after a completed pair and requiring a new lower observation before another completion.

Another mistake is to treat a start or finish inside the interval as if it were a completed passage. An observation strictly between \(a\) and \(b\) is neither a qualifying lower endpoint nor a qualifying upper endpoint. It may occur during an unfinished attempt, but it does not itself start or finish a pair. Likewise, a sequence that begins at or above \(b\) does not count that initial value as a completion: no qualifying lower observation precedes it within the observed sequence.

Upcrossing counts turn a visual description of oscillation into a precise quantity. For a finite observed path, the count records how many times the path has made a complete move from at most \(a\) to at least \(b\), without reusing observations. In the study of stochastic sequences, this pathwise definition is the basic object used before asking how many upcrossings one should expect or what a bound on that number implies. Those questions require additional probabilistic arguments; the finite-sequence count itself depends only on the observed values and the two thresholds.

Check Your Understanding

Use the definition with ordered, disjoint index pairs. In each question, equality at a threshold counts.

  1. For \(a=0\), \(b=3\), and the sequence \((1,-1,2,3,0,3)\), list the completed pairs and find the count.
  2. For \(a=-2\), \(b=1\), and the sequence \((2,0,-2,0)\), how many completed upcrossings occur? Is there an unfinished attempt?
  3. Explain why an initial value at least \(b\) cannot by itself complete an upcrossing.
  4. In the update rule, what happens when the procedure is already holding a lower observation and the next value is at most \(a\)?
  5. Give the condition on the ordered indices that prevents one observation from being used in two completed pairs.