## Overview

This is an accompanying collection of script files in R and Mathematica, which were used to obtain the numerical results appearing in the paper "A general maximal projection approach to
uniformity testing on the hypersphere" (Borodavka, J. and Ebner, B.). The main Mathematica [file](src/Mathematica/SphericalHarmonicsONB.nb) computes orthonormal bases 
of spherical harmonics with the help of the Mathematica package [HFT.m](https://www.axler.net/HFT_Math.html). The R script files can be used to compute critical values, powers and local Bahadur ARE of the newly proposed test statistic 
from the aforementioned paper and other competing test statistics under the null hypothesis and for different alternative distributions on the hypersphere. Additionally, there is a [script](src/R/Common/Legendre_Polynomial_Alternative.R)
which defines a new alternative distribution on the hypersphere. Each file is complemented with introductory comments, but many more details on implementation are given in the paper.

## Usage

You may clone the repository to your local machine via your command-line interface
```console
git clone https://gitlab.kit.edu/jaroslav.borodavka/maximal-projection-gof.git
```
and then use the scripts in Mathematica or R. Let us give a very simple example on how to used the main R function that was defined in [script](src/R/T_statistic/T_Statistic_Functions.R) under the name `T_stat_value` and corresponds
to the newly proposed test statistic $T_{n \beta}$ from the paper. We can first generate a $3$-dimensional random sample of a von Mises-Fisher distribution on the sphere with the help of the R package [Directional](https://cran.r-project.org/web/packages/Directional/index.html)
```r
> data = rvmf(n=100, mu=c(1,0,0), k=0.5)
> head(data)
            [,1]       [,2]       [,3]
[1,]  0.08000159 -0.7790440  0.6218442
[2,] -0.02382322  0.6844500  0.7286705
[3,] -0.01181251  0.5975516 -0.8017434
[4,] -0.37249581 -0.9211856  0.1125339
[5,]  0.04115439  0.6159393 -0.7867179
[6,]  0.39358746 -0.1732262 -0.9028187
```
and then use the function `T_stat_value` after specifying the hyperparameter `beta` obtain the realization of $T_{n \beta}$
```r
> T_stat_value(data, beta=3)
[1] 2.330788
```

### Authors

- Idea: [Bruno Ebner](https://www.researchgate.net/profile/Bruno-Ebner)
- Code: [Jaroslav Borodavka](https://www.researchgate.net/profile/Jaroslav-Borodavka)