What are the first two moments of this stochastic process? The setup. Consider a doubly stochastic Poisson (i.e. Cox) process, which is a Poisson arrival process $X_t$ with stochastic intensity function $\lambda_t$, i.e., a Poisson process whose rate is itself a stochastic process.
I try to compute the expected value and the variance of $X_t$ for a variety of rate processes $\lambda_t$.
I already computed the distribution of $X_t$, which is given by $$ P(X_t=k)=\frac{1}{k!} E\left[ \left( \int_0^t \lambda_s ds \right)^k \exp \left( -\int_0^t \lambda_s ds \right) \right],$$ see for example this paper.
The Problem. I realize it is impossible to give a closed form expression for the moments of $X_t$ for arbitrary rate processes $\lambda_t$, but for some special ones it should be possible.
I already fail for the case where $\lambda_t$ is a simple Bernoulli Process, i.e., $$ \lambda_t \mbox{ i.i.d. with }, ~ P(\lambda_t=1)=\frac{1}{2}, ~ P(\lambda_t=3)=\frac{1}{2}. $$ Can anyone give me a hint on how to start? The question therefore boils down to

How can I compute $$ E\left[ \left( \int_0^t \lambda_s ds \right)^k \exp \left( -\int_0^t \lambda_s ds \right) \right] $$ if $\lambda_t$ is the stochastic process above?

Another example that would interest me would be $$ \lambda_t \hat = \mbox{ arrival times of another Poisson process}. $$
I figured it out myself: For the process $\lambda_t$ given in the question, we compute \begin{align} P(X_t=k) &amp;= \frac{1}{k!} \sum_{\omega \in \lbrace \omega_1, \omega_2 \rbrace} \left( \int_0^t \lambda_s(\omega)ds \right)^k \exp \left( - \int_0^t \lambda_s(\omega)ds \right) \\ &amp;= \frac{1}{k!} \sum_{\omega \in \lbrace \omega_1, \omega_2 \rbrace} \frac{(2t)^k\exp(-2t)}{2} = \frac{(2t)^k\exp(-2t)}{k!}. \end{align} Therefore, we can compute the first two moments as follows \begin{align} E[X_t] &amp;=\sum_{k=0}^\infty k \frac{(2t)^k\exp(-2t)}{k!} \\ &amp;= \exp(-2t) \sum_{k=1}^\infty \frac{(2t)^k}{(k-1)!} \\ &amp;= 2t \exp(-2t) \exp(2t) = 2t\end{align} and \begin{align} \operatorname{var}[X_t] &amp;= \left( \sum_{k=0}^\infty k^2 \frac{(2t)^k\exp(-2t)}{k!} \right) - (2t)^2 \\ &amp;= ... = 4t^2+2t-4t^2 = 2t \end{align}
I figured it out myself: For the process $\lambda_t$ given in the question, we compute \begin{align} P(X_t=k) &amp;= \frac{1}{k!} \sum_{\omega \in \lbrace \omega_1, \omega_2 \rbrace} \left( \int_0^t \lambda_s(\omega)ds \right)^k \exp \left( - \int_0^t \lambda_s(\omega)ds \right) \\ &amp;= \frac{1}{k!} \sum_{\omega \in \lbrace \omega_1, \omega_2 \rbrace} \frac{(2t)^k\exp(-2t)}{2} = \frac{(2t)^k\exp(-2t)}{k!}. \end{align} Therefore, we can compute the first two moments as follows \begin{align} E[X_t] &amp;=\sum_{k=0}^\infty k \frac{(2t)^k\exp(-2t)}{k!} \\ &amp;= \exp(-2t) \sum_{k=1}^\infty \frac{(2t)^k}{(k-1)!} \\ &amp;= 2t \exp(-2t) \exp(2t) = 2t\end{align} and \begin{align} \operatorname{var}[X_t] &amp;= \left( \sum_{k=0}^\infty k^2 \frac{(2t)^k\exp(-2t)}{k!} \right) - (2t)^2 \\ &amp;= ... = 4t^2+2t-4t^2 = 2t \end{align}