---
title: "Uniformity test on the Sphere"
author: "Giovanni Saraceno"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Uniformity test on the Sphere}
  %\VignetteEngine{knitr::rmarkdown}
  \usepackage[utf8]{inputenc}
---

### Uniformity test on the Sphere
```{r srr-tags, eval = FALSE, echo = FALSE}
#' srr tags
#' 
#' 
#' @srrstats {G1.5} Uniformity test example in the associated paper
```
We generated $n=200$ observations from the uniform distribution on $S^{d-1}$, with $d=3$, and $\rho = 0.7$. 
```{r}
library(QuadratiK)
n <- 200
d <- 3
set.seed(2468)
z <- matrix(rnorm(n * d), n, d)
dat_sphere <- z/sqrt(rowSums(z^2))
```

The ``pk.test`` is used for testing uniformity of the generated sample. 
```{r}
rho <- 0.7
set.seed(2468)
res_unif <- pk.test(x=dat_sphere, rho=rho)

res_unif
```

The ``summary`` method for the ``pk.test`` output object provides the results of the performed test, and generates a figure showing the qq-plots against the uniform distribution of each variable with a table of standard descriptive statistics. 
```{r fig.width=6, fig.height=8}
summary_unif <- summary(res_unif)
```

The figure automatically generated by the ``summary`` function on the result of the test for uniformity displays the  qq-plots between the given samples and the uniform distribution with a table of the standard descriptive statistics for each variable.
