TITLE: The law of the unconscious statistician
QUESTION [17 upvotes]: In Casella and Berger's Statistical Inference (2nd edition) it says at the start of section 2.2 (page 55) when defining expectations that

If $ \mathrm{E} \,|g(X)| = \infty $ we say that $ \mathrm{E} \,g(X) $ does not exists. (Ross 1988 refers to this as the "law of the unconscious statistician." We do not find this amusing.)

Why

would one call this the "law of the unconscious statistician"? Perhaps it is that I'm not a native speaker of English, but I have really no idea what being "unconscious" has to do with defining existence of expectations.
can this be (or not be) considered amusing?

REPLY [16 votes]: In his lectures on probability, Blitzstein gives the following explanation:
Say you've computed $E(X)$ for some continuous distribution $X$:
$$E(X) = \int_{-\infty}^{\infty} x f_x(x) dx$$
where $f_x(x)$ is the PDF for $X$. Now you're looking to compute the variance: 
 $E(X^2) - [E(X)]^2$.
Now you need to compute $E(X^2)$, which is the expected value of a new distribution, $Y = X^2$: 
$$E(X^2) = E(Y) = \int_{-\infty}^{\infty} y f_y(y) dx$$
Well the unconscious statistician doesn't feel like computing another PDF $f_y$... so instead just reasons by analogy that if $E(X) = \int_{-\infty}^{\infty} x f_x(x) dx$ then surely he can simply replace the x with an $x^2$:
$$E(X^2) = \int_{-\infty}^{\infty} x^2 f_x(x) dx$$
Well that doesn't sound very legitimate! It looks like something he'd derive if he were half asleep or even drunk, but in general, this laziness turns out to be true:
$$E(g(x)) = \int_{-\infty}^{\infty} g(x) f_x(x) dx$$