PoissonKernelTest#
- class QuadratiK.poisson_kernel_test.PoissonKernelTest(rho: float, num_iter: int = 300, quantile: float = 0.95, random_state: int | None = None, n_jobs: int = 8)#
Class for Poisson kernel-based quadratic distance tests of Uniformity on the Sphere. More details can be found in the User Guide.
Parameters#
- rhofloat
The value of concentration parameter used for the Poisson kernel function.
- num_iterint, optional
Number of iterations for critical value estimation of Tn-statistic.
- quantilefloat, optional
The quantile to use for critical value estimation.
- random_stateint, None, optional.
Seed for random number generation. Defaults to None.
- n_jobsint, optional.
n_jobs specifies the maximum number of concurrently running workers. If 1 is given, no joblib parallelism is used at all, which is useful for debugging. For more information on joblib n_jobs refer to - https://joblib.readthedocs.io/en/latest/generated/joblib.Parallel.html. Defaults to 8.
Attributes#
- test_type_str
The type of test performed on the data.
- execution_timefloat
Time taken for the test method to execute.
- u_statistic_h0_boolean
A logical value indicating whether or not the null hypothesis is rejected according to Tn.
- u_statistic_tn_float
The value of the Tn-statistic.
- u_statistic_cv_float
The empirical critical value for Tn.
- v_statistic_h0_boolean
A logical value indicating whether or not the null hypothesis is rejected according to Sn.
- v_statistic_sn_float
The value of the Sn-statistic.
- v_statistic_cv_float
The critical value for Sn computed following the asymptotic distribution.
Note#
A Tn-statistic is a type of U-statistic that is used to estimate a population parameter. It is based on the idea of averaging over all possible distinct combinations of a fixed size from a sample. A Sn-statistic is a type of V-statistic that considers all possible tuples of a certain size, not just distinct combinations and can be used in contexts where unbiasedness is not required.
References#
Ding Y., Markatou M., Saraceno G. (2023). “Poisson Kernel-Based Tests for Uniformity on the d-Dimensional Sphere.” Statistica Sinica. doi: doi:10.5705/ss.202022.0347.
Examples#
import numpy as np np.random.seed(0) from QuadratiK.poisson_kernel_test import PoissonKernelTest # data generation z = np.random.normal(size=(200, 3)) data_unif = z / np.sqrt(np.sum(z**2, axis=1, keepdims=True)) #performing the uniformity test unif_test = PoissonKernelTest(rho = 0.7, random_state=42).test(data_unif) print(unif_test)
PoissonKernelTest( Test Type=Poisson Kernel-based quadratic distance test of Uniformity on the Sphere, Execution Time=12.943207263946533 seconds, Tn-Statistic=0.5977824645431932, Tn-Statistic Critical Value=1.596531141687201, Tn-Statistic Null Hypothesis Rejected=False, Sn-Statistic=19.722614852087556, Sn-Statistic Critical Value=23.229486935225513, Sn-Statistic Null Hypothesis Rejected=False, Selected concentration parameter rho=0.7, )
Methods
Function to generate descriptive statistics. |
|
|
Summary function generates a table for the Poisson kernel test results and the summary statistics. |
Performs the Poisson kernel-based quadratic distance Goodness-of-fit tests for Uniformity for spherical data using the Poisson kernel with concentration parameter \(rho\). |
- PoissonKernelTest.stats() DataFrame#
Function to generate descriptive statistics.
Returns#
- summary_stats_dfpandas.DataFrame
Dataframe of descriptive statistics.
- PoissonKernelTest.summary(print_fmt: str = 'simple_grid') str#
Summary function generates a table for the Poisson kernel test results and the summary statistics.
Parameters#
- print_fmtstr, optional.
Used for printing the output in the desired format. Supports all available options in tabulate, see here: https://pypi.org/project/tabulate/. Defaults to “simple_grid”.
Returns#
- summarystr
A string formatted in the desired output format with the kernel test results and summary statistics.
- PoissonKernelTest.test(x: ndarray | DataFrame) PoissonKernelTest#
Performs the Poisson kernel-based quadratic distance Goodness-of-fit tests for Uniformity for spherical data using the Poisson kernel with concentration parameter \(rho\).
Parameters#
- xnumpy.ndarray, pandas.DataFrame
a numeric d-dim matrix of data points on the Sphere \(S^{(d-1)}\).
Returns#
- selfobject
Fitted estimator.