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 ?



Statistical test for boundedness of Expectation
$\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](https://projecteuclid.org/euclid.aos/1176343247), 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." 


