modcomp
modcomp is an R package I developed to make reviewing and comparing linear regression models faster and more intuitive. It extracts commonly used model statistics and provides flexible ways to view complete summaries or selected results across multiple models, reducing the repetitive work involved in manual model comparison.
The project gave me practical experience translating statistical workflows into reusable software while strengthening my skills in R programming, documentation, and reproducible analysis.
Why I Built It
When comparing related regression models, I often found myself repeatedly scrolling between separate summary() outputs to locate the same coefficients, p-values, confidence intervals, and fit statistics. The process became increasingly cumbersome as more models were considered. I created modcomp to bring those results into consistent, easier-to-compare displays and make the review process more efficient.
What began as a solution to a small workflow frustration became an opportunity to think more broadly about reusable function design, standardized output, and statistical code that could be useful beyond a single analysis.
Key Functions
extract_lm() produces a dataframe of coefficients, standard errors, test statistics, p-values, confidence intervals, R², adjusted R², AIC, and significance indicators based on a user-selected alpha level.
tablestack() places complete model summaries directly one above another as an output.
tablecomp() creates a single side-by-side table of selected characteristics across models.
(This is the real star of the show)
See It in Action
Loading README...
IMPORTANT NOTE TO USER: Model comparison should be performed thoughtfully and with consideration of the models being evaluated. Comparisons are often especially useful for nested or otherwise closely related models fit to the same outcome and dataset; however, the appropriateness of a comparison depends on the models, the statistic or criterion being considered, and the assumptions of any formal comparison method being used.
‘modcomp’ is intended to facilitate the display and review of model characteristics, but it does not determine whether a particular model comparison is statistically appropriate. Users should interpret differences in coefficients, p-values, AIC, and other model characteristics within the context of their analysis and study objectives.
Take a closer look at how modcomp works through example code and output from the package README.