# Correlation between two dependent variables

I am having trouble answering this question:

Suppose you have N quizzes that follow poisson distribution with parameter=K. The number of quizzes in which you pass is X and the probability that you pass in each is p. So X is binomially distributed with parameters N and p. What is the correlation between N and X?

I understand that we first find the covariance. Now, one problem I am having is that since these variables are dependent, I am not sure whether taking X|N would be a good place to start. With this approach, E(X) is np and E(N) is K. But how do we calculate E(NY)? the variances will also be found. Var(x)=np(1-p) and Var(N)=k. But is this approach right? How do we go about calculating E(XN) or should I use some other approach to calculate covariance and hence correlation?

Thank you!

• did you mean $K$ and $X$ – phdmba7of12 Oct 27 '17 at 19:09
• No, I meant X and N since K is the parameter. There were a few mistakes that I just edited. – Bakimaru Oct 27 '17 at 20:04

The conditional distribution of $X$ given $N$ is the binomial distribution $B(N,p)$. The distribution of $N$ is $\mbox{Poisson}(K)$. To calculate the Pearson correlation coefficient, let us first calculate

\begin{align} E(XN)&=\sum_{n=0}^\infty E(XN|N=n)\,P(N=n)=\sum_{n=0}^\infty np\times n\times P(N=n)\\ &=p\sum_{n=0}^\infty n^2P(N=n)=p\,\langle N^2\rangle=p(K^2+K). \end{align}

Then we need the unconditional means $E(X)$ and $E(N)$ separately. The unconditional distribution of $X$ can be proved to be $\mbox{Poisson}(Kp)$. Therefore $E(X)=\mathrm{var}(X)=Kp$, $\,E(N)=\mathrm{var}(N)=K$. Finally, we obtain the correlation coefficient

\begin{align} r=\frac{\mathrm{cov}(X,N)}{\sqrt{\mathrm{var}(X)\,\mathrm{var}(N)}}=\frac{p(K^2+K)-Kp\times K}{\sqrt{Kp\times K}}=\sqrt{p}. \end{align}

Note: The unconditional distribution $\mbox{Poisson}(Kp)$ of $X$ can be derived as follows. \begin{align} P(X)&=\sum_{n=0}^\infty P(X|N=n)\,P(N=n)=\sum_{n=0}^\infty{n\choose X}p^X(1-p)^{n-X}\times\frac{K^n}{n!}e^{-K}\\ &=\sum_{n=X}^\infty\frac{(Kp)^X\,[K(1-p)]^{n-X}}{X!(n-X)!}\,e^{-K}=\frac{(Kp)^X}{X!}e^{-K}\sum_{n=X}^\infty\frac{[K(1-p)]^{n-X}}{(n-X)!}\\ &=\frac{(Kp)^X}{X!}e^{-K}e^{K(1-p)}=\frac{(Kp)^X}{X!}e^{-Kp}, \end{align} which is the probability distribution of $\,\mbox{Poisson}(Kp)$.

• Thank you so much, I understand everything except how the unconditional distribution of X is derived. I was able to find the unconditional mean of X (kp) which would suffice for the covariance but I would still need the unconditional distribution for var(X). I can start with f(x) = summation of f(x|n)*P(n) over all n. Now when I open it all up, I see a binomial and poisson multiplying and the factorials cancelling, where do I go from here? Thanks again, I really appreciate it! – Bakimaru Oct 27 '17 at 20:53
• OK, I'll add an appendix. – Zhuoran He Oct 27 '17 at 20:59