residuals_for: Calculate residuals for a model excluding one of the...

Description Usage Arguments Value Examples

View source: R/residuals_for.R

Description

Allows access to residuals without the influence of a particular predictor

Usage

1
residuals_for(model, predictor)

Arguments

model

The input model, e.g. lm(a ~ b + c)

predictor

The name of the predictor to be excluded

Value

A tibble containing true value, predicted values without the predictor, and the residuals without the predictor

Examples

1
2
3
4
5
6
7
8
data(mtcars)
model1 <- lm(mpg ~ cyl + disp + gear, data=mtcars)
resout <- residuals_for(model1, "cyl")

model2 <- lm(residuals ~ cyl + 0, data=resout)

coef(model1)
coef(model2)

mathesong/granviller documentation built on April 20, 2020, 7:28 p.m.