Learn R Programming

AID (version 3.0)

boxcoxmeta: Ensemble Based Box-Cox Transformation via Meta Analysis for Normality of a Variable

Description

boxcoxmeta performs ensemble based Box-Cox transformation via meta analysis for normality of a variable and provides graphical analysis.

Usage

boxcoxmeta(data, lambda = seq(-3,3,0.01), nboot = 100, lambda2 = NULL, plot = TRUE, 
  alpha = 0.05, verbose = TRUE)

Value

A list with class "boxcoxmeta" containing the following elements:

method

name of method

lambda.hat

estimate of Box-Cox Power transformation parameter

lambda2

additional shifting parameter

result

a data frame containing the result

alpha

the level of significance to assess normality.

tf.data

transformed data set

var.name

variable name

Arguments

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.

nboot

a number of Bootstrap samples to estimate standard errors of lambda estimates.

lambda2

a numeric for an additional shifting parameter. Default is set to lambda2 = 0.

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.

Author

Muhammed Ali Yilmaz, Osman Dag

Details

Denote \(y\) the variable at the original scale and \(y'\) the transformed variable. The Box-Cox power transformation is defined by:

$$y' = \left\{ \begin{array}{ll} \frac{y^\lambda - 1}{\lambda} \mbox{ , if $\lambda \neq 0$} \cr log(y) \mbox{ , if $\lambda = 0$} \end{array} \right.$$

If the data include any nonpositive observations, a shifting parameter \(\lambda_2\) can be included in the transformation given by:

$$y' = \left\{ \begin{array}{ll} \frac{(y + \lambda_2)^\lambda - 1}{\lambda} \mbox{ , if $\lambda \neq 0$} \cr log(y + \lambda_2) \mbox{ , if $\lambda = 0$} \end{array} \right.$$

References

Yilmaz, M.A., Dag, O. (2022). Ensemble Based Box-Cox Transformation via Meta Analysis. Journal of Advanced Research in Natural and Applied Sciences, 8:3, 463--471.

Examples

Run this code
library(AID)
data(textile)
# \donttest{
out <- boxcoxmeta(textile[,1])
out$lambda.hat # the estimate of Box-Cox parameter 
out$tf.data # transformed data set
# }

Run the code above in your browser using DataLab