| name | regression-modeler |
| description | Run regression analysis (OLS or logistic) on uploaded CSV/Excel data, generating coefficients, R², p-values, VIF, and plain-language interpretation. Triggered by requests for regression modeling, fitting data, testing significance, checking multicollinearity, or keywords like OLS, logit, coefficient, p-value, or R-squared. |
| license | MIT |
regression-modeler
Automated regression modeling tool — performs linear regression (OLS) or logistic regression (Logit) on tabular data, producing comprehensive statistical results with plain-language interpretation.
Capabilities
| Feature | Description |
|---|
| Linear Regression | OLS with coefficients, R², adjusted R², F-test, AIC/BIC, Durbin-Watson |
| Logistic Regression | Logit with coefficients, Odds Ratio, Pseudo R², likelihood ratio test |
| Multicollinearity Detection | VIF values for each predictor with warning levels |
| Plain-Language Interpretation | Clear explanations of what each metric and coefficient means |
| Auto Detection | Automatically switches to logistic regression when the target is binary (0/1) |
Quick Start
python3 scripts/regression_analyzer.py data.csv --target price
python3 scripts/regression_analyzer.py users.csv --target churn --features "age,income,tenure"
python3 scripts/regression_analyzer.py data.csv --target sales --output result.json
Detailed Usage
Basic Invocation
python3 scripts/regression_analyzer.py <data_file> --target <target_column> [options]
Specifying Regression Type
python3 scripts/regression_analyzer.py data.csv -t y --type linear
python3 scripts/regression_analyzer.py data.csv -t label --type logistic
python3 scripts/regression_analyzer.py data.csv -t y --type auto
Selecting Feature Columns
python3 scripts/regression_analyzer.py data.csv -t price -f "sqft,bedrooms,bathrooms"
python3 scripts/regression_analyzer.py data.csv -t price
Parameters
| Parameter | Short | Required | Default | Description |
|---|
input | — | Yes | — | Input file path (CSV/TSV/Excel/JSON) |
--target | -t | Yes | — | Target variable (dependent variable) column name |
--features | -f | No | All numeric columns | Predictor column names, comma-separated |
--type | -T | No | auto | Regression type: linear / logistic / auto |
--output | -o | No | stdout | Output JSON file path |
--no-const | — | No | false | Do not add an intercept term |
--keep-na | — | No | false | Keep rows with missing values (for debugging) |
Output Structure (JSON)
{
"type": "linear",
"r_squared": 0.8523,
"r_squared_adj": 0.8471,
"f_statistic": 162.34,
"f_p_value": 0.0,
"coefficients": {
"sqft": {"coefficient": 135.42, "p_value": 0.0001, ...},
"bedrooms": {"coefficient": 8021.5, "p_value": 0.032, ...}
},
"vif": {"sqft": 2.31, "bedrooms"
Dependencies
- Python 3.8+
- pandas
- numpy
- statsmodels
- scipy
pip install pandas numpy statsmodels scipy