Description Usage Arguments Value Examples
View source: R/myLinearRegression.R
This function builds a linear regression model and returns the coefficients and their p-values. However, it provides the option to only regress using a certain set of rows within a dataset. This makes it very useful for passing your test/train splits or crossvalidation splits into the model. It also returns a scatterplot matrix if you have fewer than five independent variables. Created by Alex Moore.
1 | myLinearRegression(y, x, sub)
|
y |
The dependent variable as a vector |
x |
The independent variables as a matrix |
sub |
The index of rows/observations you'll use for building the model |
A dataframe with the coefficients and p-values for the model
A scatterplot matrix if you have less than 5 independent variables.
1 | myLinearRegression(mtcars$mpg, mtcars[ , 2:4], 1:20)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.