linearRegression: Fitting Linear Models

Description Usage Arguments Value Examples

View source: R/LR_func.R

Description

linearRegression is a mimic of lm() that is used to fit linear models.

Usage

1
linearRegression(data, predictors, response, intercept = TRUE)

Arguments

data

The data set for multiple linear regression. It should be in the form of a 2d matrix

predictors

A string array of all the predictors' names.

response

A single string of the response.

intercept

Boolean. TRUE by default for a model with intercept. Setting as FALSE will force the model to have no intercept.

Value

A list with 6 elements: 1. beta_hat; 2.R^2; 3.X; 4.Fitted values; 5.Residuals; 6.intercept or not

Examples

1
2
mt <- mtcars
linearRegression(mt, "mpg", "cyl", TRUE)

AmIACommonGuy/MLRnewbie documentation built on Dec. 17, 2021, 8:44 a.m.