Analogy expectation of an observable / random variable I'm trying to figure out the analogies between the expectation of a random variable $X$ and the expectation of an observable of a quantum mechanical system $A$ (using this wikipedia article). 
The expectation of $A$ is
$$\mathbb{E}(A)\equiv\int_\mathbb{R}\lambda\text{d}\text{D}_A(\lambda)\,,$$
where the distribution of $A$ under $S$ is 
$$\text{D}_A(U)\equiv\text{Tr}(\text{E}_A(U)S)\,,$$
where $S$ is a given state (i.e. density operator) and the spectral measure is
$$\text{E}_A(U)\equiv\int_U\lambda\text{d}\text{E}(\lambda)\,,$$
(where $\text{E}(\lambda)$ is the spectral projection of $A$?)
Does anybody know to how to define $\text{D}_X(\lambda)$ for a random variable in a way similar to $\text{D}_A(\lambda)$ such that 
$$\mathbb{E}(X)\equiv\int_\mathbb{R}\lambda\text{d}\text{D}_X(\lambda)\,,$$
and the analogy is complete? Also, to what does $E_A(U)$ correspond in the case of a random variable?
Partial attempt: 


*

*the state $S$ corresponds to the probability measure $P$

*the distribution of $X$ under $P$ can be defined as $P(X\in U)$, which is
$$D_X(U)=\int 1_{X\in U}\text{d}P\,,$$
but I still don't know how to write this like a trace of the form $\text{Tr}(\cdots P)$. 

 A: A (real) Classical Random Variable is usually defined as a map $X: \Omega \rightarrow \mathbb R$, where $\Omega$ and $\mathbb R$ are assumed to be measurable spaces with sigma algebras $\Sigma$ and $\mathscr B$. 
If we take a specific probability measure $P$ on $\Omega$, then it induces a probability measure $D_{X}$ on $\mathbb R$ given by: $$D_{X} (U) := P(X^{-1}(U)),  \text{ } U\in\mathscr{B} $$. 
Defining $D_{X}(\lambda)={D_{X}({({-\infty},\lambda]})}$, we get $$\mathbb{E}(X)\equiv\int_\mathbb{R}\lambda\text{d}\text{D}_X(\lambda)$$
You got close, but I think the problem is making the clear symbolic distinction between the underlying space $\Omega$ of the random variable $X$, and its target space $\mathbb{R}$. You need to do this to see a full parallel with the quantum case, in which: $\Omega \leftrightarrow \mathscr{H}$,$X \leftrightarrow A$, $P \leftrightarrow S$, and $P(X^{-1}(U)) \leftrightarrow \text{Tr}(\text{E}_A(U)S)$.
Here I've tried to limit myself to your specific question, and to use your notation. However, I've given a more elaborate and less superficial analogy (with, I think, a better notation) between classical and quantum probability theory in this answer, if you're interested.
