logtrafo function

Log transformation for linear models

Log transformation for linear models

The function transforms the dependent variable of a linear model using the Log transformation. The Log transformation is only defined for positive response values. In case the response contains zero or negative values a shift is automatically added such that y + shift > 0.

logtrafo(object)

Arguments

  • object: an object of type lm.

Returns

An object of class trafo. Methods such as as.data.frame.trafo and print.trafo can be used for this class.

Examples

# Load data data("cars", package = "datasets") # Fit linear model lm_cars <- lm(dist ~ speed, data = cars) # Transform dependent variable logtrafo(object = lm_cars)

References

Box GEP, Cox DR (1964). An Analysis of Transformations. Journal of the Royal Statistical Society B, 26(2), 211-252.

  • Maintainer: Ann-Kristin Kreutzmann
  • License: GPL-2
  • Last published: 2018-11-27

Useful links