How do you calculate the mean and variance of a random var with a distribution function that has a parameter with its own distribution function? I am busy with ruin theory. 
$$
S(t) = \sum_{i=1}^{N(t)}  X_i
$$
$S(t)$ is the aggregate claim size after $t$ years, where $X_i$ is the individual claim size (with mean and variance given) and $N(t)$ is the number of claims that follow a Poisson distribution with parameter $\lambda$, and it is assumed that $\lambda$ has an exponential distribution with given mean. 
Now since $N(t)$ has a Poisson distribution, $S(t)$ has a Compound Poisson distribution with parameter $\lambda$, right?
Then is the expected value of $S(t)$:
$E[S(t)] = E[N(t)]\cdot E[X_i]$
$\,\:\quad\qquad   = (E[\lambda]\cdot t)\cdot E[X_i]\,$   ?
I am specifically confused about the $E[N(t)]$ part, does it include the $t$ variable even though it is only distributed Poisson($\lambda$) or not?
And then do you use $E[\lambda]$ or only $\lambda$ in calculating the $E[N(t)]$?
Also, the variance of $N(t)$, is it equal to the variance of $\lambda$ or the expected value of $\lambda$? And again should it be multiplied by $t$ even though $t$ is not given as part of the parameter in the question?
Would be so glad if anyone can help. And please ask if there is any more information needed to answer the question.
 A: Generally, the parameter of a Poisson distribution is defined as the distribution mean. However, for ruin theory, the expected number of claims increases with time, and should not be equal for different times, as having a time-independent $\lambda$ would imply. It is more likely that $\lambda$ is the rate parameter of the Poisson process $N(t)$, then $S(t)$ is a compound Poisson process with rate $\lambda$.
Following the linked article, $E[S(t)]$ is as given by the OP. The last step requires another application of the law of total expectation:
$$
E[N(t)]=E[E[N(t)|\lambda]]=E[\lambda t]=E[\lambda]t
$$
since $\lambda$ is not constant but random.
The variance of $N(t)$ is given by the law of total variance:
$$
Var[N(t)]=E[Var[N(t)|\lambda]]+Var[E[N(t)|\lambda]]=E[\lambda t]+Var[\lambda t]=E[\lambda]t+(E[\lambda]t)^2
$$
since $\lambda$ is exponentially distributed.
A: In the definition of the compound Poisson process, there is an underlying assumption that, as hinted by @Xian, the random variables $X_{i}$'s are i.i.d. as well as independent of $N(t)$. To compute $E[S(t)]$, consider 
\begin{eqnarray*}
% \nonumber to remove numbering (before each equation)
  E\left[S(t)|N(t)=n\right] &=& E\left[X_{1}+X_{2}+\cdots +X_{N(t)}|N(t)=n\right] \\
   &=& E\left[X_{1}+X_{2}+\cdots +X_{n}\right]\\
   & & \quad\quad\quad\quad\quad\mbox{ since X's and N(t) are independent RV's}\\
   &=& n E[X], \quad\quad\mbox{ since $X_{i}'s$ are iid RV's}
\end{eqnarray*}
Multiplying on both sides by $P\left\{N(t)=n\right\}$ and taking summation over all possible values of $n$, we get,
\begin{eqnarray*}   
  E\left[S(t)\right] &=& \sum_{n}\underbrace{E\left(S(t)|N(t)=n\right)}_{n\cdot E[X]} P\left\{N(t)=n\right\}\\
  &=& \sum_{n} n\cdot E[X]\cdot P\left\{N=n\right\}\\
  &=&E(X)\cdot \sum_{n}n\cdot P\left\{N=n\right\}\\
  E\left[S(t)\right] &=& E[X]\cdot E[N(t)] = (\lambda t) \cdot E[X]
\end{eqnarray*}
since $\{N(t), t\geq 0\}$ is Poisson process, $E[N(t)] = \lambda t$.
In order to find an expression for $Var[S(t)]$, first find the second conditional moment of $S(t)$.
\begin{eqnarray*}
  E(S(t)^{2}|N(t)=n) &=& E[(X_{1}+X_{2}+\cdots +X_{N(t)})^{2}|N(t)=n] \\
   &=& E[(X_{1}+X_{2}+\cdots +X_{n})^{2}]\\
   &=& E\left\{\sum_{i=1}^{n}X_{i}^{2}+2\sum_{i<j}X_{i}X_{j}\right\}\\
   &=& \sum_{i=1}^{n}E\left(X_{i}^{2}\right) + 2 \sum_{i<j} E\left(X_{i}\right)E\left(X_{j}\right)\\
   &=& n\cdot E\left(X^{2}\right) + 2\cdot \frac{n(n-1)}{2}E\left(X\right)E\left(X\right)\\
   &=& n\cdot E\left(X^{2}\right) + n(n-1)\left(E(X)\right)^{2}\\
   &=& n[E(X^{2})-(E(X))^{2}] + n^{2}(E(X))^{2}\\
 E(S(t)^{2}|N(t)=n) &=& n Var(X) + n^{2}(E(X))^{2}
\end{eqnarray*}
Now
\begin{eqnarray*}
  Var(S(t)) &=& E(S(t)^{2}) - \left[E(S(t))\right]^{2} \\
   &=& \sum_{n}E(S(t)^{2}|N(t)=n)P\{N(t)=n\}-[E(X)E(N(t))]^{2}\\
   &=&\sum_{n}\left[nVar\left(X\right)+n^{2}\left(E\left(X\right)\right)^{2}\right] P\left\{N(t)=n\right\} -\left[E(X)E(N(t))\right]^{2}\\
   &=& Var(X) \sum_{n}nP\left\{N(t)=n\right\} + \left(E\left(X\right)\right)^{2}\sum_{n}n^{2}P\left\{N(t)=n\right\} - \left[E(X)E(N(t))\right]^{2}\\
   &=&E(N(t))Var(X) + \left(E\left(X\right)\right)^{2} \left[E(N(t)^{2})-(E(N(t)))^{2}\right]\\
   & = & E[N(t)\cdot Var[X] + Var[N(t)]\cdot (E[X])^{2}\nonumber\\
   & =& \lambda t\cdot Var[X] + \lambda t\cdot (E[X])^{2}\nonumber\\
   &=& \lambda t\cdot [Var[X] + (E[X])^{2}]\nonumber\\
   Var[S(t)]&=& \lambda t\cdot E[X^{2}]   
\end{eqnarray*}
