First check of assumptions to find suitable transformations
First check of assumptions to find suitable transformations
Gives a first overview if a transformation is useful and which transformation is promising to fulfill the model assumptions normality, homoscedasticity and linearity.
assumptions(object, method ="ml", std =FALSE,...)
Arguments
object: an object of type lm.
method: a character string. Different estimation methods can be used for the estimation of the optimal transformation parameter: (i) Maximum likelihood approach ("ml"), (ii) Skewness minimization ("skew"), (iii) Kurtosis optimization ("kurt"), (iv) Divergence minimization by Kolmogorov-Smirnov ("div.ks"), by Cramer-von-Mises ("div.cvm") or by Kullback-Leibler ("div.kl"). Defaults to "ml".
std: logical. If TRUE, the transformed model is returned based on the standardized/scaled transformation. Defaults to FALSE.
...: other parameters that can be passed to the function, e.g. other lambdaranges. Self-defined lambdaranges are given to the function as an argument that is the combination of the name of the transformation and lr and the range needs to be a numeric vector of length 2. For instance, changing the lambdarange for the Manly transformation would mean to add an argument manly_lr = manly_lr = c(0.000005,0.00005). For the default values that are used for the lambdaranges see the documentation for the provided transformations.
Returns
A table with tests for normality and homoscedasticity. Furthermore, scatterplots are returned to check the linearity assumption.
Examples
# Load datadata("cars", package ="datasets")# Fit linear modellm_cars <- lm(dist ~ speed, data = cars)assumptions(lm_cars)assumptions(lm_cars, method ="skew", manly_lr = c(0.000005,0.00005))