View source: R/find_transformation.R
find_transformation | R Documentation |
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
, log2
, log10
, exp
, expm1
, sqrt
,
log(x+<number>)
, log-log
, power
(to 2nd power, like I(x^2)
), and
inverse
(like 1/y
).
find_transformation(x, ...)
x |
A regression model or a character string of the response value. |
... |
Currently not used. |
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. For unknown transformations, returns NULL
.
# 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)
# inverse, response provided as character string
find_transformation("1 / y")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.