2
$\begingroup$

Here's a question I got for homework:

A student purchases books for $K$ class hours, where $K$ is a random variable with a uniform distribution between $1$ to $3$. The number of books the students purchases is also a random variable defined by $P(N=n|K=k) = 1/k$, $n = 1,\dots,k$.

What is the joint distribution, what is the marginal probability function of N?

So, first I wrote down $P(K=k): 1/3$, $k=1,2,3$

Now, $P(N=n|K=k) = P(N=n \text{ and } K=k)/P(K=k) = 1/k$, and from that I got $P(N=n\text{ and }K=k) = (1/k)P(K=k)$. When I write down the table of joint distribution the disjoints events didn't sum up to $1$. For example:

\begin{align*} P(N=1|K=1) &= 1 \\ P(N=1|K=2) &= 1/6 \\ P(N=1|K=3) &= 1/9 \\ \end{align*}

You'll notice that I get P(N=n) = 11/18 for n=1,2,3 And that's what I mean when I say it didn't sum up to 1.

There's obviously something I don't understand, a hint would be great. Where is my mistake? Thanks!

  • 0
    So you're given $P[K=k]=\frac{1}{3}$ for $1 \leq k \leq 3$ and $P[N=n|K=k]=$\frac{1}{k}$ for $1 \leq n \leq k$ (and $0$ for $n>k$). Therefore $P[N=n,K=k]=P[N=n|K=k] \cdot P[K=k] = \frac{1}{3k}$ for $1 \leq n \leq k \leq 3$ but $0$ for $n>k$. Finally, $P[N=n]=\sum_{k=n}^{3}P[N=n|K=k]=\sum_{k=n}^{3}\frac{1}{3k}$.2011-12-12

2 Answers 2

1

It's the conditional distributions that don't add to one. Try drawing the joint distribution $P[N=n,K=k]$ in a table for $1 \leq k,n \leq 3$: the nonzero values will form a triangle, where each row and column have sums that make sense. And compare this with the conditional distributions (which are shown first below): $ \begin{array}{ccc} P[N=n|K=k] & n=1 & n=2 & n=3 \\ k=1 & 1 & 0 & 0 \\ k=2 & \frac{1}{2} & \frac{1}{2} & 0 \\ k=3 & \frac{1}{3} & \frac{1}{3} & \frac{1}{3} \end{array} $ $ \begin{array}{ccc} P[N=n,K=k] & n=1 & n=2 & n=3 \\ k=1 & \frac{1}{3} & 0 & 0 \\ k=2 & \frac{1}{6} & \frac{1}{6} & 0 \\ k=3 & \frac{1}{9} & \frac{1}{9} & \frac{1}{9} \end{array} $ So you're given $P[K=k]=\frac{1}{3}$ for $1 \leq k \leq 3$ and $ P[N=n|K=k]= \left\{ \begin{align} \frac{1}{k} &\quad \text{for }1 \leq n \leq k; \\ 0 &\quad\text{for }n>k. \end{align} \right. $ This is the conditional distribution, shown in the first table above. From this, we can calculate the joint distribution as in the second table: $P[N=n,K=k]=P[N=n|K=k] \cdot P[K=k] = \frac{1}{3k}$ for $1 \leq n \leq k \leq 3$ (and $0$ for n>k). Finally, $P[N=n]=\sum_{k=n}^{3}P[N=n|K=k]=\sum_{k=n}^{3}\frac{1}{3k}$.

As pointed out by others, the mistake was in writing down the conditional probabilities.

  • 0
    Okay but if there's no mistake then P(N=2,K=1)=(1/k)P(K=k) = 1/3, but you have 1/6. How did you get it? Sorry I have the impression that I did have a mistake somewhere, otherwise I don't see how you got your table. Anyway- thanks2011-12-12
1

One mistake is writing:

$ \begin{align*} P(N=1|K=1) &= 1 \\\\ P(N=1|K=2) &= 1/6 \\\\ P(N=1|K=3) &= 1/9 \\\\ \end{align*}$

The expressions on the left hand side are conditional probabilities. Using the formula in the problem statement, they should be

$ \begin{align*} P(N=1|K=1) &= 1 \\\\ P(N=1|K=2) &= 1/2 \\\\ P(N=1|K=3) &= 1/3 \\\\ \end{align*}$

Joint distribution values for $N=1$ can be obtained from the above and your formula: $P(N=n\text{ and }K=k) = (1/k)P(K=k), {\text { for }} n\le k$

So,

$ \begin{align*} P(N=1\text{ and }K=1) &= 1\cdot(1/3)=1/3 \\\\ P(N=1\text{ and }K=2) &= 1/2 \cdot(1/3)=1/6\\\\ P(N=1\text{ and }K=3) &= 1/3\cdot(1/3)=1/9 \\\\ \end{align*}$

Adding these gives $P[N=1]={1\over 3}+{1\over 6} +{1\over 9}={11\over 18}$.

To find the rest of the joint distribution values, you need to observe (assume?) that $P[N=n|K=k]=0$ if $n>k$; so $P[N=n,K=k]=0$ for $n>k$.

See bgins answer for the full joint distribution.

  • 0
    @yotamoo The essential observation you need to make is that $P[N=n|K=k]=0$ if n>k.2011-12-12