4.2: Continuous Conditional Probability

In situations where the sample space is continuous we will follow the same procedure as in the previous section. Thus, for example, if \(X\) is a continuous random variable with density function \(f(x)\), and if \(E\) is an event with positive probability, we define a conditional density function by the formula \[f(x|E) = \left \ < \matrix< f(x)/P(E), & \mbox\,\,x \in E, \cr 0, & \mbox\,\,x \not \in E. \cr>\right.\] Then for any event \(F\), we have \[P(F|E) = \int_F f(x|E)\,dx\ .\] The expression \(P(F|E)\) is called the conditional probability of \(F\) given \(E\). As in the previous section, it is easy to obtain an alternative expression for this probability: \[P(F|E) = \int_F f(x|E)\,dx = \int_ \frac \,dx = \frac \ .\] We can think of the conditional density function as being 0 except on \(E\), and normalized to have integral 1 over \(E\). Note that if the original density is a uniform density corresponding to an experiment in which all events of equal size are then the same will be true for the conditional density.

Example \(\PageIndex\):

In the spinner experiment (cf. Example 2.1.1]), suppose we know that the spinner has stopped with head in the upper half of the circle, \(0 \leq x \leq 1/2\). What is the probability that \(1/6 \leq x \leq 1/3\)?

Solution

Here \(E = [0,1/2]\), \(F = [1/6,1/3]\), and \(F \cap E = F\). Hence \[\begin P(F|E) &=& \frac \\ &=& \frac \\ &=& \frac 13\ ,\end\] which is reasonable, since \(F\) is 1/3 the size of \(E\). The conditional density function here is given by \[f(x|E) = \left \< \matrix< 2, & \mbox\,\,\, 0 \leq x < 1/2, \cr 0, & \mbox\,\,\, 1/2 \leq x < 1.\cr>\right.\] Thus the conditional density function is nonzero only on \([0,1/2]\), and is uniform there.

Example \(\PageIndex\):

In the dart game (cf. Example 2.2.2), suppose we know that the dart lands in the upper half of the target. What is the probability that its distance from the center is less than 1/2?

Solution
Example \(\PageIndex\):

We return to the exponential density (cf. Example 2.2.7). We suppose that we are observing a lump of plutonium-239. Our experiment consists of waiting for an emission, then starting a clock, and recording the length of time \(X\) that passes until the next emission. Experience has shown that \(X\) has an exponential density with some parameter \(\lambda\), which depends upon the size of the lump. Suppose that when we perform this experiment, we notice that the clock reads \(r\) seconds, and is still running. What is the probability that there is no emission in a further \(s\) seconds?

Solution

Let \(G(t)\) be the probability that the next particle is emitted after time \(t\). Then \[\begin G(t) & = & \int_t^\infty \lambda e^<-\lambda x>\,dx \\ & = & \left.-e^<-\lambda x>\right|_t^\infty = e^<-\lambda t>\ .\end\] Let \(E\) be the event “the next particle is emitted after time \(r\)" and \(F\) the event “the next particle is emitted after time \(r + s\)." Then \[\begin P(F|E) & = & \frac \\ & = & \frac \\ & = & \frac >> \\ & = & e^<-\lambda s>\ .\end\] This tells us the rather surprising fact that the probability that we have to wait \(s\) seconds more for an emission, given that there has been no emission in \(r\) seconds, is of the time \(r\). This property (called the memoryless property) was introduced in Example 2.17. When trying to model various phenomena, this property is helpful in deciding whether the exponential density is appropriate. The fact that the exponential density is memoryless means that it is reasonable to assume if one comes upon a lump of a radioactive isotope at some random time, then the amount of time until the next emission has an exponential density with the same parameter as the time between emissions. A well-known example, known as the “bus paradox," replaces the emissions by buses. The apparent paradox arises from the following two facts: 1) If you know that, on the average, the buses come by every 30 minutes, then if you come to the bus stop at a random time, you should only have to wait, on the average, for 15 minutes for a bus, and 2) Since the buses arrival times are being modelled by the exponential density, then no matter when you arrive, you will have to wait, on the average, for 30 minutes for a bus. The reader can now see that in Exercises 2.2.9, 2.2.10, and 2.2.11, we were asking for simulations of conditional probabilities, under various assumptions on the distribution of the interarrival times. If one makes a reasonable assumption about this distribution, such as the one in Exercise 2.2.10, then the average waiting time is more nearly one-half the average interarrival time.

