Skip to main content

Python implementation of Logistic Regression with Firth's bias reduction

Project description

firthlogist

PyPI 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_
bse = firth.bse_

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.

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.1.tar.gz (26.6 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: firthlogist-0.1.1.tar.gz
  • Upload date:
  • Size: 26.6 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.1.tar.gz
Algorithm Hash digest
SHA256 3b0d0edc4537c36132370d1a665de28758519d44a2e6bf80d3bc529d7b84cdc8
MD5 84e5253f42de4350113de37ed848b0cc
BLAKE2b-256 913c10ecdef55f082d325d80d36d04f95aacbb473fb1f07a5a222e1838f6da0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firthlogist-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5e2fb3b01ca44bf402565359a78058312b23662ef50facc9985801c5f690505
MD5 f9e44ed67c86641d5838099c06720cb7
BLAKE2b-256 b2d306202a65d6706d1f25badf40dd43ab4b9c4697402dfc350d4d0cd0948de5

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