Python implementation of Logistic Regression with Firth's bias reduction
Project description
firthlogist
A Python implementation of Logistic Regression with Firth's bias reduction.
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=25
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.
pl_max_iter
: int, default=100
The maximum number of Newton-Raphson iterations for finding profile likelihood confidence intervals.
pl_max_halfstep
: int, default=25
The maximum number of step-halvings in one iteration for finding profile likelihood confidence intervals.
pl_max_stepsize
: int, default=5
The maximum step size while finding PL confidence intervals - 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.
skip_ci
: bool, default=False
If True, confidence intervals will not be calculated. Calculating the confidence intervals via profile likelihoood is time-consuming.
Attributes
bse_
Standard errors of the coefficients.
classes_
A list of the class labels.
ci_
The fitted profile likelihood confidence intervals.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for firthlogist-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e2309e997d013e4001779c9dbc173bb6ffd1995b993f7c9c93eeb77e64fd736 |
|
MD5 | e77ec5b6a0db1707b3cd89fa02ac7efd |
|
BLAKE2b-256 | 28310c65e00a26144f824a177416d18657d8f2320fc3cd207f885228325e5701 |