Metadata-Version: 2.1
Name: regtabletotext
Version: 0.0.4
Summary: Helpers to print regression output as well-formated text
Home-page: https://github.com/christophscheuch/regtabletotext
Download-URL: https://pypi.org/project/regtabletotext/
Author: Christoph Scheuch
Author-email: christoph.scheuch@gmail.com
License: MIT
Keywords: Regression,Table,Formatting,Quarto,Text
Description-Content-Type: text/markdown
License-File: LICENSE

# regtabletotext: helpers to print regression output as text

This package is a collection of helper functions to print regression output of the Python packages `statsmodels` and `linearmodels` as text strings. The helpers are particularly useful for users who want to render regression output in [Quarto](https://quarto.org/) to HTML and PDF.

If you want to export your results to LaTeX or HTML, please check out [stargazer](https://pypi.org/project/stargazer/).

## How to use regtabletotext

The following code chunk
```
import numpy as np
import statsmodels.api as sm
import statsmodels.formula.api as smf
from regtabletotext import prettify_statsmodels

df = sm.datasets.get_rdataset("Guerry", "HistData").data
df = df[['Lottery', 'Literacy', 'Wealth', 'Region']].dropna()

mod = smf.ols(formula='Lottery ~ Literacy + Wealth + Region', data=df)
res = mod.fit()

prettify_statsmodels(res)
```

returns this text
```
Model:
Lottery ~ Literacy + Wealth + Region

Coefficients:
             Estimate  Std. Error  t-Statistic  p-Value

Intercept      38.652       9.456        4.087    0.000
Region[T.E]   -15.428       9.727       -1.586    0.117
Region[T.N]   -10.017       9.260       -1.082    0.283
Region[T.S]    -4.548       7.279       -0.625    0.534
Region[T.W]   -10.091       7.196       -1.402    0.165
Literacy       -0.186       0.210       -0.886    0.378
Wealth          0.452       0.103        4.390    0.000

Summary statistics:
- Number of observations: 85
- Residual standard error: 20.891
- Multiple R-squared: 0.338, Adjusted R-squared: 0.287
- F-statistic: 6.636 on 6 and 78 DF, p-value: 0.000
```

# 2023-10-19
- Initial commit
