Description Usage Arguments Details Value See Also Examples
View source: R/transformation_functions.R
Function data_transformation
transforms the dependent variable from
the formula object fixed
in the given sample data set. Thus, it
returns the original sample data set with transformed dependent variable.
For the transformation three types can be chosen, particularly no, natural
log and BoxCox transformation.
1  data_transformation(fixed, smp_data, transformation, lambda)

fixed 
a twosided linear formula object describing the
fixedeffects part of the nested error linear regression model with the
dependent variable on the left of a ~ operator and the explanatory
variables on the right, separated by + operators. The argument corresponds
to the argument 
smp_data 
a data frame that needs to comprise all variables named in

transformation 
a character string. Three different transformation methods for the dependent variable can be chosen (i) no transformation ("no"); (ii) natural log transformation ("log"); (iii) BoxCox transformation ("box.cox"). 
lambda 
a scalar parameter that determines the BoxCox transformation.
In case of no and natural log transformation 
For the natural log and BoxCox transformation the dependent variable is shifted such that all values are greater than zero since the transformations are not applicable for values equal to or smaller than zero. The shift is calculated as follows:
shift = min(y) + 1 \qquad if \qquad min(y) <= 0
Function data_transformation
works as a wrapper function. This means
that the function manages the selection of the three different transformation
functions no_transform
, log_transform
and box_cox
.
a named list with two elements, a data frame containing the data set
with transformed dependent variable (transformed_data
) and a shift
parameter shift
if present. In case of no transformation the original
data frame is returned and the shift parameter is NULL.
1 2 3 4 5 6 7  # Loading data  sample data
data("eusilcA_smp")
# Transform dependent variable in sample data with BoxCox transformation
transform_data < data_transformation(eqIncome ~ gender + eqsize + cash +
self_empl + unempl_ben + age_ben + surv_ben + sick_ben + dis_ben + rent +
fam_allow + house_allow + cap_inv + tax_adj, eusilcA_smp, "box.cox", 0.7)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.