In boxcox_trans, trans and inv functions include sign() and abs() (maybe for preserving order of values when 0<x<1 ?), but this then passes not totally correct functions to the transformer.
trans <- function(x) (x^p - 1)/p * sign(x - 1)
inv <- function(x) (abs(x) * p + 1 * sign(x))^(1/p)
Using this form, for data 0 < x < 1, inv(trans(x)) != x
Eliminating those and using the basic formula for Box-Cox Power transformations:
trans <- function(x) (x^p - 1)/p
inv <- function(x) (x * p + 1)^(1/p)
I've confirmed this works for all of my data x>0, and that inv(trans(x)) == x. I've also used this to scale my axes successfully.
I'm new to git, so I'm just reporting this here.
In boxcox_trans, trans and inv functions include sign() and abs() (maybe for preserving order of values when 0<x<1 ?), but this then passes not totally correct functions to the transformer.
Using this form, for data 0 < x < 1, inv(trans(x)) != x
Eliminating those and using the basic formula for Box-Cox Power transformations:
I've confirmed this works for all of my data x>0, and that inv(trans(x)) == x. I've also used this to scale my axes successfully.
I'm new to git, so I'm just reporting this here.