Learn R Programming

AID (version 1.7)

boxcoxnc: A Function to Estimate Box-Cox Power Transformation Parameter via Normality Tests and Artificial Covariate Method

Description

boxcoxnc utilizes seven different normality tests and artificial covariate method to estimate Box-Cox power transformation parameter and provides graphical analysis

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.

Dag, O., Asar, O., Ilk, O. (2014). A Methodology to Implement Box-Cox Transformation When No Covariate is Available. Communications in Statistics - Simulation and Computation, 43:7, 1740--1759.

Usage

boxcoxnc(data, method = "sw", lam = seq(-3,3,0.01), plotit = TRUE, alpha = 0.05, verbose = TRUE)

Arguments

data
a numeric vector of data values.
method
a character string to select the desired method to be used to estimate Box-Cox transformation parameter. To use Shapiro-Wilk test method should be set to "sw". For method = "ad", boxcoxnc function uses Anderson-Darling test to estimate Box-Cox transformation parameter. Similarly, method should be set to "cvm", "pt", "sf", "lt", "jb", "ac" to use Cramer-von Mises, Pearson Chi-square, Shapiro-Francia, Lilliefors, Jarque-Bera tests and artificial covariate method, respectively. Default is set to method = "sw".
lam
a vector which includes the sequence of candidate lambda values. Default is set to (-3,3) with increment 0.01.
plotit
plots normality test statistic vs lambda for methods utilizing normality tests. It also plots log-likelihood vs lambda for artificial covariate method. Defaults plotit = 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.

Value

Returns a list containing following elements:

References

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. P., Cox, D. R. (1964). An Analysis of Transformations (with discussion). Journal of the Royal Statistical Society, Series B (Methodological), 26, 211--252.

Dag, O., Asar, O., Ilk, O. (2014). A Methodology to Implement Box-Cox Transformation When No Covariate is Available. Communications in Statistics - Simulation and Computation, 43:7, 1740--1759.

Gross, J. (2012). nortest: Tests for Normality. R package version 1.0.

Thode, H. C. (2002). Testing for Normality. New York: Marcel Dekker.

Trapletti, A., Hornik, K. (2012). tseries: Time Series Analysis and Computational Finance. R package version. 0.10-28.

Venables, W. N., Ripley, B. D. (2002). Modern Applied Statistics with S 4th ed.. New York: Springer.

Examples

Run this code
data(textile)

out=boxcoxnc(textile[,1], method = "sw")
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

out2=boxcoxnc(textile[,1], method = "sf")
out2$lambda.hat # the estimate of Box-Cox parameter based on Shapiro-Francia test statistic
out2$p.value # p.value of Shapiro-Francia test for transformed data 
out2$tf.data # transformed data set

Run the code above in your browser using DataLab