masslm: Mass Linear Regression

Description Usage Arguments Value Examples

Description

This function takes in a dataframe, the dependent variable, and optionally a character vector of independent variables you want the function to ignore. It then produces a dataframe of regression results.

Usage

1
masslm(data, dv.var, ignore = NULL, p.round = TRUE, c.round = TRUE)

Arguments

data

data.frame object that contains both the dependent variable and predictor variables you want to regress.

dv.var

single dependent variable you want to regress your predictors on.

ignore

accepts a character vector of one or more variables you want the function to skip. If nothing is passed through this option, the function will attempt to run a regression between the dependent variable and every other column of data.

p.round

set to TRUE by default. If left TRUE, will round off the P.value outputs to their 6 significant digits. Can be a problem for numbers larger than 999999, set to false to return the raw number.

c.round

set to TRUE by default. If left TRUE, will round off the Coefficient outputs to their 6 significant digits. Can be a problem for numbers larger than 999999, set to false to return the raw number.

Value

data.frame containing three columns of data, IV, Coefficient, and P.Value. If one of the columns of data not excluded from the function contained character type data, the function will print an error recommending the user attempt to convert the variable to a factor.

Examples

1
2
3
exam.df <- iris
masslm(exam.df, "Sepal.Width", ignore = "Species")
masslm(exam.df, "Sepal.Width", ignore = c("Species", "Petal.Width"))

Example output

            IV Coefficient   P.value  R.squared
1 Sepal.Length    -0.06188 1.519e-01 0.01382265
2 Petal.Length    -0.10580 4.513e-08 0.18356092
3  Petal.Width    -0.20940 4.073e-06 0.13404820
            IV Coefficient   P.value  R.squared
1 Sepal.Length    -0.06188 1.519e-01 0.01382265
2 Petal.Length    -0.10580 4.513e-08 0.18356092

exploreR documentation built on May 1, 2019, 9:37 p.m.