# Density probability function considering a subinterval which have different probabilities

#### luchins

##### Member
Hi I was studying probability density and on a site I read this example
Mr. Rossi waits for a phone call from Mr. Bianchi who has announced that he will call, in an unspecified instant, between 4:00 pm and 6:00 pm. Mr. Rossi must however be away from 4.45 pm to 5.00 pm. What is the probability that the call arrives while Mr. Rossi is absent?
The instant of the call is a random variable X. As far as Mr. Rossi knows, every moment from 16:00 to 18:00 is possible, while outside this interval the probability is zero. So it is intuitive to consider X to be a random variable, whose density is a constant value: c on the interval [16,18] and has the value zero outside this range. How much is the constant c? It must be such as to satisfy the relationship:

that is, the area of the rectangle with base [16,18] and height c is 1. So 2c = 1 and therefore we have c = 1/2. The density function of the variable X will be:

The area is equal to the probability P (16:45 ≤ X ≤ 17:00) and we note that the value of this probability is 1/8 (the area of the rectangle is 1)
I can ask you these questions:

My questions:

How have he calculated the probability of the rectangle (1/8)? The area of the rectangle is '' 1 '' but how did he calculate the probability of 1/8?

question numer 2 : Suppose that in the interval (a, b) (time in which you expect the call) there are some subintervals that they have not the same probability of the others subintervals for the call to be received, for example immagine that at 17:58 there was a greater probability of receiving a phone call compared to other subintervals. In that case, how do you set the density function?

question n 3

1. Are there software in R to calculate probability densitity?

Last edited:

#### BGM

##### TS Contributor
1. Note the unit of the time X in your model is in hour (in a day) - so X ~ Uniform(16, 18) and now you are asking for the probability with in a 15 mins time interval, so 15 mins / 2 hrs = 1/8 (Since the density is rectangular and the area of the rectangle is proportional to the base for the same height)
2. Depends on your assumption. There are infinitely many choices of pdfs which you can use. Whether it fits into your physical observation / can be justified is another issue.
3. R can help you numerically integrate something, or to estimate a pdf from observed data.

#### luchins

##### Member
1. Note the unit of the time X in your model is in hour (in a day) - so X ~ Uniform(16, 18) and now you are asking for the probability with in a 15 mins time interval, so 15 mins / 2 hrs = 1/8 (Since the density is rectangular and the area of the rectangle is proportional to the base for the same height)
2. Depends on your assumption. There are infinitely many choices of pdfs which you can use. Whether it fits into your physical observation / can be justified is another issue.
3. R can help you numerically integrate something, or to estimate a pdf from observed data.
Let's suppose the area was not a rectangular, but a gaussian normal distribution with a mean, a standard deviationetc. How to calculate the odds in that case?

#### BGM

##### TS Contributor
So in general when you calculating the probability that a continuous random variable falls into the range (a, b), with a given CDF you simply calculate F(b) - F(a); if only pdf is given you need to integrate the pdf from a to b. Some distribution like normal has no closed-form expression for the CDF so you can only do it numerically to compute the probability.

#### luchins

##### Member
So in general when you calculating the probability that a continuous random variable falls into the range (a, b), with a given CDF you simply calculate F(b) - F(a); if only pdf is given you need to integrate the pdf from a to b. Some distribution like normal has no closed-form expression for the CDF so you can only do it numerically to compute the probability.
Thanks

I don't get it what is F(b) and what is F(a)... sorry....

How do I integrate PDF from a to b?

Some distribution like normal has no closed-form expression for the CDF so you can only do it numerically to compute the probability
Sorry could you make an example? How could I calculate it numerically?