Statistical test for boundedness of Expectation I have $n$
i.i.d samples from a unknown distribution. I want to prove or disprove that the mean is finite. Are there any statistical test for this hypothesis ?
 A: $\newcommand{\al}{\alpha}
\newcommand{\de}{\delta}
\newcommand{\De}{\Delta}
\newcommand{\ep}{\epsilon}
\newcommand{\ga}{\gamma}
\newcommand{\Ga}{\Gamma}
\newcommand{\la}{\lambda}
\newcommand{\Si}{\Sigma}
\newcommand{\thh}{\theta}
\newcommand{\R}{\mathbb{R}}
\newcommand{\E}{\operatorname{\mathsf E}} 
\newcommand{\PP}{\operatorname{\mathsf P}} 
\newcommand{\EE}{\mathcal E}
\newcommand{\F}{\mathcal F}
\newcommand{\I}{\mathcal I}
\newcommand{\x}{\mathbf x}
\newcommand{\size}{\text{size}}
\newcommand{\pow}{\text{power}}
\newcommand{\st}{\text{stupid}}$
Intuitively, it seems clear that no "really good" test can exist for the finiteness of the mean, the reason being that distributions with infinite or no mean may be however close, in an appropriate sense, to distributions with finite mean -- and such distributions would be practically impossible to distinguish from each other. 
Let us provide a rigorous statement in this regard. Let $\F$ and $\I$ denote the sets of all probability distributions $P$ (say on $\R$) with finite means and with infinite/no means, respectively; so, $\F\cup\I$ is the set of all probability distributions $P$ on $\R$. Say the null hypothesis $H_0$ about the unknown distribution $P$ here is that $P\in\F$ (that is, of finite mean) and the alternative hypothesis $H_1$ is that $P\in\I$ (that is, of infinite/no mean). 
A (possibly randomized) test $\de$ is a Borel-measurable function from $\R^n$ to $[0,1]$, which works as follows: if we get a sample $\x\in\R^n$, then the null hypothesis is rejected with probability $\de(\x)$; in particular, $\de$ is a non-randomized test if $\de$ takes only values $0$ or $1$. The size of a test $\de$ is then 
\begin{equation*}
 \size(\de):=\sup_{P\in\F} P^{\otimes n}\de,
\end{equation*}
the supremum of the type I error probability -- of rejecting $H_0$ while $H_0$ holds, where $P^{\otimes n}\de:=\E_{P^{\otimes n}}\de:=\int\de\,dP^{\otimes n}$ and $\otimes$ denotes the product measure --  corresponding to the iid sampling assumption. Usually, one chooses some so-called significance level $\al\in(0,1)$ (most often, $\al=0.05$) to require that 
\begin{equation}
 \size(\de)\le\al, \tag{1}
\end{equation}
to control the type I error probability. Given condition (1) on a test $\de$, one then wants to maximize 
\begin{equation*}
 \pow_Q(\de):=Q^{\otimes n}\de
\end{equation*}
over all such tests $\de$, 
for some or all distributions $Q$ in the "alternative" set $\I$, which is equivalent to the minimization of the type II error probability $1-Q^{\otimes n}\de$, of not rejecting the null hypothesis $H_0$ while the alternative hypothesis holds. 
There always is the "stupid" test $\de_\st$ such that $\de_\st(\x)=\al$ for all samples $\x$ (which completely disregards the "data" $\x$ observed), so that the $\pow_P(\de_\st)=\al$ for all $P$, whence (1) holds. Thus, for any given $\al\in(0,1)$, it is always possible to get a test of  significance level $\al$ whose power is $\al$ for all distributions $P$; since $\al$ is usually small, this power level is of course quite low; that is, usually the type II error probability $1-\pow_P(\de_\st)=1-\al$ is very large for the "stupid" test. 
Let us show that in our situation for any test $\de$ there will be alternative distributions $Q$ (with  infinite/no mean) at which the power $Q^{\otimes n}\de$ of the test $\de$ is however close to (or even less than) the power $P^{\otimes n}\de_\st$ of the "stupid test" $\de_\st$ of size $\al$: 
\begin{equation}
 \al:=\sup_{P\in\F} P^{\otimes n}\de\ge\inf_{Q\in\I}Q^{\otimes n}\de. \tag{2}
\end{equation}
This will explain why, to get a test perceptibly better than the "stupid" one, one needs to restrict the set of alternative distributions (and also possibly the set of the null distributions), which is what happens when a specific model is chosen (hopefully with good justification, based on the real-world situation). 
The proof of (2) is very simple and follows the intuition expressed in the beginning of this answer. Indeed, take any distributions $P\in\F$ and $Q\in\I$, so that $P$ is of finite mean and $Q$ is of infinite/no mean. For any $t\in(0,1)$, let $Q_t:=(1-t)P+tQ$; then $Q_t\in\I$, whence 
\begin{equation*}
\inf_{Q\in\I}Q^{\otimes n}\de\le 
Q_t^{\otimes n}\de=\sum_{J\subseteq[n]}\,(1-t)^{n-|J|}\,t^{|J|}\,\bigotimes_{j\in[n]}R^J_j\de
\underset{t\downarrow0}\longrightarrow P^{\otimes n}\de
\le\sup_{P\in\F} P^{\otimes n}\de,  
\end{equation*}
where $[n]:=\{1,\dots,n\}$, $|J|$ denotes the cardinality of the set $J$, and 
\begin{equation*}
 R^J_j:=\begin{cases} 
 Q&\text{ if }j\in J, \\
 P&\text{ if }j\notin J. 
 \end{cases}
\end{equation*}
Thus, (2) is proved. 

Added in response to a comment by the OP: There is a large amount of literature on the so-called tail index estimation; for power-like tails $1-F(x)$ of the form $x^{-\al}\ell(x)$, where $F$ is the cumulative distribution function and $\ell$ is a slowly varying function, $\al$ is called the tail index. This should be relevant in your situation, since the mean of the distribution will be finite for $\al>1$ and infinite for $\al<1$. Google e.g. "tail index estimation" or "tail index estimation in small samples". This stream of literature seems to be based on the paper by B. Hill, where, according to the abstract there, "[i]t is not required to assume any global form for the distribution function, but merely the form of behavior in the tail where it is desired to draw inference." 
A: Here is a way of doing it. Let assume for convenience that you can have as many sample of unknown distribution as you wanted. We also ignore the sign issue and assume $X\ge 0$. 
1st step: Generate one million random sample of $\sqrt{X}$. 
2nd step: Compute the sample mean, let it be $Y$. Then let 
$$
Z=\frac{1}{10^{6}}\sum \sqrt{X_{i}}
$$
3rd step: Repeat step 2 one million times. Let the generated sample to be $(Z_1,\cdots,Z_{10^6})$. Let the sample mean to be $W$, and substract $W$ from $Z_{i}$ to form $(W_{1},\cdots, W_{10^{6}})$
4th step: Do a QQ plot with $W_{i}/(\sigma/1000)$, $\mu=0$ or carry out any other equivalent normality tests, if the $P$-value is small, reject the hypothesis that $E|X|<\infty$. 
The idea is really simple, if $E|X|<\infty$, then $E|\sqrt{X}|$ exists as well and we may apply CLT to $\sqrt{X_{i}}$ and check its normality. I am not sure if this is killing a fly with a hammer, though. 
A: Suppose you plan to draw $n$ samples. Consider the following distribution:


*

*with probability $\frac{1}{2^n}$: draw from standard Cauchy

*with remaining probability: equal to zero


This has infinite expectation, but you cannot distinguish it (with non-negligible probability) from an always-zero random variable.
