Skip to main content

Python implementation of Logistic Regression with Firth's bias reduction

Project description

firthlogist

PyPI PyPI - Downloads GitHub

A Python implementation of Logistic Regression with Firth's bias reduction.

WIP!

Installation

pip install firthlogist

Usage

firthlogist follows the sklearn API.

from firthlogist import FirthLogisticRegression

firth = FirthLogisticRegression()
firth.fit(X, y)
coefs = firth.coef_
pvals = firth.pvals_

Parameters

max_iter: int, default=25

 The maximum number of Newton-Raphson iterations.

max_halfstep: int, default=1000

 The maximum number of step-halvings in one Newton-Raphson iteration.

max_stepsize: int, default=5

 The maximum step size - for each coefficient, the step size is forced to be less than max_stepsize.

tol: float, default=0.0001

 Convergence tolerance for stopping.

fit_intercept: bool, default=True

 Specifies if intercept should be added.

skip_lrt: bool, default=False

 If True, p-values will not be calculated. Calculating the p-values can be expensive since the fitting procedure is repeated for each coefficient.

Attributes

bse_

 Standard errors of the coefficients.

classes_

 A list of the class labels.

coef_

 The coefficients of the features.

intercept_

 Fitted intercept. If fit_intercept = False, the intercept is set to zero.

loglik_

 Fitted penalized log-likelihood.

n_iter_

 Number of Newton-Raphson iterations performed.

pvals_

 p-values calculated by penalized likelihood ratio tests.

References

Firth, D (1993). Bias reduction of maximum likelihood estimates. Biometrika 80, 27–38.

Heinze G, Schemper M (2002). A solution to the problem of separation in logistic regression. Statistics in Medicine 21: 2409-2419.

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

firthlogist-0.1.2.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

firthlogist-0.1.2-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file firthlogist-0.1.2.tar.gz.

File metadata

  • Download URL: firthlogist-0.1.2.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.5 Linux/5.17.5-76051705-generic

File hashes

Hashes for firthlogist-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0135de8af5121041266366d55d07855e27b776606abad4d7ff3c0a252981e963
MD5 6009385ba2d7619770ef3b15f9f601b1
BLAKE2b-256 d932a68d33b45efc73400d3f3e2dcc7356d491b958b7d5d46cc506c16fe6b0e2

See more details on using hashes here.

File details

Details for the file firthlogist-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: firthlogist-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.5 Linux/5.17.5-76051705-generic

File hashes

Hashes for firthlogist-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d777db68c8a535721c03eaca05b2312cf5b2b51e5c34f6feeff77ea72dbd144
MD5 09745de3510c2a80ef71a82b1b984ff9
BLAKE2b-256 a609f9236abbfaf34fcc476a9711fd85b54a633193224f9c55ba8b9fede7d305

See more details on using hashes here.

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