olr: Optimal Linear Regression

The olr function systematically evaluates multiple linear regression models by exhaustively fitting all possible combinations of independent variables against the specified dependent variable. It selects the model that yields the highest adjusted R-squared (by default) or R-squared, depending on user preference. In model evaluation, both R-squared and adjusted R-squared are key metrics: R-squared measures the proportion of variance explained but tends to increase with the addition of predictors—regardless of relevance—potentially leading to overfitting. Adjusted R-squared compensates for this by penalizing model complexity, providing a more balanced view of fit quality. The goal of olr is to identify the most suitable model that captures the underlying structure of the data while avoiding unnecessary complexity. By comparing both metrics, it offers a robust evaluation framework that balances predictive power with model parsimony. Example Analogy: Imagine a gardener trying to understand what influences plant growth (the dependent variable). They might consider variables like sunlight, watering frequency, soil type, and nutrients (independent variables). Instead of manually guessing which combination works best, the olr function automatically tests every possible combination of predictors and identifies the most effective model—based on either the highest R-squared or adjusted R-squared value. This saves the user from trial-and-error modeling and highlights only the most meaningful variables for explaining the outcome. A Python version is also available at <https://pypi.org/project/olr>.

Package details

AuthorMathew Fok [aut, cre]
MaintainerMathew Fok <quiksilver67213@yahoo.com>
LicenseGPL-3
Version1.2
URL https://github.com/MatHatter/olr_r https://pypi.org/project/olr/
Package repositoryView on CRAN
Installation Install the latest version of this package by entering the following in R:
install.packages("olr")

Try the olr package in your browser

Any scripts or data that you put into this service are public.

olr documentation built on June 8, 2025, 1:33 p.m.