add_pred: Add predicted values of different types to dataframe

add_predR Documentation

Add predicted values of different types to dataframe

Description

Add predicted values of different types to dataframe

Usage

add_pred(data, model, var = "pred", type = NULL, transformation = NULL)

Arguments

data

dataframe or tibble

model

model object

var

name of new variable in dataframe / tibble

type

type of predicted value

transformation

A possible transformation of predicted variable, e.g. reciprocal(), log() etc

Value

dataframe / tibble

Author(s)

Søren Højsgaard

Examples

data(cars)
lm1 <- lm(dist ~ speed + I(speed^2), data=cars)
lm1 |> response() |> head()
cars <- cars |> add_pred(lm1)
cars |> head()
cars <- cars |> add_resid(lm1)
cars


doBy documentation built on April 11, 2025, 6:13 p.m.