Probability of binary consecutive occurence with unequal probability

  • Context: MHB 
  • Thread starter Thread starter cygi1989
  • Start date Start date
  • Tags Tags
    Binary Probability
Click For Summary

Discussion Overview

The discussion revolves around calculating the expected number of consecutive occurrences of binary digits (0s and 1s) of a specified length (k) in a binary series of length N, given unequal probabilities for each digit. Participants explore the implications of different probabilities and seek to derive formulas for various scenarios.

Discussion Character

  • Exploratory
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant presents a formula for the expected number of series of length k in a binary sequence when the probabilities of 0 and 1 are equal, and questions how this changes with unequal probabilities.
  • Another participant provides an example using equal probabilities to illustrate the calculation of the probability of a specific sequence occurring in a binary string.
  • Several participants discuss the need for exact closed-form solutions versus Monte Carlo estimates, with one participant expressing a preference for exact results to compare against their own estimations.
  • There is a discussion about the independence of occurrences of sequences of k+2 symbols and whether they are correlated.
  • One participant elaborates on the probability of detecting a sequence of k consecutive ones in terms of the probabilities of the individual symbols.
  • Another participant confirms the mathematical expressions provided and expresses appreciation for the clarity of the explanation.

Areas of Agreement / Disagreement

Participants generally agree on the mathematical formulations presented but explore different approaches and preferences for solutions. There is no consensus on the best method to calculate expected values, as some favor exact solutions while others consider Monte Carlo methods.

Contextual Notes

Participants reference specific probabilities and lengths, but the discussion does not resolve the implications of these parameters fully. The independence of sequences and the correlation between them remains a point of inquiry.

cygi1989
Messages
4
Reaction score
0
I have been with this to some forums but it didn't help and I was advised to come to this one, so here is the question.

My task is to compute given N - length binary series and P = p(0) and 1-P = p(1) expected number of consecutive occurrence of 0 or 1 of k - length. For example 10011100 has one serie of 1 with length 1 and one serie with length 3,
and also have two series of 0 of length 2.
I know that when the probability of 0 and 1 is equal than
Expected number of series of 0 or 1 of k-lenth in n-length binary numbers is = (n-k+3)/2^(k+2).
But what the case when probability of 0 is for example (0.4) or any another?

Sebastian
 
Last edited by a moderator:
Physics news on Phys.org
Re: Probability of binary consecutive occurrence with uneqaul probability

In order to clarify the question let's consider an example: if $p(0)=p(1)=\frac{1}{2}$ what is the probability to have a sequence of three ones in a string of four binary symbols?... in this case the possible strings are 1110 and 0111 on a total of 16 strings so that the requested probability is $\displaystyle P=\frac{2}{16}=\frac{1}{8}$...

Is that correct?...

Kind regards

$\chi$ $\sigma$
 
Re: Probability of binary consecutive occurrence with uneqaul probability

Yes, it's correct.
Regards to my formula it gives
(4 - 3 + 3 ) / (2^ 5) = 4 / 32 = 1 / 8.
My exact task is to find expected number of series of k - lenth for k = 1 .. 6, with P(1) = 800 / 2007 and N = 2007
 
Re: Probability of binary consecutive occurrence with uneqaul probability

cygi1989 said:
Yes, it's correct.
Regards to my formula it gives
(4 - 3 + 3 ) / (2^ 5) = 4 / 32 = 1 / 8.
My exact task is to find expected number of series of k - lenth for k = 1 .. 6, with P(1) = 800 / 2007 and N = 2007

Does this need to be an exact closed form solution or will an Monte-Carlo estimate be OK?

CB
 
Re: Probability of binary consecutive occurrence with uneqaul probability

Exact result will be better I guess because I have calculated estimation by myself (I run this test for 1000 esembles) and I need to compare my result with expected ones. Anyway, what result will come from Monte Carlo method and how to calculate it?
 
Re: Probability of binary consecutive occurrence with uneqaul probability

cygi1989 said:
Exact result will be better I guess because I have calculated estimation by myself (I run this test for 1000 esembles) and I need to compare my result with expected ones. Anyway, what result will come from Monte Carlo method and how to calculate it?

It sounds like you already have a Monte-Carlo estimate (which would be produced by generating random strings of length 2007 and counting run lengths for lengths 1..6 and dividing the totals by 2007).

CB
 
Re: Probability of binary consecutive occurrence with uneqaul probability

