Skip to main content

An implementation of a few weighted statistics

Project description

Weighted statistics

What?

We've re-implemented some weighted statistics inspired by the weights R package (https://github.com/cran/weights/tree/master). At the moment, it's just the weighted t-test, but this may expand.

How?

import numpy as np
from wstats import wtd_t_test

# Example data for testing
x = np.random.normal(0, 1, 100)
y = np.random.normal(0.5, 1, 100)
wx = np.random.rand(100)
wy = np.random.rand(100)

# Execute tests
# Without bootstrapping
result_no_boot = wtd_t_test(x, y, wx, wy, alternative="two-sided", bootse=False)
# With bootstrapping
result_boot = wtd_t_test(x, y, wx, wy, alternative="two-sided", bootse=True, bootn=int(1e4))

(result_no_boot, result_boot)

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

wstats-0.0.99.tar.gz (3.4 kB view hashes)

Uploaded Source

Built Distribution

wstats-0.0.99-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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