papaya
Class Linear.BoxCox

java.lang.Object
  extended by papaya.Linear.BoxCox
Enclosing class:
Linear

public static class Linear.BoxCox
extends Object

Contains methods related to the Box-Cox transformation of a data set; useful in determining the best transformation that will yield the best method for converting a monotonic, non-linear relationship between x and y into a linear one.

Reference:
Box, George E. P.; Cox, D. R. (1964). "An analysis of transformations". Journal of the Royal Statistical Society, Series B 26 (2): 211?252.
NIST/SEMATECH e-Handbook of Statistical Methods, EDA Section 1.3.3.6: Box-Cox Linearity Plots (The reader's digest version of the original.)


Method Summary
static float[] correlation(float[] x, float[] y, float[] lambda)
          Performs the box-cox transformation on y for a sequence of λ and returns the array of linear correlation coefficients between the x and the box-cox transformed y.
static float[] transform(float[] data, float lambda)
          Performs the box-cox transformation, returning the transformed data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

correlation

public static float[] correlation(float[] x,
                                  float[] y,
                                  float[] lambda)
Performs the box-cox transformation on y for a sequence of λ and returns the array of linear correlation coefficients between the x and the box-cox transformed y. at each value of λ . The value of λ corresponding to the maximum correlation (or minimum for negative correlation) is the optimal choice for λ such that the relationship between x and T(y) is linear.

Reference:
NIST/SEMATECH e-Handbook of Statistical Methods, EDA Section 1.3.3.6: Box-Cox Linearity Plots

Parameters:
x - the independent data array
y - the dependent data array
lambda - an array of lambda values
Returns:
the array containing the linear correlation coefficients, r.

transform

public static float[] transform(float[] data,
                                float lambda)
Performs the box-cox transformation, returning the transformed data. That is, it computes and returns
 y[i](λ) = (y[i]^λ-1) / λ if λ ≠ 0
 
 y[i](λ) = log(y[i])if λ = 0
 
Requirements: all elements of y are >0.

Parameters:
data - the data to be transformed
lambda - the lambda value
Returns:
the transformed data, or y(λ) above.


Processing library papaya by Adila Faruk. (C) 2014