Skip to content

Commit b64ea94

Browse files
authored
fixed file path as suggested (#5710)
* Create statsmodels.md 'MarioSuperFui' * Create logit.md * Delete docs/content/python/concepts/statsmodels directory * Update logit.md * Updated file path logit.md * Removed logit.md * logit.md in the correct filepath directory * Formatted logit.md using Prettier * Fix formatting with Prettier * Delete logit.md * Minor changes --------
1 parent 913853b commit b64ea94

File tree

2 files changed

+72
-0
lines changed
  • content/python/concepts/statsmodels/terms/logit
  • documentation

2 files changed

+72
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
Title: 'Logit'
3+
Description: 'Returns the log-odds of a binary outcome using logistic regression.'
4+
Subjects:
5+
- 'Python'
6+
- 'Statistics'
7+
Tags:
8+
- 'Logit'
9+
- 'Logistic Regression'
10+
- 'Statsmodels'
11+
CatalogContent:
12+
- 'learn-statistics'
13+
- 'paths/data-science-inf'
14+
---
15+
16+
**Logit** is a term used in statistics, specifically in the context of logistic regression. It represents the log-odds of a binary outcome, mapping probabilities from the 0 to 1 range to the entire real number line. The **`.Logit()`** function is a key part of many statistical models, particularly in binary classification tasks.
17+
18+
## Syntax
19+
20+
```pseudo
21+
statsmodels.api.Logit(endog, exog)
22+
```
23+
24+
- `endog`: The dependent (binary) variable, which must be a binary outcome (0 or 1).
25+
- `exog`: The independent variables (features or predictors).
26+
27+
## Example
28+
29+
This example demonstrates how to use the `.Logit()` function in the `statsmodels` library to perform logistic regression:
30+
31+
```py
32+
import statsmodels.api as sm
33+
34+
# Example data
35+
X = sm.add_constant([[1], [2], [3], [4], [5]]) # Adding a constant for the intercept
36+
y = [0, 0, 1, 1, 1]
37+
38+
# Fitting the logistic regression model
39+
model = sm.Logit(y, X)
40+
result = model.fit()
41+
42+
# Output the results
43+
print(result.summary())
44+
```
45+
46+
> **Note:** The dependent variable (`y`) must contain only binary values (0 or 1) for the logistic regression to be valid.
47+
48+
This example produces a summary of the logistic regression model's results, showing coefficients, standard errors, p-values, and other statistics relevant to evaluating the model fit:
49+
50+
```shell
51+
Logit Regression Results
52+
==============================================================================
53+
Dep. Variable: y No. Observations: 5
54+
Model: Logit Df Residuals: 3
55+
Method: MLE Df Model: 1
56+
Date: Tue, 24 Dec 2024 Pseudo R-squ.: 1.000
57+
Time: 12:28:45 Log-Likelihood: -5.0138e-10
58+
converged: False LL-Null: -3.3651
59+
Covariance Type: nonrobust LLR p-value: 0.009480
60+
==============================================================================
61+
coef std err z P>|z| [0.025 0.975]
62+
------------------------------------------------------------------------------
63+
const -110.4353 2.23e+05 -0.000 1.000 -4.38e+05 4.38e+05
64+
x1 44.2438 9.07e+04 0.000 1.000 -1.78e+05 1.78e+05
65+
==============================================================================
66+
67+
Complete Separation: The results show that there iscomplete separation or perfect prediction.
68+
In this case the Maximum Likelihood Estimator does not exist and the parameters
69+
are not identified.
70+
```

documentation/tags.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ Lists
209209
Logic
210210
Logical
211211
Logistic Regression
212+
Logit
212213
Loops
213214
Map
214215
Machine Learning
@@ -315,6 +316,7 @@ SQL Server
315316
Stacks
316317
Static Site
317318
Statistics
319+
Statsmodels
318320
Storage
319321
Stringr
320322
Strings

0 commit comments

Comments
 (0)