5
$\begingroup$

Imagine we define $Y(t+n)= X(t+1)+.....+X(t+n)$ where $X(i)$ is an independent normal (i.e. everyday we remove the starting observation and we add a new one). We have $n$ consecutive observations of $Ys$. I am trying to find the expected number of changes in the sign in the sequence of $Ys$ as a function of $n$.

Thanks

$\endgroup$

2 Answers 2

3
$\begingroup$

I'm assuming that $n$ is fixed, so that $Y(t)$ is the sum of the previous $n$ observations. You didn't say what the mean and variance of the random variables $X$ was, so for now, I will assume that they are general: $\mu$ and $\sigma^2$. Now your question boils down (by the strong law of large numbers, or by the ergodic theorem) to computing the probability that $Y(t)$ and $Y(t-1)$ have opposite signs. In fact, there are (in the long run) the same number of switches from negative to positive as from positive to negative, so it suffices to compute $\mathbb P(Y(t)>0, Y(t-1)<0)$. Now $Y(t)$ and $Y(t-1)$ are themselves normal random variables with means $n\mu$ and variance $n\sigma^2$. The covariance is $(n-1)\sigma^2$. Now $(Y(t-1),Y(t))$ has a multivariate normal distribution. If $U\sim N(n\mu,(n-\frac 12)\sigma^2)$ and $V\sim N(0,\frac 12\sigma^2)$ are independent normal random variables, then it is easy to see that $(U-V,U+V)$ has the same mean and covariance matrix as $(Y(t-1),Y(t))$. Hence, since they are both multivariate normal distributions, they have the same distribution.

Now it suffices to compute $\mathbb P(U-V<0<U+V)$. That is $\mathbb P(V>|U|)=2\mathbb P(V>U>0)$.

At this point, I'll make the assumption that you probably intended $\mu=0$. By scaling the random variables, you can also assume that $\sigma=\sqrt 2$. Now $V\sim N(0,1)$ and $U\sim N(0,2n-1)$. Let's write $U=\sqrt{2n-1}N'$, so that we are asking for $2\mathbb P(0<N'<V/\sqrt{2n-1})$. Since $(V,N')$ is radially symmetric, $\mathbb P(0<N'<V/\sqrt{2n-1}) = \arctan(1/\sqrt{2n-1})/(2\pi) $. The probability of a sign change in each location is $\frac{1}{\pi} \arctan(1/\sqrt{2n-1}) = \frac{1}{\pi}\left((2n-1)^{-1/2} - \frac{1}{3}(2n-1)^{-3/2} + \frac{1}{5}(2n-1)^{-5/2} - \cdots \right) $. If you consider $n$ consecutive values for $Y$, there are $n-1$ possible sign changes, and the expected number of sign changes is $\frac{n-1}{\pi}\arctan(1/\sqrt{2n-1}) \sim \frac{\sqrt{n}}{\pi\sqrt{2}}$.

$\endgroup$
3
  • 1
    $\begingroup$ When $\mu=0$, you reduce this to the probability that a two-dimensional normal distribution is within a wedge with vertex at the center. By a change of variables, that's the probability that a rotationally symmetric normal distribution is within a wedge, which has a probability of $\theta/(2\pi)$ where $\theta$ is the angle of the wedge. So, you shouldn't need to approximate this. $\endgroup$ Commented Apr 15, 2016 at 9:05
  • $\begingroup$ Good observation... $\endgroup$ Commented Apr 16, 2016 at 5:09
  • $\begingroup$ I took the liberty of adding that argument in place of the approximation. $\endgroup$ Commented Apr 16, 2016 at 8:29
1
$\begingroup$

We can for the purposes of getting the expected number of changes in $n$ consecutive $Y$ values treat the problem as $n$ independent observations of $Y_k$ and $Y_{k+1}$. (Since the first observation can be a sign change relative to the $Y$ before the sequence, this is $n$ rather than $n-1$.) So the answer will be $n$ times the probability that a given $Y_k Y_{k+1}$ is negative.

For that to happen at time $k==t+n$, consider the the random variate $Z = -\left(X_{t+2} + X_{t+3} + \ldots + X_{t+n}\right)$. In order for there to be a sign change from negative to positive in the $Y$ sequence at time $k$, we must have $$ X_{t+1} < Z \mbox{ and } X_{t+1} > Z $$ (The probability for a change from positive to negative is the same.)

Z is distributed as a normal with mean zero and $\sigma = \sqrt{n-1}$. Then

$$ P ( - \rightarrow +) = \int_{-\infty}^\infty \frac{dz}{\sqrt{2(n-1)\pi}}e^{-\frac{z^2}{2(n-1)}} \frac12\left[ 1+ \mbox{erf } \frac{z}{\sqrt{2}} \right] \frac12\left[\mbox{erfc } \frac{z}{\sqrt{2}} \right] $$ and the desired expected number of changes in the $n$ sequence is $$ 2n P ( - \rightarrow +) $$

This does not have a nice closed form, but for $n=20$ through $n=400$ is well approximated by

$$S(n) \approx \frac29 \log^2 n $$

However, one can show that the expression is greater than $O(\log^2 n)$ for large $n$.

As a nice aside, when $n=2$, one might naively expect the expected number of changes to be $1$. After all, in this case what we are calling $Z$ is just one of the $X$ variates, However, the correct answer is $\frac23$, and this reflects the fact that when that $x$ variate is far from zero, the expected number of sign changes drops off.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .