A sequence X1,X2,…,Xn is a c-alternating sequence if any odd term is less than or equal to the next even term -c and the any even term is greater than or equal to the next odd term +c, where c is a nonnegative constant. In this paper, we present an optimal on-line procedure to select a c-alternating subsequence from a symmetric distributed random sample. We also give the optimal selection rate when the sample size goes to infinity.
1. Introduction
Given a finite (or infinite) sequence x={x1,x2,…,xn,…} of real numbers, we say that a subsequence xi1,xi2,…,xik,… with 1≤i1<i2<⋯<ik<⋯ is c-alternating if we have xi1+c<xi2>xi3+c<xi4⋯, where c is a nonnegative real number. When c=0, xi1,xi2,…,xik,… is alternating. We are mainly concerned with the length α(x) of the longest c-alternating subsequence of x. Here, we study the problem of making on-line selection of a c-alternating subsequence. That is now we regard the sequence x1,x2,… as being available to us sequentially, and, at time i when xi is available, we must choose to include xi as a term of our subsequence or reject xi as a member of our subsequence.
We will consider the sequence to be given by independent, identically distributed, symmetric random variables over the interval [0,1]. In [1], Arlotto et al. studied the case that the sequence to be given by independent, identically distributed, uniform random variables over the interval [0,1] and c=0. So this paper can be considered as an extension of their paper.
Now we need to be more explicit about the set II of feasible strategies for on-line selection. At time i, when Xi is presented to us, we must decide to select Xi based on its value, the value of earlier members of the sequence, and the actions we have taken in the past. All of this information can be captured by saying that ik, the index of the kth selection, must be a stopping time with respect to the increasing sequence of σ-fields, Fi=σ{X1,X2,…,Xi}, i=1,2,…. Given any feasible policy π in II the random variable of most interest here is Ano(π), the number of selections made by the policy π up to and including time n. In other words, Ano(π) is equal to the largest k for which there are stopping times 1≤i1<i2<⋯<ik≤n such that {Xi1,Xi2,…,Xik} is a c-alternating subsequence of the sequence {X1,X2,…,Xn}. In this paper, we are interested in the optimal selection and the asymptotic rate of the optimal selection. That is, we have a selection policy πn* in II such that
(1)limn→∞E[Ano(πn*)]=limn→∞supπ∈IIE[Ano(π)].
2. Main Results
For each 0≤c<1 and each 0≤λ≤(1-c)/2, we define a threshold function f* as follows: f*(y)=max{c+λ,c+y} for all 0≤y≤1-c. We now recursively define random variables {Yi:i=1,2,…} by setting Y0=y and taking Yi=Yi-1 if Xi<f*(Yi-1), Yi=1-Xi if Xi≥f*(Yi-1). Introduce a value function V(λ,y,ρ)=E{∑i=1∞ρi-1I[Xi≥f*(Yi-1)]∣Y0=y}, where 0<ρ<1 is a constant and I[Xi≥f*(Yi-1)] is the indicator function of the event [Xi≥f*(Yi-1)].
Let G be the distribution function and g the probability density function of Xi. If Xi is not a uniform random variable over the interval [0,1], then we will assume that g′ exists and is nonzero. Since Xi is symmetric over the interval [0,1], G(1-x)=1-G(x) and g(x)=g(1-x) for all 0≤x≤1.
It is easy to see that
(2)V(λ,y,ρ)=ρG[max(λ,y)+c]V(λ,y,ρ)+∫max(λ,y)+c1[1+ρV(λ,1-x,ρ)]g(x)dx=ρG[max(λ,y)+c]V(λ,y,ρ)+∫01-max(λ,y)-c[1+ρV(λ,x,ρ)]g(x)dx
since g(x)=g(1-x) for all 0≤x≤1. For simplicity, we will let V(y) denote V(λ,y,ρ) for fixed λ and ρ. It is easy to check that for all 0≤y≤λ, V(y)=ρG(λ+c)V(y)+∫01-λ-c[1+ρV(x)]g(x)dx, for all λ<y≤1-c, V(y)=ρG(y+c)V(y)+∫01-y-c[1+ρV(x)]g(x)dx, and for all 1-c<y≤1, V(y)=0. Since for all 0≤y≤λ, V(y)=V(λ), V(y)=ρG(y+c)V(y)+[1+ρV(λ)]G(1-y-c) for all 1-λ-c≤y≤1-c. Since G(1-y-c)=1-G(y+c), V(y)=ρG(y+c)V(y)+[1+ρV(λ)][1-G(y+c)] for all 1-λ-c≤y≤1-c. From now on, we will let V′(λ) denote the right derivative of the function V at λ and V′(1-c) denote the left derivative of the function V at 1-c.
For λ<y<1-c, when we differentiate V(y) we have the following differential equation:
(3)V′(y){1-ρG(y+c)}=ρg(y+c)V(y)-[1+ρV(1-y-c)]g(1-y-c).
Since g(1-y-c)=g(y+c) and g(1-y)=g(y). Now we have the following differential equations:
(4)V′(y){1-ρG(y+c)}=ρg(y+c)V(y)-[1+ρV(1-y-c)]g(y+c)=g(y+c){ρ[V(y)-V(1-y-c)]-1},(5)V′(1-y-c){1-ρG(1-y)}=ρg(y)V(1-y-c)-[1+ρV(y)]g(y)=g(y){ρ[V(1-y-c)-V(y)]-1}.
Add (3) and (4) together, we have
(6)V′(1-y-c)1-ρG(1-y)g(y)=-V′(y)1-ρG(y+c)g(y+c)-2.
In summary, we have the following equations:
(7)V(1-λ-c)[1-ρ+ρG(λ)]=[1+ρV(λ)]G(λ),V′(λ)[1-ρG(λ+c)]=g(λ+c){ρ[V(λ)-V(1-λ-c)]-1},V′(1-λ-c)[1-ρ+ρG(λ)]=g(λ){ρ[V(1-λ-c)-V(λ)]-1}.
For all λ≤y≤1-c, let us define
(8)h(y)=[1-ρG(y+c)]2(1-ρ+ρG(y))g(y+c).
Then we have the following equation:
(9)V′(1-λ-c)=V′(λ)h(λ)h(1-λ-c)-2ρh(1-λ-c)∫λ1-λ-c(1-ρ+ρG(x-c))g(x)dx.
Proof of (<xref ref-type="disp-formula" rid="EEq8">9</xref>).
Differentiate (4). Again, we have
(10)V′′(y)[1-ρG(y+c)]=ρg(y+c)[2V′(y)+V′(1-y-c)]+g′(y+c){ρ[V(y)-V(1-y-c)]-1}.
Replace ρ[V(y)-V(1-y-c)]-1 by V′(y)((1-ρG(y+c))/g(y+c)) and replace V′(1-y-c) by {-2-V′(y)((1-ρG(y+c))/g(y+c))}{g(y)/(1-ρ+ρG(y))}. And after the simplification, we have the following equation:
(11)V′′(y)[1-ρG(y+c)]=ρg(y+c)-2g(y)1-ρ+ρG(y)+V′(y)×{g′(y+c)1-ρG(y+c)g(y+c)+ρg(y+c)[2-g(y)[1-ρG(y+c)]g(y+c)[1-ρ+ρG(y)]]}+ρg(y+c).
Multiplying both sides of (11) by [1-ρ+ρG(y)][1-ρG(y+c)]/g(y+c), we obtain the following equation:
(12)V′′(y)[1-ρG(y+c)]2[1-ρ+ρG(y)]g(y+c)=-2ρg(y)[1-ρG(y+c)]+V′(y)g′(y+c)[1-ρG(y+c)g(y+c)]2[1-ρ+ρG(y)]+V′(y)ρg(y+c){2[1-ρ+ρG(y)][1-ρG(y+c)]g′(y+c)V′(y)ρg(y+c)-g(y)[1-ρG(y+c)g(y+c)]2}.
Notice that
(13)-h′(y)=g′(y+c)[1-ρG(y+c)g(y+c)]2[1-ρ+ρG(y)]+ρg(y+c){2[1-ρ+ρG(y)][1-ρG(y+c)]g′(y+c)ρg(y+c)-g(y)[1-ρG(y+c)g(y+c)]2}.
Equation (12) can be rewritten as
(14)V′′(y)h(y)+V′(y)h′(y)=-2ρ[1-ρG(y+c)]g(y).
By integrating both sides of (14), we have
(15)V′(y)=V′(λ)h(λ)h(y)-2ρh(y)∫λy[1-ρG(z+c)]g(z)dz.
Now we have four unknown variables V(λ), V(1-λ-c), and V′(λ), V′(1-λ-c) and also have four linear equations involving these four unknown variables. We solve these four linear equations and obtain the following solutions.
By Theorem 2, V′(λ)=0 if and only if
(18)ρ∫λ+c1-λ[1-ρ+ρG(x-c)]g(x)dx=[1-ρG(λ+c)][1-ρ+ρG(λ)]since g(λ+c) and [1-ρG(λ+c)]2[1-ρ+ρG(λ)] are positive. For each 0<ρ<1, let λ(ρ) denote a solution of V′(λ)=0. The next theorem indicates that when ρ<1 but close enough to 1, λ(ρ) is unique and 0≤λ(ρ)<(1-c)/2.
Theorem 3.
When ρ<1 but close enough to 1, λ(ρ) is unique and 0≤λ(ρ)<(1-c)/2.
Proof.
For all 0≤λ<(1-c)/2, let
(19)K(λ)=ρ∫λ+c1-λ[1-ρ+ρG(x-c)]g(x)dx-[1-ρG(λ+c)][1-ρ+ρG(λ)].
Then
(20)K′(λ)=-ρ{g(1-λ)[1-ρ+ρG(1-λ-c)]-ρ+g(λ)[1-ρG(λ+c)]}<0,K(1-c2)=-[1-ρ+ρG(1-c2)][1-ρG(1+c2)]<0,K(0)=ρ2∫c1G(x-c)g(x)dx-(1-ρ)2>0
if ρ is close enough to 1. Therefore, 0≤λ(ρ)<(1-c)/2 and λ(ρ) is unique if ρ is close enough to 1. This completes the proof of Theorem 3.
A routine calculation is as follows:
(21)V′′(λ(ρ))=-2ρg(λ(ρ))g(λ(ρ)+c)[1-ρ+ρG(λ(ρ))][1-ρG(λ(ρ)+c)]<0.
So we have found the maximum of the function V. After the simplification,
(22)V(λ(ρ),λ(ρ),ρ)=1-ρ+2ρG(λ(ρ))ρ(1-ρ)
if ρ is close enough to 1. Therefore, (1-ρ)V(λ(ρ),λ(ρ),ρ)→2G(λ(1)) as ρ↑1, where
(23)∫λ(1)+c1-λ(1)G(x-c)g(x)dx=G(λ(1))[1-G(λ(1)+c)].
Example 4.
When c=0, then 2G(λ(1))=2-2.
Example 5.
When G(x)=x for all 0≤x≤1, then 2G(λ(1))=(1-c)(2-2).
In [1], the following two strategies are mentioned:
the maximally timid strategy which can be described as follows: at the start, accept the first observation which is less than 1/2, then accept the next one which is greater than 1/2, then accept the next one which is less than 1/2. Continue this way until we observe n observations, then we stop;
the purely greedy strategy which can be described as follows: at the start, accept the first observation, then accept the next one which is greater than the first one, accept the next one which is less than the second selected one, then accept the next one which is greater than the third selected one. Continue this way until we observe n observations, then we stop.
Now we define these two strategies for the c-alternating subsequence as follows:
the maximally c-timid strategy which can be described as follows: at the start, accept the first observation which is less than (1-c)/2, accept the next one which is greater than (1+c)/2, accept the next one which is less than (1-c)/2, then accept the next one which is greater than (1+c)/2. Continue this way until we observe n observations, then we stop;
the purely c-greedy strategy which can be described as follows: at the start, accept the first observation which is less than 1-c, accept the next one which is greater than the first selected one +c, accept the next one which is less than the second selected one -c, then accept the next one which is greater than the third selected one +c. Continue this way until we observe n observations, then we stop.
When c=0, the maximally c-timid strategy is the maximally timid strategy and the purely c-greedy strategy is the purely greedy strategy. In fact, the maximally c-timid strategy is the case when λ=(1-c)/2 and the purely c-greedy strategy is the case when λ=0.
The asymptotic selection rate for the maximally c-timid strategy is G((1-c)/2) and the asymptotic selection rate for the purely c-greedy strategy is ∫01-cG(x)g(x+c)dx/(1-G(c)).
Example 6.
When c=0, then the asymptotic selection rate for both the maximally timid strategy and the purely greedy strategy is 1/2. These results are the same as those in [1].
Example 7.
When G(x)=x for all 0≤x≤1, then the asymptotic selection rate for both the maximally c-timid strategy and the purely c-greedy strategy is (1/2)(1-c). It is easy to see these results are consistent with the result of Example 5.
If the random variables X1,X2,…,Xn are independent, identically distributed symmetric random variables over the interval [a,b], where a<b and a,b are finite, then we can change Xi into Zi by Zi=(Xi-a)/(b-a). Then Z1,Z2,…,Zn are independent, identically distributed symmetric random variables over the interval [0,1]. Let c′=c/(b-a). Then selecting a c-alternating subsequence from the random sample X1,X2,…,Xn is exactly the same to select a c′-alternating subsequence from the random sample Z1,Z2,…,Zn. So the asymptotic selection rate is still the same. Or we can find λ(1) directly by solving the following equation:
(24)∫a+λ(1)+cb-a-λ(1)G(x-c)g(x)dx=G(a+λ(1))[1-G(a+λ(1)+c)].
For 0≤c≤(b-a), a≤y≤(b-c), and a≤λ<a+(b-a-c)/2 the threshold function f* is defined by f*(y)=max(λ,y)+c for all a≤y≤(b-c). This time, we recursively define random variables {Yi:i=1,2,…} by setting Y0=y and taking Yi=Yi-1 if Xi<f*(Yi-1), Yi=b-Xi if Xi≥f*(Yi-1). Here a≤y≤(b-c),
(25)G1(x)={2x(1-x)if0≤x≤12,1-2x+2x2if12<x≤1,G2(x)=2πsin-1(x),G3(x)=x,G4(x)=3x2-2x3,G5(x)={2x2if0≤x≤12,-2x2+4x-1if12<x≤1.
From Table 1, it seems that when the distribution has higher chances on the tails, then the asymptotic optimal selection rate is higher. On the other hand, when the distribution has higher chance near the center, then the asymptotic optimal selection rate is lower. However, we do not have a proof for this statement.
The asymptotic optimal selection rates for various distributions and c.
c
G1(x)
G2(x)
G3(x)
G4(x)
G5(x)
0.0
2-2
2-2
2-2
2-2
2-2
0.1
0.540492
0.545962
0.527208
0.499942
0.481120
0.2
0.509190
0.506516
0.468629
0.414948
0.380891
0.3
0.489881
0.466834
0.410051
0.332852
0.291619
0.4
0.466034
0.426295
0.351472
0.255622
0.214252
0.5
0.424335
0.384147
0.292893
0.185176
0.148786
0.6
0.366680
0.339473
0.234315
0.123399
0.095223
0.7
0.294696
0.290641
0.175736
0.072153
0.053563
0.8
0.209273
0.234738
0.117157
0.033284
0.023806
0.9
0.110936
0.164273
0.058579
0.008624
0.005952
1.0
0
0
0
0
0
We are now considering the case when X1,X2,…,Xn have an arbitrary distribution. We have made some progress, but it is still in the premature state. We hope to be able to find the asymptotic optimal selection rate in a forth coming paper.
ArlottoA.ChenR. W.SheppL. A.SteeleJ. M.Online selection of alternating subsequences from a random sample