Learn R Programming

insight (version 0.16.0)

find_transformation: Find possible transformation of response variables

Description

This functions checks whether any transformation, such as log- or exp-transforming, was applied to the response variable (dependent variable) in a regression formula. Currently, following patterns are detected: log, log1p, exp, expm1, sqrt, log(x+<number>) and log-log.

Usage

find_transformation(x)

Arguments

x

A regression model.

Value

A string, with the name of the function of the applied transformation. Returns "identity" for no transformation, and e.g. "log(x+3)" when a specific values was added to the response variables before log-transforming.

Examples

Run this code
# NOT RUN {
# identity, no transformation
model <- lm(Sepal.Length ~ Species, data = iris)
find_transformation(model)

# log-transformation
model <- lm(log(Sepal.Length) ~ Species, data = iris)
find_transformation(model)

# log+2
model <- lm(log(Sepal.Length + 2) ~ Species, data = iris)
find_transformation(model)
# }

Run the code above in your browser using DataLab