# The joint probability of moving sums

There are $$N$$ independent random variables $$k_1,k_2, ...,k_N$$ which have the same Normal distribution $$N(\mu,\sigma^2)$$.

We define the sequence of sums of length $$s$$:

$$S_1=k_1+k_2+...+k_s$$,

$$S_2=k_2+k_3+...+k_{s+1},$$

$$S_3= ...$$

How can I find the probability that all sums exceed a real number $$M$$ at the same time: $$P(S_1>M,S_2>M,...,S_{N-s+1}>M)$$?

• I would be surprised if there is any simplified answer in the general case. Maybe in a specific case there could be. If you have a specific case in mind, could you add the details of the specific case? Commented Jan 14, 2021 at 1:26
• Unfortunately, there is the general case in my problem. Perhaps, there may be another case, when independent random variables have the same Normal distribution. Commented Jan 14, 2021 at 11:35
• your first statement implies each variable follows a uniform distrb. And second statement says each variable follows a normal distrb. Unless I am understanding something wrong, your question statement is wrong. Please explain if I am understanding something wrong here. Commented Jan 14, 2021 at 13:38
• I meant the question may have two variants of initial condition: the first is a uniform distribution, the second is a normal one. I need to find the joint probability for two cases. In other words, there is "or" between (1) and (2), not "and". Commented Jan 14, 2021 at 14:32
• I deleted "in a set". Just a normal distribution Commented Jan 14, 2021 at 15:24

Now I can partially answer your question. The solution you are looking for might look like the following:

Since each random variable distributed normally and they are independent of each other, we have:

$$k_1 + k_2 + ... + k_s = S_1 \sim N(s\mu, s\sigma^2)$$

$$k_2 + k_2 + ... + k_{s+1} = S_2 \sim N(s\mu, s\sigma^2)$$

Since you need to calculate joint probability, we need to look at the joint distribution:

Lets define:

\begin{align} \vec{S} &= \begin{bmatrix} S_{1} \\ S_{2} \\ \vdots \\ S_{N-s+1} \end{bmatrix} \end{align}, \begin{align} \vec{\theta} &= \begin{bmatrix} s\mu \\ s\mu \\ \vdots \\ s\mu \end{bmatrix} \end{align}, \begin{align} \Sigma_S &= \begin{bmatrix} s\sigma^2 & \sigma_{S_1, S_2} & ... & \sigma_{S_1, S_{N-s+1}} \\ \sigma_{S_2, S_1} & s\sigma^2 & ... & \sigma_{S_2, S_{N-s+1}}\\ \vdots \\ \sigma_{S_{N-s+1}, S_1} & \sigma_{S_{N-s+1}, S_2} & ... & s\sigma^2 \end{bmatrix} \end{align}

Where:

$$\sigma_{S_k, S_z} = Cov(S_k, S_z)$$

Then we have:

$$\vec{S} \sim N(\vec{\theta}, \Sigma_s)$$

From here you need to calculate: $$P(\vec{S} > M) = 1 - P(\vec{S} \leq M) = 1 - F_{\vec{S}}(M)$$

Which is the CDF of the multi-variate normal distrb. Unfortunately, there is no close form solution, but there exist some numerical and approximate methods to calculate it.

see this R library for numerical methods: https://github.com/lbelzile/TruncatedNormal

see this document for approximation: https://upload.wikimedia.org/wikipedia/commons/a/a2/Cumulative_function_n_dimensional_Gaussians_12.2013.pdf

• Can I estimate the covariance as $Cov(S_k, S_z)=\sigma^2 \frac{s-(z-k)}{s}$? Commented Jan 14, 2021 at 16:52
• @Stasya7 Dont know how did you come up with this, but when I use generic covariance function to calculate it (with or without bias correction), I do not end up with this solution. Commented Jan 14, 2021 at 17:03
• more accurately, $Cov(S_k,S_z)=(s-(z-k))\sigma^2$ if $z-k \lt s$. Otherwise, 0. Commented Jan 14, 2021 at 17:52
• @Stasya7 Please give your complete derivation to come up with this solution, then I can double check it with you Commented Jan 15, 2021 at 7:04
• Let $S_1=k_1+k_2+...+k_s=k_1+A, S_2=A+k_{s+1}$, where $A$ is a sum of $s-1$ length. Then $Cov(S_1,S_2)=Cov(k_1,A)+Cov(k_1,k_{s+1})+Cov(A,A)+Cov(A,k_{s+1})=0+0+\sigma^2 (s-1)+0=\sigma^2 (s-1).$. $Cov(S_1,S_3)=\sigma^2 (s-2)$ etc. Therefore, $Cov(S_i,S_z)=\sigma^2 (s-(z-i))$ if $z-i<s$. Commented Jan 15, 2021 at 11:57