Skip to main content

A few C functions for significance test in Python

Project description

data_significance

Ridge and Logistic regression with a fast implementation of statistical significance test.

Prerequisite:
1, python >= 3.6 developer version. We suggest install anaconda (https://www.anaconda.com) to include all required packages.
2, numpy >= 1.19;
3, pandas >= 1.1.4;
4, gcc >= 4.2;
5, gsl-2.6: https://ftp.gnu.org/gnu/gsl (please don't use other versions, such as 2.7)

Install:
python setup.py install

Test:
python -m unittest tests.regression

Usage:
Call the regression function in python code as follows:
beta, se, zscore, pvalue = data_significance.ridge(X, Y, alpha, alternative, nrand, verbose).

Input:
X: explanatory matrix, numpy matrix in C-contiguous order (last-index varies the fastest).
Y: response variable, numpy matrix in C-contiguous order (last-index varies the fastest).

The row dimension of X and Y should be the same. Y input allows multiple columns, with each column as one input response variable. The function will return the same number of output variables in output matrices (beta, se, zscore, pvalue).

alpha: penalty factor in ridge regression (>= 0). If alpha is 0, we will use regular ordinary least square.
alternative: one-tailed or two-tailed statistical test, with three options: 1, two-sided; 2, greater; 3, less.
nrand: number of randomizations (>=0). If nrand = 0, we will use student t-test for the statistical test. Otherwise, we will use permutation test.
verbose: 1 or 0. Report intermediate results.

Output:
beta: regression coefficient.
se: standard error.
zscore: beta/se.
pvalue: statistical significance from permutation test (nrand>0) or student t-test (nrand=0).

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

data_significance-1.3.tar.gz (23.1 kB view details)

Uploaded Source

File details

Details for the file data_significance-1.3.tar.gz.

File metadata

  • Download URL: data_significance-1.3.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for data_significance-1.3.tar.gz
Algorithm Hash digest
SHA256 61db2bb081a621f26337f39146bdecee16718f737d73af7b878fd1b6d49950e3
MD5 6582bbecf6646c45afcc16fc5d3448fc
BLAKE2b-256 54bc3bfcfd748192753966dcc19d15296dd32a1447322d72c3555fc138fe7953

See more details on using hashes here.

Supported by

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