Skip to main content

Spacings

Project description

spacings

This python package implements several test statistics based on spacings, i.e. the spaces between ordered samples. The API is similar to scipy's tests, such as the kstest.

Installation

pip install spacings

Usage Example

import numpy as np
from spacings import rps, moran
from scipy.stats import kstest, cramervonmises

Generate random samples

rand = np.random.RandomState(0)
uniform = rand.rand(100)
  • RPS test:
>>> rps(uniform, "uniform")
RPStestResult(statistic=0.9861622857523498, pvalue=0.6747286655166371)
  • Moran test:
>>> moran(np.random.rand(100), "uniform")
MorantestResult(statistic=525.7712608675467, pvalue=0.3920410695917047)
  • KS test (scipy):
>>> kstest(uniform, "uniform")
KstestResult(statistic=0.0736727958814345, pvalue=0.6226614157861845)
  • Cramer von Mises test (scipy):
>>> cramervonmises(uniform, "uniform")
CramerVonMisesResult(statistic=0.1203440927515015, pvalue=0.4947678804693505)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spacings-0.0.4.tar.gz (218.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page