cygi1989 said:
I have been with this to some forums but it didn't help and I was advised to come to this one, so here is the question.

My task is to compute given N - length binary series and P = p(0) and 1-P = p(1) expected number of consecutive occurrence of 0 or 1 of k - length. For example 10011100 has one serie of 1 with length 1 and one serie with length 3,
and also have two series of 0 of length 2.
I know that when the probability of 0 and 1 is equal than
Expected number of series of 0 or 1 of k-lenth in n-length binary numbers is = (n-k+3)/2^(k+2).
But what the case when probability of 0 is for example (0.4) or any another?

Sebastian

Let p the probability of the symbol 1 [and 1-p the probability of the symbol 0...]. A sequence of k consecutive ones is detected if in a string of k+2 symbols the first and the last are 0 and all others are 1. The probability of such a recurrence is...

$\displaystyle P_{k}= p^{k}\ (1-p)^{2}$ (1)

... and because in a sequence of n symbols there are n-k+3 possible subsequence on k+2 symbols, the expected number of k consecutive 1 is...

$\displaystyle E_{n,k}= (n-k+3)\ P_{k}=(n-k+3)\ p^{k}\ (1-p)^{2}$ (2)

For $p=\frac{1}{2}$ we find Your formula...

Kind regards

$\chi$ $\sigma$
 
Re: Probability of binary consecutive occurrence with uneqaul probability

chisigma said:
Let p the probability of the symbol 1 [and 1-p the probability of the symbol 0...]. A sequence of k consecutive ones is detected if in a string of k+2 symbols the first and the last are 0 and all others are 1. The probability of such a recurrence is...

$\displaystyle P_{k}= p^{k}\ (1-p)^{2}$ (1)

... and because in a sequence of n symbols there are n-k+3 possible subsequence on k+2 symbols, the expected number of k consecutive 1 is...

And are they independent/uncorrelated?

CB
 
Re: Probability of binary consecutive occurrence with uneqaul probability

CaptainBlack said:
And are they independent/uncorrelated?

CB

Is the 'they' related to the symbols, to the strings of k+2 symbols or to something else... please?...

Kind regards

$\chi$ $\sigma$
 
  • #10
Re: Probability of binary consecutive occurrence with uneqaul probability

chisigma said:
Is the 'they' related to the symbols, to the strings of k+2 symbols or to something else... please?...

Kind regards

$\chi$ $\sigma$

The strings of k+2 symbols.

CB
 
  • #11
Re: Probability of binary consecutive occurrence with uneqaul probability

CaptainBlack said:
The strings of k+2 symbols.

CB

Very well!... let's suppose to have a sequence of random binary symbols $a_{i}$ and, independently from i, is $P\{a_{i}=1\} = p \implies P\{a_{i}=0\}=1-p$. Now we consider a subsequence of k+2 consecutive symbols $\overrightarrow {a}_{i}= [a_{i},a_{i+1}, ... , a_{i+k+1}]$. Independently from i is...

$\displaystyle P_{i,k}=P\{\overrightarrow {a}_{i}= [0,1, ... . 1, 0]\}= p^{k}\ (1-p)^2$ (1)

... so that, if You observe m subsequences of k+2 consecutive symbols, the expected value of times on which is $\overrightarrow {a}_{i}= [0,1, ... , 1, 0]$ is $m\ P_{i,k}$...

Kind regards

$\chi$ $\sigma$
 
  • #12
Re: Probability of binary consecutive occurrence with uneqaul probability

chisigma said:
Let p the probability of the symbol 1 [and 1-p the probability of the symbol 0...]. A sequence of k consecutive ones is detected if in a string of k+2 symbols the first and the last are 0 and all others are 1. The probability of such a recurrence is...

$\displaystyle P_{k}= p^{k}\ (1-p)^{2}$ (1)

... and because in a sequence of n symbols there are n-k+3 possible subsequence on k+2 symbols, the expected number of k consecutive 1 is...

$\displaystyle E_{n,k}= (n-k+3)\ P_{k}=(n-k+3)\ p^{k}\ (1-p)^{2}$ (2)

For $p=\frac{1}{2}$ we find Your formula...

Kind regards

$\chi$ $\sigma$

Absolutely brilliant. Many thanks!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 14 ·
Replies
14
Views
6K
  • · Replies 29 ·
Replies
29
Views
5K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K