# finity-package: Test for Finiteness of Moments in a Distribution In finity: Test for Finiteness of Moments in a Distribution

## Description

The purpose of this package is to tests whether a given moment of the distribution of a given sample is finite or not. For heavy-tailed distributions with tail exponent b, only moments of order smaller than b are finite. Tail exponent and heavy- tailedness are notoriously difficult to ascertain. But the finiteness of moments (including fractional moments) can be tested directly. This package does that following the test suggested by Trapani (2016) <doi:10.1016/j.jeconom.2015.08.006>.

## Details

The main function of the package, which performs the test for the finiteness of moments, is

finite_moment_test().

The test assumes a sample drawn from an unknown distrubution F. Given this sample, the finiteness or infiniteness of any moment of order k of distribution F can be ascertained. For this, the test follows a randomised testing procedure with artificial randomness. The absolute sample moment μ_k of the desired order k of the sample is transformed into a test statistic, which follows a χ^2 distribution with one degree of freedom exactly if the moment of the same order k of F is not finite. The null hypothesis in the test is that the moment is infinite; the alternative is that it is finite.

It should be noted that while the moment of order k of F may be infinite, the sample moment μ_k is always finite because the sample is of finite size. The sample moment will, however, diverge with growing sample size if the moment of the same order k of the original distribution F is not finite.

The test works as follows: A standard normal distribution is rescaled with √{\exp(μ_k)}, yielding a normal distribution with mean 0 and either finite or infinite variance, depending on whether the hypothesis holds. For every observation of the resulting distribution, it is then tested, if the observation is located within an interval [-u, u]. The resulting binary quantity ζ (0, or 1, true or false) follows a Bernoulli distribution with mean 1/2 exactly if the kth moment of F is infinite. Otherwise the mean is not 1/2. Sampling a number of different intervals characterized by different bounds u drawn from a distribution with finite support, the test aggregates over quantities ζ such that the resulting test statistic follows a χ^2 exactly if E(ζ)=1/2, i.e., if the kth moment of F is infinite.

Trapani (2016) offers some insights into the performance of the test and the impact its parameters have. These parameters are optional arguments of the testing function finite_moment_test().

## Author(s)

Torsten Heinrich [aut, cre], Julian Winkler [aut]

Maintainer: Torsten Heinrich <torsten.heinrich@posteo.net>

## References

Trapani, Lorenzo (2016), 'Testing for (in)finite moments', Journal of Econometrics 191(1), 57 – 68.

 ```1 2 3 4 5 6 7 8``` ```# Generate sample rvs <- stabledist::rstable(100000, 1.9, 0.5, 1, 0, pm = 0) # Perform test result <- finite_moment_test(rvs, 2) # Print results message(paste("Test statistic:", result[1], "p-value:", result[2], "\n\n")) # More examples are included in https://github.com/x0range/finity/examples ```