Independent Events

If \(E\) and \(F\) are two events with positive probability in a continuous sample space, then, as in the case of discrete sample spaces, we define \(E\) and \(F\) to be independent if \(P(E|F) = P(E)\) and \(P(F|E) = P(F)\). As before, each of the above equations imply the other, so that to see whether two events are independent, only one of these equations must be checked. It is also the case that, if \(E\) and \(F\) are independent, then \(P(E \cap F) = P(E)P(F)\).

Example \(\PageIndex\):

In the dart game (see Example 4.1.12, let \(E\) be the event that the dart lands in the upper half of the target (\(y \geq 0\)) and \(F\) the event that the dart lands in the right half of the target (\(x \geq 0\)). Then \(P(E \cap F)\) is the probability that the dart lies in the first quadrant of the target, and \[\begin P(E \cap F) & = & \frac 1\pi \int_ 1\,dxdy \\ & = & \mbox\,(E\cap F) \\ & = & \mbox\,(E)\,\mbox\,(F) \\ & = & \left(\frac 1\pi \int_E 1\,dxdy\right) \left(\frac 1\pi \int_F 1\,dxdy\right) \\ & = & P(E)P(F)\end\] so that \(E\) and \(F\) are independent. What makes this work is that the events \(E\) and \(F\) are described by restricting different coordinates. This idea is made more precise below.

Joint Density and Cumulative Distribution Functions

In a manner analogous with discrete random variables, we can define joint density functions and cumulative distribution functions for multi-dimensional continuous random variables.

Definition \(\PageIndex\)

Let \(X_1,~X_2, \ldots,~X_n\) be continuous random variables associated with an experiment, and let \( = (X_1,~X_2, \ldots,~X_n)\). Then the joint cumulative distribution function of \(\) is defined by \[F(x_1, x_2, \ldots, x_n) = P(X_1 \le x_1, X_2 \le x_2, \ldots, X_n \le x_n)\ .\] The joint density function of \(\) satisfies the following equation: \[F(x_1, x_2, \ldots, x_n) = \int_<-\infty>^ \int_<-\infty>^ \cdots \int_<-\infty>^ f(t_1, t_2, \ldots t_n)\,dt_ndt_\ldots dt_1.\]

It is straightforward to show that, in the above notation, \[ f(x_1, x_2, \dots \dots , x_n) = \frac<\partial^nF(x_1,x_2, \dots \dots, x_n)><\partial x_1\partial x_2 \cdots \partial x_n)>\]

Independent Random Variables

As with discrete random variables, we can define mutual independence of continuous random variables.
Definition \(\PageIndex\)

Let \(X_1\), \(X_2\), …, \(X_n\) be continuous random variables with cumulative distribution functions \(F_1(x),~F_2(x), \ldots,~F_n(x)\). Then these random variables are if \[F(x_1, x_2, \ldots, x_n) = F_1(x_1)F_2(x_2) \cdots F_n(x_n)\] for any choice of \(x_1, x_2, \ldots, x_n\).

Thus, if \(X_1,~X_2, \ldots,~X_n\) are mutually independent, then the joint cumulative distribution function of the random variable \( = (X_1, X_2, \ldots, X_n)\) is just the product of the individual cumulative distribution functions. When two random variables are mutually independent, we shall say more briefly that they are Using Equation 4.4, the following theorem can easily be shown to hold for mutually independent continuous random variables.

Theorem \(\PageIndex\)

Let \(X_1\), \(X_2\), …, \(X_n\) be continuous random variables with density functions \(f_1(x),~f_2(x), \ldots,~f_n(x)\). Then these random variables are mutually independent if and only if \[f(x_1, x_2, \ldots, x_n) = f_1(x_1)f_2(x_2) \cdots f_n(x_n)\] for any choice of \(x_1, x_2, \ldots, x_n\)

