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 ?

$\begingroup$ Not in that form. But you can test: which fits this data better, a normal distribution or a Cauchy distribution? $\endgroup$ – Matt F. Apr 4 '18 at 16:47

1$\begingroup$ @MattF. But isn't Cauchy one of the infinitely many ways expectation can be unbounded, would testing for Cauchy test still be appropriate if the true distribution is different ? $\endgroup$ – san Apr 4 '18 at 17:00

$\begingroup$ Of course, keep going with other families if you like, and keep testing to show that most do not provide good fits! This is just an example that would allow you to say: “the best fit among these two families of distributions has an undefined mean.” $\endgroup$ – Matt F. Apr 4 '18 at 17:21

1$\begingroup$ As the OP acknowledges in a comment to my answer, the question should have been expressed better. However, that same comment makes me think that there may indeed be research interest behind the question. $\endgroup$ – Iosif Pinelis Apr 5 '18 at 12:36

1$\begingroup$ There are techniques for estimating the tails of a distribution, which are appropriate for power laws, and depending on the power you get you believe your rv either has a mean or not. I remember one of them is called Hill's test, but I can't find it in Wikipedia. It and another technique are exposed in this book amazon.com/QuantitativeRiskManagementTechniquesPrinceton/dp/… $\endgroup$ – user83457 Apr 5 '18 at 13:24
$\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 Borelmeasurable 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 nonrandomized 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 socalled 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 $1Q^{\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 realworld 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:=(1t)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]}\,(1t)^{nJ}\,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 socalled tail index estimation; for powerlike tails $1F(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."

$\begingroup$ I agree with the result, but this seems more than the question warrants. $\endgroup$ – Matt F. Apr 5 '18 at 1:21

1$\begingroup$ @MattF. : I wanted to explain details of statistical testing to people who may not be quite familiar with it. That took some space. Also, it is usually not so easy to prove nonexistence; cf. e.g. the paper "The Nonexistence of Certain Statistical Procedures in Nonparametric Problems" by Bahadur projecteuclid.org/euclid.aoms/1177728077 $\endgroup$ – Iosif Pinelis Apr 5 '18 at 1:27

$\begingroup$ I understood this intuitively at the time of posing the question, so I appreciate your time to make it rigorous. I should have framed it better. What I had in mind was  given that I need to distinguish between the bounded and unbounded expectations how much can one weaken the setting from the easy case of a distinguishing between two parametric distributions of finite and infinite expectations. For example growth rate on $E[X^\alpha]$ for $\alpha \uparrow1$, or unimodality, or monotonicity or smoothness etc. There must be literature on such criteria, would appreciate pointers $\endgroup$ – san Apr 5 '18 at 5:54

$\begingroup$ @san : I have added pointers to what I think is relevant literature. $\endgroup$ – Iosif Pinelis Apr 5 '18 at 12:28

$\begingroup$ @IosifPinelis Thanks a lot for adding the citations. I have been reading up on Hill estimators and their likes the past few months. It seems the question of how best to estimate where the tail starts (needed in the computation of the estimators) hasn't been satisfactory settled yet. $\endgroup$ – san Apr 5 '18 at 19:34
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 $EX<\infty$.
The idea is really simple, if $EX<\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.

$\begingroup$ With this setup, the mean of W’s will be 0, so the tstatistic will be 0 too. $\endgroup$ – Matt F. Apr 5 '18 at 1:15

$\begingroup$ A number of questions here. The first one: how do you "Generate one million random sample of $\sqrt{X}$"? The distribution of $X$ is unknown  otherwise there is no need for any statistical tests. $\endgroup$ – Iosif Pinelis Apr 5 '18 at 1:17

$\begingroup$ @IosifPinelis: You just generate one million sample of $X$ and take the square root. $\endgroup$ – Bombyx mori Apr 5 '18 at 1:20

$\begingroup$ @MattF. You do not take the mean of $W_{i}$, which has already been normalized. You use the equivalence of $t$test to normalize $W_{i}$ by dividing $\sigma/1000$, then compare it with the normal distribution via something like QQ plot, etc. $\endgroup$ – Bombyx mori Apr 5 '18 at 1:23

$\begingroup$ @Bombyxmori : How do you "generate one million sample of $X$"? (Of course, taking the square roots is no problem.) $\endgroup$ – Iosif Pinelis Apr 5 '18 at 1:30
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 nonnegligible probability) from an alwayszero random variable.

$\begingroup$ Isnt it reasonable to keep the distribution independent of the number of samples. But of course one should be able to construct cases even with that restriction. $\endgroup$ – san Apr 5 '18 at 5:31

$\begingroup$ @san Think about it this way: For any choice of $n$ samples to draw, there exist cases where you cannot successfully tell apart finite and infinite mean. Now probably it is true that for any pair of distributions, there is some number $n$ of samples that suffice to tell them apart, but you would have to know this pair in advance in order to pick $n$. If you are picking $n$ without such info, then there are cases you will fail. $\endgroup$ – usul Apr 5 '18 at 13:20