knitr::opts_chunk$set( collapse = TRUE, comment = "#>", message = FALSE, warning = FALSE )
library(sstn)
The SSTN package provides the Self-Similarity Test for Normality (SSTN), a statistical test designed to assess whether a given numeric sample originates from a normal distribution.
The SSTN relies on iteratively estimating the characteristic function of the sum of i.i.d. random variables based on the standardized data and comparing it to the characteristic function of the standard normal distribution.
A Monte Carlo procedure is used to generate the distribution of the test statistic under the null hypothesis, which allows computation of a $p$-value.
sstn()
: This is the primary function of the package, which performs the SSTN to assess whether a given numeric sample originates from a normal distribution. The function returns a $p$-value indicating the significance of the deviation from normality.Below, we provide a brief example of how to use the sstn()
function.
set.seed(123) # Sample from standard normal (null hypothesis true) x <- rnorm(100) res <- sstn(x) res$p_value # Sample from Gamma distribution (null hypothesis false) y <- rgamma(100, 1) res2 <- sstn(y) res2$p_value
For more detailed information on the methods used in this package, please refer to the following publication:
Anarat A. and Schwender, H. (2025). A normality test based on self-similarity. Submitted.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.