A template repository for fully automated model documentation through a README file. Detailed blog post here.
Modeling code is in R/model.R. To enrich your README with model documentation, simply add a comment in the following format above the modeling call.
#~ A Section Header I want the model results to go under
m <- lm(mpg ~ cyl + hp, data = mtcars)
To group multiple models into one section for comparison, use the same section name and explicitly name the model in {} brackets.
#~ Modeling MPG {Without AM}
m <- lm(mpg ~ cyl + hp, data = mtcars)
#~ Modeling MPG {With AM}
m <- lm(mpg ~ cyl + hp + am, data = mtcars)
You can either source model_readme/process_file.R or push your change to automatically update the README. Code to automatically document models is located in the model_readme directory. Currently, for a given section, the following is included in the README:
- Model summary values from glance
- Coefficient estimates from tidy
- Coefficient forest plot (OPTIONAL)
- Residuals vs Fitted Values plot
All documentation below is automatically generated with this repository.
| Using AM | Without AM | |
|---|---|---|
| r.squared | 0.804 | 0.741 |
| adj.r.squared | 0.783 | 0.723 |
| sigma | 2.807 | 3.173 |
| statistic | 38.319 | 41.422 |
| p.value | 0.000 | 0.000 |
| df | 3.000 | 2.000 |
| logLik | -76.292 | -80.781 |
| AIC | 162.585 | 169.562 |
| BIC | 169.914 | 175.425 |
| deviance | 220.553 | 291.975 |
| df.residual | 28.000 | 29.000 |
| nobs | 32.000 | 32.000 |
| Characteristic | Using AM | Without AM | ||||
|---|---|---|---|---|---|---|
| Beta | 95% CI1 | p-value | Beta | 95% CI1 | p-value | |
| cyl | -1.1 | -2.4, 0.17 | 0.086 | -2.3 | -3.4, -1.1 | <0.001 |
| am | 3.9 | 1.2, 6.6 | 0.005 | |||
| hp | -0.04 | -0.07, -0.01 | 0.017 | -0.02 | -0.05, 0.01 | 0.2 |
| 1 CI = Confidence Interval | ||||||
| null.deviance | 43.230 |
|---|---|
| df.null | 31.000 |
| logLik | -9.173 |
| AIC | 26.347 |
| BIC | 32.210 |
| deviance | 18.347 |
| df.residual | 28.000 |
| nobs | 32.000 |
| Characteristic | log(OR)1 | 95% CI1 | p-value |
|---|---|---|---|
| cyl | -0.63 | -2.1, 0.68 | 0.4 |
| mpg | 1.1 | 0.28, 2.6 | 0.062 |
| hp | 0.06 | 0.02, 0.15 | 0.039 |
| 1 OR = Odds Ratio, CI = Confidence Interval | |||
| r.squared | 0.606 |
|---|---|
| adj.r.squared | 0.595 |
| sigma | 21.181 |
| statistic | 54.834 |
| p.value | 0.000 |
| df | 3.000 |
| logLik | -494.359 |
| AIC | 998.717 |
| BIC | 1012.265 |
| deviance | 48002.790 |
| df.residual | 107.000 |
| nobs | 111.000 |
| Characteristic | Beta | 95% CI1 | p-value |
|---|---|---|---|
| Wind | -3.3 | -4.6, -2.0 | <0.001 |
| Solar.R | 0.06 | 0.01, 0.11 | 0.011 |
| Temp | 1.7 | 1.1, 2.2 | <0.001 |
| 1 CI = Confidence Interval | |||





