I happened to an interview question:
Toss a coin, if the probability of head, $p$ is random. What's the correlation between the number of heads for 100 tossing, $X_{100}$ and the first 10 tossing, $X_10?$
the non-random $p$ version is very easy which has been answered here:
We know that when $p$ is known (conditional on $p$),
$$X_{10}|p\sim binomial(10,p),$$
we have
$$Covariance(X_{10}|p,X_{100}|p) = Variance(X_{10}|p) = 10*p(1-p).$$
Then how to calculate the random $p?$ Maybe let's assume $p\sim Uniform(0,1).$ I just want to see the process of calculation.
Best Answer
Just use the Law of Total Variance to find the unconditional variance.
Let $X_{n}$ be the count for heads among the first $n$ tosses. $X_{n}\mid p\sim \mathcal{Bin}(n,p)$, and assuming $p\sim\mathcal{U}(0,1)$...
$$\begin{align}\mathsf{Var}(X_n) &=\mathsf E(\mathsf{Var}(X_n\mid p))+\mathsf {Var}(\mathsf E(X_n\mid p))\\&=\mathsf E(np(1-p))+\mathsf{Var}(np)\\&=n\mathsf E(p)(1-\mathsf E(p))+(n^2-n)\mathsf {Var}(p)\\&=\tfrac {2n+n^2}{12}\end{align}$$
Then use that to find the correlation.