finity-package | R Documentation |

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>.

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 `\mu_k`

of the desired order `k`

of the sample is transformed into a test statistic, which follows a `\chi^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 `\mu_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 `\sqrt{\exp(\mu_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 `\zeta`

(0, or 1, true or false) follows a Bernoulli distribution with mean 1/2 exactly if the `k`

th 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 `\zeta`

such that the resulting test statistic follows a `\chi^2`

exactly if `E(\zeta)=1/2`

, i.e., if the `k`

th 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().

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

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

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

https://github.com/x0range/finity

```
# 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
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.