Title: | Statistical Transformations |
---|---|
Description: | Performs various statistical transformations; Box-Cox and Log (Box and Cox, 1964) <doi:10.1111/j.2517-6161.1964.tb00553.x>, Glog (Durbin et al., 2002) <doi:10.1093/bioinformatics/18.suppl_1.S105>, Neglog (Whittaker et al., 2005) <doi:10.1111/j.1467-9876.2005.00520.x>, Reciprocal (Tukey, 1957), Log Shift (Feng et al., 2016) <doi:10.1002/sta4.104>, Bickel-Docksum (Bickel and Doksum, 1981) <doi:10.1080/01621459.1981.10477649>, Yeo-Johnson (Yeo and Johnson, 2000) <doi:10.1093/biomet/87.4.954>, Square Root (Medina et al., 2019), Manly (Manly, 1976) <doi:10.2307/2988129>, Modulus (John and Draper, 1980) <doi:10.2307/2986305>, Dual (Yang, 2006) <doi:10.1016/j.econlet.2006.01.011>, Gpower (Kelmansky et al., 2013) <doi:10.1515/sagmb-2012-0030>. It also performs graphical approaches, assesses the success of the transformation via tests and plots. |
Authors: | Muge Coskun Yildirim [aut], Osman Dag [aut, cre] |
Maintainer: | Osman Dag <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0 |
Built: | 2025-01-30 05:06:56 UTC |
Source: | https://github.com/cran/Transform |
bcTransform
performs Box-Cox transformation for normality of a variable and provides graphical analysis.
bcTransform(data, lambda = seq(-3,3,0.01), lambda2 = NULL, plot = TRUE, alpha = 0.05, verbose = TRUE)
bcTransform(data, lambda = seq(-3,3,0.01), lambda2 = NULL, plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
lambda2 |
a numeric for an additional shifting parameter. Default is set to lambda2 = NULL. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Box-Cox power transformation is defined by:
If the data include any non- positive observations, a shifting parameter can be included in the transformation given by:
A list with class "bc" containing the following elements:
method |
method to estimate Box-Cox transformation parameter |
lambda.hat |
estimate of Box-Cox Power transformation parameter |
lambda2 |
additional shifting parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Box, G.E., Cox, D.R. (1964). An Analysis of Transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26:2, 211–43.
data <- cars$dist library(Transform) out <- bcTransform(data) out$lambda.hat # the estimate of Box-Cox parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- bcTransform(data) out$lambda.hat # the estimate of Box-Cox parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
bdTransform
performs Bickel-Docksum transformation for normality of a variable and provides graphical analysis.
bdTransform(data, lambda = seq(0.01,6,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
bdTransform(data, lambda = seq(0.01,6,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (0.01,6) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Bickel-Docksum power transformation is defined by:
A list with class "bd" containing the following elements:
method |
method to estimate Bickel-Docksum transformation parameter |
lambda.hat |
estimate of Bickel-Docksum transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Bickel, P.J., Doksum, K.A. (1981). An Analysis of Transformations Revisited. Journal of the American Statistical Association, 76:374, 296–311.
data <- cars$dist library(Transform) out <- bdTransform(data) out$lambda.hat # the estimate of Bickel-Docksum parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- bdTransform(data) out$lambda.hat # the estimate of Bickel-Docksum parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
dlTransform
performs Dual transformation for normality of a variable and provides graphical analysis.
dlTransform(data, lambda = seq(0,6,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
dlTransform(data, lambda = seq(0,6,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (0,6) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Dual power transformation is defined by:
A list with class "dl" containing the following elements:
method |
method to estimate Dual transformation parameter |
lambda.hat |
estimate of Dual transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Yang, Z. (2006). A Modified Family of Power Transformations. Economics Letters. 92:1, 14–9.
data <- cars$dist library(Transform) out <- dlTransform(data) out$lambda.hat # the estimate of Dual parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- dlTransform(data) out$lambda.hat # the estimate of Dual parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
glTransform
performs Glog transformation for normality of a variable and provides graphical analysis.
glTransform(data, plot = TRUE, alpha = 0.05, verbose = TRUE)
glTransform(data, plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Glog power transformation is defined by:
A list with class "gl" containing the following elements:
method |
method name |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Durbin, B.P., Hardin, J.S., Hawkins, D.M., Rocke, D.M. (2002). A Variance-Stabilizing Transformation for Gene-expression Microarray Data. Bioinformatics, 18(suppl_1), 105–110.
data <- cars$dist library(Transform) out <- glTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- glTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
gpTransform
performs Gpower transformation for normality of a variable and provides graphical analysis.
gpTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
gpTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Gpower power transformation is defined by:
A list with class "gp" containing the following elements:
method |
method to estimate Gpower transformation parameter |
lambda.hat |
estimate of Gpower transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Kelmansky, D.M., Martinez, E.J., Leiva, V. (2013). A New Variance Stabilizing Transformation for Gene Expression Data Analysis. Statistical Applications in Genetics and Molecular Biology, 12:6, 653–66.
data <- cars$dist library(Transform) out <- gpTransform(data) out$lambda.hat # the estimate of Gpower parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- gpTransform(data) out$lambda.hat # the estimate of Gpower parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
lgTransform
performs Log transformation for normality of a variable and provides graphical analysis.
lgTransform(data, lambda2 = NULL, plot = TRUE, alpha = 0.05, verbose = TRUE)
lgTransform(data, lambda2 = NULL, plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda2 |
a numeric for an additional shifting parameter. Default is set to lambda2 = NULL. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Log power transformation is defined by:
If the data include any nonpositive observations, a shifting parameter can be included in the transformation given by:
A list with class "lg" containing the following elements:
method |
method name |
lambda2 |
additional shifting parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Box, G.E., Cox, D.R. (1964). An Analysis of Transformations. Journal of the Royal Statistical Society: Series B (Methodological), 26:2, 211–43.
data <- cars$dist library(Transform) out <- lgTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- lgTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
lsTransform
performs Log-shift transformation for normality of a variable and provides graphical analysis.
lsTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
lsTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Log-shift power transformation is defined by:
A list with class "ls" containing the following elements:
method |
method to estimate Log-shift transformation parameter |
lambda.hat |
estimate of Log-shift transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Feng, Q., Hannig, J., Marron, J. (2015). A Note on Automatic Data Transformation. Stat, 5:1, 82–7.
data <- cars$dist library(Transform) out <- lsTransform(data) out$lambda.hat # the estimate of Log-shift parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- lsTransform(data) out$lambda.hat # the estimate of Log-shift parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
mdTransform
performs Modulus transformation for normality of a variable and provides graphical analysis.
mdTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
mdTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Modulus power transformation is defined by:
A list with class "md" containing the following elements:
method |
method to estimate Modulus transformation parameter |
lambda.hat |
estimate of Modulus transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
John, J., Draper, N.R. (1980). An Alternative Family of Transformations. Journal of the Royal Statistical Society Series C: Applied Statistics, 29:2, 190–7.
data <- cars$dist library(Transform) out <- mdTransform(data) out$lambda.hat # the estimate of Modulus parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- mdTransform(data) out$lambda.hat # the estimate of Modulus parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
mnTransform
performs Manly transformation for normality of a variable and provides graphical analysis.
mnTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
mnTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Manly power transformation is defined by:
A list with class "mn" containing the following elements:
method |
method to estimate Manly transformation parameter |
lambda.hat |
estimate of Manly transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Manly, B.F. (1976). Exponential Data Transformations. Journal of the Royal Statistical Society: Series D (The Statistician), 25:1, 37–42.
data <- cars$dist library(Transform) out <- mnTransform(data) out$lambda.hat # the estimate of Manly parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- mnTransform(data) out$lambda.hat # the estimate of Manly parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
nlTransform
performs Neglog transformation for normality of a variable and provides graphical analysis.
nlTransform(data, plot = TRUE, alpha = 0.05, verbose = TRUE)
nlTransform(data, plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Neglog power transformation is defined by:
A list with class "nl" containing the following elements:
method |
method name |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Whittaker, J., Whitehead, C., Somers, M. (2005). The Neglog Transformation and Quantile Regression for the Analysis of a Large Credit Scoring Database. Journal of the Royal Statistical Society: Series C (Applied Statistics), 54:5, 863–78.
data <- cars$dist library(Transform) out <- nlTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- nlTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
rpTransform
performs Reciprocal transformation for normality of a variable and provides graphical analysis.
rpTransform(data, plot = TRUE, alpha = 0.05, verbose = TRUE)
rpTransform(data, plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Dual power transformation is defined by:
A list with class "rp" containing the following elements:
method |
method name |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Tukey, J.W. (1957). On the Comparative Anatomy of Transformations. The Annals of Mathematical Statistics, 602–32.
data <- cars$dist library(Transform) out <- rpTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- rpTransform(data) out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
ssTransform
performs Square Root transformation for normality of a variable and provides graphical analysis.
ssTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
ssTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Square Root power transformation is defined by:
A list with class "ss" containing the following elements:
method |
method to estimate Square Root transformation parameter |
lambda.hat |
estimate of Square Root transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Medina, L., Castro, P., Kreutzmann, A. (2018). Rojas-Perilla N. trafo: Estimation, Comparison and Selection of Transformations. R package version. 1.0.1.
data <- cars$speed library(Transform) out <- ssTransform(data) out$lambda.hat # the estimate of Square Root parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$speed library(Transform) out <- ssTransform(data) out$lambda.hat # the estimate of Square Root parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
Transform
performs transformations for normality of a variable and provides graphical analysis.
Transform(data, method = "dl", lambda = seq(0,6,0.01), lambda2 = NULL, plot = TRUE, alpha = 0.05, verbose = TRUE)
Transform(data, method = "dl", lambda = seq(0,6,0.01), lambda2 = NULL, plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
method |
a character string. Different transformation methods can be used for the estimation of the optimal transformation parameter: Box-Cox ("bc"), Log-shift ("ls"), Bickel-Doksum ("bd"), Yeo-Johnson ("yj"), Square Root ("ss"), Manly ("mn"), Modulus ("md"), Dual ("dl"), Gpower ("gp"), Log ("lg"), Glog ("gl"), Neglog ("nl"), Reciprocal ("rp"). Default is set to method = "dl". |
lambda |
a vector which includes the sequence of candidate lambda values. Please see the corresponding method to learn the lambda range. Default is set to (0,6) with increment 0.01. |
lambda2 |
a numeric for an additional shifting parameter. Please see the corresponding method to learn the lambda2. Default is set to lambda2 = NULL. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
See the corresponding transformation method.
Muge Coskun Yildirim, Osman Dag
data <- cars$dist library(Transform) out <- Transform(data, method = "bc") out$lambda.hat # the estimate of Box-Cox parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- Transform(data, method = "bc") out$lambda.hat # the estimate of Box-Cox parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
yjTransform
performs Yeo- Johnson transformation for normality of a variable and provides graphical analysis.
yjTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
yjTransform(data, lambda = seq(-3,3,0.01), plot = TRUE, alpha = 0.05, verbose = TRUE)
data |
a numeric vector of data values. |
lambda |
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01. |
plot |
a logical to plot histogram with its density line and qqplot of raw and transformed data. Defaults plot = TRUE. |
alpha |
the level of significance to check the normality after transformation. Default is set to alpha = 0.05. |
verbose |
a logical for printing output to R console. |
Denote the variable at the original scale and
the transformed variable. The Yeo-Johnson power transformation is defined by:
A list with class "yj" containing the following elements:
method |
method to estimate Yeo-Johnson transformation parameter |
lambda.hat |
estimate of Yeo-Johnson transformation parameter |
statistic |
Shapiro-Wilk test statistic for transformed data |
p.value |
Shapiro-Wilk test p.value for transformed data |
alpha |
level of significance to assess normality |
tf.data |
transformed data set |
var.name |
variable name |
Muge Coskun Yildirim, Osman Dag
Asar, O., Ilk, O., Dag, O. (2017). Estimating Box-Cox Power Transformation Parameter via Goodness of Fit Tests. Communications in Statistics - Simulation and Computation, 46:1, 91–105.
Yeo, I.K., Johnson, R.A. (2000). A New Family of Power Transformations to Improve Normality or Symmetry. Biometrika, 87:4, 954–9.
data <- cars$dist library(Transform) out <- yjTransform(data) out$lambda.hat # the estimate of Yeo- Johnson parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set
data <- cars$dist library(Transform) out <- yjTransform(data) out$lambda.hat # the estimate of Yeo- Johnson parameter based on Shapiro-Wilk test statistic out$p.value # p.value of Shapiro-Wilk test for transformed data out$tf.data # transformed data set