# Conditional probability

• Aug 19th 2013, 04:37 AM
jgonzalf
Conditional probability
Hello,

This problem has arosen in my work and I need help to solve it, because my calculations do not match with the simulation I made in Matlab.

Imagine a generator A of blocks of numbers {0,1,2} separated by spaces {-} with block lenght between m and M. These blocks are received by a box B that process them in this way:
- If the blocks start by 0 and end by 1, the block remains as it was.
- Else, the blocks are trimmed in both ways until it starts by 0 and ends by 1. The trimmed part are substituted by spaces.
- If after the trimming the block is shorter than m, or it's not possible to achieve the structure 0..1, B only sends spaces.

Example: (m=3)

A generates: ----00101011200-, and B transforms into: ----00101011----
A generates: --1112100020102-, and B transforms into: -------000201---
A generates: --1111210122111-, and B transforms into: ---------------- (-01- can be achieved but its length is 2<m)

Question:
P= P(B generates '1' | A generates '1'), (Probability of B generates a '1' conditioned to A has generated a '1')

I think it's better to work with Q = 1-P = 1-P(B generates a space | A generates '1')
• Aug 19th 2013, 08:59 PM
chiro
Re: Conditional probability
Hey jgonzalf.

Can you show us the simulation code as well as the probabilities that you have worked out?
• Aug 21st 2013, 10:38 AM
jgonzalf
Re: Conditional probability
Hi Chiro,
I am afraid is too long and I reduced part of the problem to be easy to analyze here. My previous analysis is:
- I think there are different probabilities to produce different types of blocks. Let's say:
-> P1: probability of block is sent as it was. Ex: ---0201- -> ---0201-
-> P2: probability of block is trimmed by left: Ex: -11102001-- -> ----02001--
-> P3: probability of block is trimmed by right: Ex: -0002210000- -> -000221-----
-> P4: probability of block is trimmed by both sides. Ex: -111202221222-- -> -----02221-----
-> P5: probability of block can't be transformed and B sends spaces: ---11112--- -> -----------
P1+P2+P3+P4+P5=1
So, P= P(B generates '1' | A generates '1') = sum_{i} P(B generates '1' | A generates '1' and B in block type i)*P(Block type i | A generates '1')
but it's not easy to calculate.
• Aug 21st 2013, 06:06 PM
chiro
Re: Conditional probability
Could you model this as a Markov model? If it can (and you have a finite number of transitions), then you could solve the distribution as well as the long run distribution for particular states.
• Aug 22nd 2013, 12:58 AM
jgonzalf
Re: Conditional probability
Hi Chiro, I'll try it. Thanks for your kind help.
Javier.