Let’s look at some examples.
Example \(\PageIndex\):

In this example, we define three random variables, \(X_1,\ X_2\), and \(X_3\). We will show that \(X_1\) and \(X_2\) are independent, and that \(X_1\) and \(X_3\) are not independent. Choose a point \(\omega = (\omega_1,\omega_2)\) at random from the unit square. Set \(X_1 = \omega_1^2\), \(X_2 = \omega_2^2\), and \(X_3 = \omega_1 + \omega_2\). Find the joint distributions \(F_<12>(r_1,r_2)\) and \(F_(r_2,r_3)\). clipboard_e374430bf6de44290ed65b33fe329aa66.pngWe have already seen (see Example 2.13 that \[\begin F_1(r_1) & = & P(-\infty < X_1 \leq r_1) \\ & = & \sqrt, \qquad \mbox \,\,0 \leq r_1 \leq 1\ ,\end\] and similarly, \[F_2(r_2) = \sqrt\ ,\] if \(0 \leq r_2 \leq 1\). Now we have (see Figure \(\PageIndex\)) \[\begin F_<12>(r_1,r_2) & = & P(X_1 \leq r_1 \,\, \mbox\,\, X_2 \leq r_2) \\ & = & P(\omega_1 \leq \sqrt \,\,\mbox\,\, \omega_2 \leq \sqrt) \\ & = & \mbox\,(E_1)\\ & = & \sqrt \sqrt \\ & = &F_1(r_1)F_2(r_2)\ .\end\] In this case \(F_<12>(r_1,r_2) = F_1(r_1)F_2(r_2)\) so that \(X_1\) and \(X_2\) are independent. On the other hand, if \(r_1 = 1/4\) and \(r_3 = 1\), then (see Figure \(\PageIndex\)) clipboard_e02d332abb4e7e4fd999a852b881409c2.png\[\begin F_(1/4,1) & = & P(X_1 \leq 1/4,\ X_3 \leq 1) \\ & = & P(\omega_1 \leq 1/2,\ \omega_1 + \omega_2 \leq 1) \\ & = & \mbox\,(E_2) \\ & = & \frac 12 - \frac 18 = \frac 38\ .\end\] Now recalling that \[F_3(r_3) = \left \ < \matrix< 0, & \mbox\,\,r_3 < 0, \cr (1/2)r_3^2, & \mbox\,\,0 \leq r_3 \leq 1, \cr 1-(1/2)(2-r_3)^2, & \mbox \,\,1 \leq r_3 \leq 2, \cr 1, & \mbox \,\,2 < r_3,\cr>\right.\] (see Example 2.14, we have \(F_1(1/4)F_3(1) = (1/2)(1/2) = 1/4\). Hence, \(X_1\) and \(X_3\) are not independent random variables. A similar calculation shows that \(X_2\) and \(X_3\) are not independent either.

Although we shall not prove it here, the following theorem is a useful one. The statement also holds for mutually independent discrete random variables. A proof may be found in Rényi. 17

Theorem \(\PageIndex\)

Let \(X_1, X_2, \ldots, X_n\) be mutually independent continuous random variables and let \(\phi_1(x), \phi_2(x), \ldots, \phi_n(x)\) be continuous functions. Then \(\phi_1(X_1),\) \(\phi_2(X_2), \ldots, \phi_n(X_n)\) are mutually independent.

Independent Trials

Using the notion of independence, we can now formulate for continuous sample spaces the notion of independent trials (see Definition 4.5).

Definition

A sequence \(X_1\), \(X_2\), …, \(X_n\) of random variables \(X_i\) that are mutually independent and have the same density is called an independent trials process

As in the case of discrete random variables, these independent trials processes arise naturally in situations where an experiment described by a single random variable is repeated \(n\) times.

Beta Density

clipboard_e84c2ad9ada6d9225f95c3dc97b7c5b75.png

We consider next an example which involves a sample space with both discrete and continuous coordinates. For this example we shall need a new density function called the beta density. This density has two parameters \(\alpha\), \(\beta\) and is defined by \[B(\alpha,\beta,x) = \left \< \matrix< (1/B(\alpha,\beta))x^(1 - x)^, & <\mbox>\,\, 0 \leq x \leq 1, \cr 0, & <\mbox>.\cr>\right.\] Here \(\alpha\) and \(\beta\) are any positive numbers, and the beta function \(B(\alpha,\beta)\) is given by the area under the graph of \(x^(1 - x)^\) between 0 and 1: \[B(\alpha,\beta) = \int_0^1 x^(1 - x)^\,dx\ .\] Note that when \(\alpha = \beta = 1\) the beta density if the uniform density. When \(\alpha\) and \(\beta\) are greater than 1 the density is bell-shaped, but when they are less than 1 it is U-shaped as suggested by the examples in Figure 4.9. We shall need the values of the beta function only for integer values of \(\alpha\) and \(\beta\), and in this case \[B(\alpha,\beta) = \frac<(\alpha - 1)!\,(\beta - 1)!><(\alpha + \beta - 1)!>\ .\]

Example\(\PageIndex\)

In medical problems it is often assumed that a drug is effective with a probability \(x\) each time it is used and the various trials are independent, so that one is, in effect, tossing a biased coin with probability \(x\) for heads. Before further experimentation, you do not know the value \(x\) but past experience might give some information about its possible values. It is natural to represent this information by sketching a density function to determine a distribution for \(x\). Thus, we are considering \(x\) to be a continuous random variable, which takes on values between 0 and 1. If you have no knowledge at all, you would sketch the uniform density. If past experience suggests that \(x\) is very likely to be near 2/3 you would sketch a density with maximum at 2/3 and a spread reflecting your uncertainly in the estimate of 2/3. You would then want to find a density function that reasonably fits your sketch. The beta densities provide a class of densities that can be fit to most sketches you might make. For example, for \(\alpha > 1\) and \(\beta > 1\) it is bell-shaped with the parameters \(\alpha\) and \(\beta\) determining its peak and its spread. Assume that the experimenter has chosen a beta density to describe the state of his knowledge about \(x\) before the experiment. Then he gives the drug to \(n\) subjects and records the number \(i\) of successes. The number \(i\) is a discrete random variable, so we may conveniently describe the set of possible outcomes of this experiment by referring to the ordered pair \((x, i)\). We let \(m(i|x)\) denote the probability that we observe \(i\) successes given the value of \(x\). By our assumptions, \(m(i|x)\) is the binomial distribution with probability \(x\) for success: \[m(i|x) = b(n,x,i) = x^i(1 - x)^j\ ,\] where \(j = n - i\). If \(x\) is chosen at random from \([0,1]\) with a beta density \(B(\alpha,\beta,x)\), then the density function for the outcome of the pair \((x,i)\) is \[\begin f(x,i) & = & m(i|x)B(\alpha,\beta,x) \\ & = & x^i(1 - x)^j \frac 1 x^(1 - x)^ \\ & = & \frac 1 x^(1 - x)^\ .\end\] Now let \(m(i)\) be the probability that we observe \(i\) successes knowing the value of \(x\). Then \[\begin m(i) & = & \int_0^1 m(i|x) B(\alpha,\beta,x)\,dx \\ & = & \frac 1 \int_0^1 x^(1 - x)^\,dx \\ & = & \frac \ .\end\] Hence, the probability density \(f(x|i)\) for \(x\), given that \(i\) successes were observed, is \[f(x|i) = \frac \] \[\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ = \frac \ ,\label\] that is, \(f(x|i)\) is another beta density. This says that if we observe \(i\) successes and \(j\) failures in \(n\) subjects, then the new density for the probability that the drug is effective is again a beta density but with parameters \(\alpha + i\), \(\beta + j\). Now we assume that before the experiment we choose a beta density with parameters \(\alpha\) and \(\beta\), and that in the experiment we obtain \(i\) successes in \(n\) trials. We have just seen that in this case, the new density for \(x\) is a beta density with parameters \(\alpha + i\) and \(\beta + j\). Now we wish to calculate the probability that the drug is effective on the next subject. For any particular real number \(t\) between 0 and 1, the probability that \(x\) has the value \(t\) is given by the expression in Equation 4.5. Given that \(x\) has the value \(t\), the probability that the drug is effective on the next subject is just \(t\). Thus, to obtain the probability that the drug is effective on the next subject, we integrate the product of the expression in Equation 4.5 and \(t\) over all possible values of \(t\). We obtain: \[\begin & \frac\int_0^1t \cdot d^(1-t)^dt \\ = & \frac \\ = & \frac<(\alpha + i)!(\beta +j-1)!><(\alpha + \beta + i + j)!>\cdot \frac \\ = & \frac\end\] If \(n\) is large, then our estimate for the probability of success after the experiment is approximately the proportion of successes observed in the experiment, which is certainly a reasonable conclusion. The next example is another in which the true probabilities are unknown and must be estimated based upon experimental data.

Example \(\PageIndex\): (Two-armed bandit problem)

You are in a casino and confronted by two slot machines. Each machine pays off either 1 dollar or nothing. The probability that the first machine pays off a dollar is \(x\) and that the second machine pays off a dollar is \(y\). We assume that \(x\) and \(y\) are random numbers chosen independently from the interval \([0,1]\) and unknown to you. You are permitted to make a series of ten plays, each time choosing one machine or the other. How should you choose to maximize the number of times that you win? clipboard_ea9238bcbcf1f96bba76ab544e42bf4c3.pngOne strategy that sounds reasonable is to calculate, at every stage, the probability that each machine will pay off and choose the machine with the higher probability. Let win(\(i\)), for \(i = 1\) or 2, be the number of times that you have won on the \(i\)th machine. Similarly, let lose(\(i\)) be the number of times you have lost on the \(i\)th machine. Then, from Example 4.16 the probability \(p(i)\) that you win if you choose the \(i\)th machine is \[p(i) = \frac <<\mbox>(i) + 1> <<\mbox>(i) + <\mbox>(i) + 2>\ .\] Thus, if \(p(1) > p(2)\) you would play machine 1 and otherwise you would play machine 2. We have written a program TwoArm to simulate this experiment. In the program, the user specifies the initial values for \(x\) and \(y\) (but these are unknown to the experimenter). The program calculates at each stage the two conditional densities for \(x\) and \(y\), given the outcomes of the previous trials, and then computes \(p(i)\), for \(i = 1\), 2. It then chooses the machine with the highest value for the probability of winning for the next play. The program prints the machine chosen on each play and the outcome of this play. It also plots the new densities for \(x\) (solid line) and \(y\) (dotted line), showing only the current densities. We have run the program for ten plays for the case \(x = .6\) and \(y = .7\). The result is shown in Figure 4.7 The run of the program shows the weakness of this strategy. Our initial probability for winning on the better of the two machines is .7. We start with the poorer machine and our outcomes are such that we always have a probability greater than .6 of winning and so we just keep playing this machine even though the other machine is better. If we had lost on the first play we would have switched machines. Our final density for \(y\) is the same as our initial density, namely, the uniform density. Our final density for \(x\) is different and reflects a much more accurate knowledge about \(x\). The computer did pretty well with this strategy, winning seven out of the ten trials, but ten trials are not enough to judge whether this is a good strategy in the long run. Another popular strategy is the play-the-winner-strategy. As the name suggests, for this strategy we choose the same machine when we win and switch machines when we lose. The program TwoArm will simulate this strategy as well. In Figure 4.11, we show the results of running this program with the play-the-winner strategy and the same true probabilities of .6 and .7 for the two machines. After ten plays our densities for the unknown probabilities of winning suggest to us that the second machine is indeed the better of the two. We again won seven out of the ten trials. clipboard_e7ce5c35e513730a196b8799b681bcb17.pngNeither of the strategies that we simulated is the best one in terms of maximizing our average winnings. This best strategy is very complicated but is reasonably approximated by the play-the-winner strategy. Variations on this example have played an important role in the problem of clinical tests of drugs where experimenters face a similar situation.

Exercises

Exercise \(\PageIndex\)

  1. \(x > 1/4\).
  2. \(x < 3/4\).
  3. \(|x - 1/2| < 1/4\).
  4. \(x^2 - x + 2/9 < 0\).