We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
to your account
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.
The text was updated successfully, but these errors were encountered:
trans and inv are wrong - they should be:
trans <- function(x) (x^p - 1)/p * sign(p)
inv <- function(x) (x * p * sign(p) + 1)^(1/p)
With these changes, for all x >= 0, inv(trans(x)) == x.
Sorry, something went wrong.
Fix boxcox_trans equations and docs
implements Modulus generalization, Closes r-lib#103
Fix boxcox_trans equations and docs (#135)
implements Modulus generalization, Closes #103
The Box-Cox and modulus transformations are distinct, yet this treats mt as generalising Box-Cox.
Box-Cox uses x^p while mt uses sign(x) * (abs(x) + 1)^p, which for positive x is (x + 1)^p.
sign(x) * (abs(x) + 1)^p
(x + 1)^p
So a proper solution should provide Box-Cox and mt as two distinct functions.
Successfully merging a pull request may close this issue.