The main olr() runs all of the possible linear regression equation combinations, which are all of the combinations of dependent variables respect to the independent variable. In essence, the olr() returns the best fit linear regression model. The user can prompt the olr() to return either the best fit statistical summary of either the greatest adjusted R-squared, or the greatest R-squared term. R-squared increases with the addition of an explanatory variable whether it is 'significant' or not, thus this was developed to eliminate that conundrum. Adjusted R-squared is preferred to overcome this phenomenon, but each combination will still produce different results and this will return the best one.
1 2 3 4 5 6 7 8 9 10 11 12
olr(dataset, responseName = NULL, predictorNames = NULL, adjr2 = TRUE) olrmodels(dataset, responseName = NULL, predictorNames = NULL) olrformulas(dataset, responseName = NULL, predictorNames = NULL) olrformulaorder(dataset, responseName = NULL, predictorNames = NULL) adjr2list(dataset, responseName = NULL, predictorNames = NULL) r2list(dataset, responseName = NULL, predictorNames = NULL)
is defined by the user and points to the name of the dataset that is being used.
the response variable name defined as a string. For example, it represents a header in the data table.
the predictor variable or variables that are the terms that are to be regressed against the
Complimentary functions below follow the format: function(dataset, responseName = NULL, predictorNames = NULL)
olrmodels: returns the list of models accompanied by the coefficients. After typing in
olrmodels(dataset, responseName, predictorNames) type the desired summary number to the right of the comma in the brackets:
[,x] where x equals the desired summary number. For example,
olrmodels(dataset, responseName, predictorNames)[,8]
olrformulas: returns the list of olr() formulas
olrformulasorder: returns the formulas with the predictors (dependent variables) in ascending order
adjr2list: list of the adjusted R-squared terms
r2list: list of the R-squared terms
NULL, then the first column in the
dataset is set as the
responseName and the remaining columns are the
A 'Python' version is available at <https://pypi.org/project/olr>.
The regression summary for the adjusted R-squared or the R-squared, specified with
FALSE in the olr().
1 2 3 4 5 6 7 8
file <- system.file("extdata", "oildata.csv", package = "olr", mustWork = TRUE) oildata <- read.csv(file, header = TRUE) dataset <- oildata responseName <- 'OilPrices' predictorNames <- c('SP500', 'RigCount', 'API', 'Field_Production', 'OperableCapacity', 'Imports') olr(dataset, responseName, predictorNames, adjr2 = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.