getResiduals: Get Residuals with Linear Model

Description Usage Arguments Value Examples

View source: R/getResiduals.R

Description

get residuals of columns in data regressed cov with lm

Usage

1
getResiduals(data, cov, addmean = TRUE)

Arguments

data

a data frame or tibble, contains the columns to calculate residuals

cov

a data frame or tibble, contains the columns as covariate. The length of row should be the same as data

addmean

logical, should the mean of original data should be added back to the residual, default is true

Value

a data frame with same dimension with data, containing the residuals of the original columns

Examples

1
2
3
4
5
data("mtcars")
getResiduals(mtcars[1:3], mtcars[4:5])

#get residual without adding mean back
getResiduals(mtcars[1:3], mtcars[4:5],addmean = FALSE)

LeiGuo0812/lightStat documentation built on June 27, 2021, 9:17 p.m.