From 34f2910368dacfcc69319c0cfcae569695a9465f Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Fri, 29 Aug 2025 18:07:08 +0200 Subject: [PATCH 1/3] add auto transforms to computed columns window --- Common/r_functionwhitelist.cpp | 3 ++ .../JASP/Widgets/ComputeColumnWindow.qml | 30 +++++++++++-------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Common/r_functionwhitelist.cpp b/Common/r_functionwhitelist.cpp index 35190090b9..b2293b4132 100644 --- a/Common/r_functionwhitelist.cpp +++ b/Common/r_functionwhitelist.cpp @@ -36,6 +36,7 @@ const std::set R_FunctionWhiteList::functionWhiteList { "attr", "attributes", "BoxCox", + "BoxCoxAuto", "binom.test", "by", "c", @@ -137,6 +138,7 @@ const std::set R_FunctionWhiteList::functionWhiteList { "pmin", "poly", "powerTransform", + "powerTransformAuto", "power.t.test", "predict", "print", @@ -220,6 +222,7 @@ const std::set R_FunctionWhiteList::functionWhiteList { "which.min", "xtabs", "YeoJohnson", + "YeoJohnsonAuto", ".setColumnDataAsScale", ".setColumnDataAsOrdinal", ".setColumnDataAsNominal", ".setColumnDataAsNominalText", "function", "stop", diff --git a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml index f7046c248a..c128e25e0b 100644 --- a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml +++ b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml @@ -196,19 +196,23 @@ FocusScope ListElement { type: "separator" } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "log"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("natural logarithm") } - ListElement { type: "function"; friendlyFunctionName: "log\u2082"; functionName: "log2"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("base 2 logarithm") } - ListElement { type: "function"; friendlyFunctionName: "log\u2081\u2080"; functionName: "log10"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("base 10 logarithm") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "logb"; functionParameters: "y,base"; functionParamTypes: "number,number"; toolTip: qsTr("logarithm of y in 'base'") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "exp"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("exponential") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "fishZ"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Fisher's Z-transform (i.e., the inverse hyperbolic tangent) to transform correlations, numbers between -1 and 1 to the real line") } - ListElement { type: "function"; friendlyFunctionName: "fishZ\u207B\u00B9"; functionName: "invFishZ"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse Fisher's Z-transform (i.e., the hyperbolic tangent) to transform real numbers to numbers between -1 and 1") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "logit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Logit transform (i.e., the inverse of the standard logit function, or log-odds transform) converts numbers between 0 and 1 to the real line.") } - ListElement { type: "function"; friendlyFunctionName: "logit\u207B\u00B9"; functionName: "invLogit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse logit transform (i.e., the standard logit function) converts numbers on the real line to numbers between 0 and 1.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCox"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter Box-Cox transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: "BoxCox\u207B\u00B9"; functionName: "invBoxCox"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Inverse two-parameter Box-Cox transform.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransform"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter power transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnson"; functionParameters: "y,lambda"; functionParamTypes: "number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "log"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("natural logarithm") } + ListElement { type: "function"; friendlyFunctionName: "log\u2082"; functionName: "log2"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("base 2 logarithm") } + ListElement { type: "function"; friendlyFunctionName: "log\u2081\u2080"; functionName: "log10"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("base 10 logarithm") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "logb"; functionParameters: "y,base"; functionParamTypes: "number,number"; toolTip: qsTr("logarithm of y in 'base'") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "exp"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("exponential") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "fishZ"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Fisher's Z-transform (i.e., the inverse hyperbolic tangent) to transform correlations, numbers between -1 and 1 to the real line") } + ListElement { type: "function"; friendlyFunctionName: "fishZ\u207B\u00B9"; functionName: "invFishZ"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse Fisher's Z-transform (i.e., the hyperbolic tangent) to transform real numbers to numbers between -1 and 1") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "logit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Logit transform (i.e., the inverse of the standard logit function, or log-odds transform) converts numbers between 0 and 1 to the real line.") } + ListElement { type: "function"; friendlyFunctionName: "logit\u207B\u00B9"; functionName: "invLogit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse logit transform (i.e., the standard logit function) converts numbers on the real line to numbers between 0 and 1.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCox"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter Box-Cox transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCoxAuto"; functionParameters: "y,method,lower,upper,shift"; functionParamTypes: "number,string,number,number,number"; toolTip: qsTr("Two-parameter Box-Cox transform with an automatic determination of the shape parameter lambda, according to one of the two of methods:'loglik' or 'minitab'. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: "BoxCox\u207B\u00B9"; functionName: "invBoxCox"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Inverse two-parameter Box-Cox transform.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransform"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter power transform (scale-invariant Box-Box; transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransformAuto"; functionParameters: "y,lower,upper,shift"; functionParamTypes: "number,number,number,number"; toolTip: qsTr("Two-parameter power transform with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnson"; functionParameters: "y,lambda"; functionParamTypes: "number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnsonAuto"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "separator" } ListElement { type: "function"; friendlyFunctionName: ""; functionName: "cut"; functionParameters: "values,numBreaks"; functionParamTypes: "number,number"; toolTip: qsTr("break your data up in numBreaks levels") } From 21eba788e73d4d150dbb8d42e2cc8950eb49bfbb Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Thu, 6 Nov 2025 13:05:14 +0100 Subject: [PATCH 2/3] update transform functions --- Common/r_functionwhitelist.cpp | 1 + .../JASP/Widgets/ComputeColumnWindow.qml | 15 ++++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Common/r_functionwhitelist.cpp b/Common/r_functionwhitelist.cpp index b2293b4132..2ef0b0aeef 100644 --- a/Common/r_functionwhitelist.cpp +++ b/Common/r_functionwhitelist.cpp @@ -96,6 +96,7 @@ const std::set R_FunctionWhiteList::functionWhiteList { "is.na", "is.null", "is.numeric", + "Johnson", "lag", "lapply", "length", diff --git a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml index c128e25e0b..901fffd687 100644 --- a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml +++ b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml @@ -205,13 +205,14 @@ FocusScope ListElement { type: "function"; friendlyFunctionName: "fishZ\u207B\u00B9"; functionName: "invFishZ"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse Fisher's Z-transform (i.e., the hyperbolic tangent) to transform real numbers to numbers between -1 and 1") } ListElement { type: "function"; friendlyFunctionName: ""; functionName: "logit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Logit transform (i.e., the inverse of the standard logit function, or log-odds transform) converts numbers between 0 and 1 to the real line.") } ListElement { type: "function"; friendlyFunctionName: "logit\u207B\u00B9"; functionName: "invLogit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse logit transform (i.e., the standard logit function) converts numbers on the real line to numbers between 0 and 1.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCox"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter Box-Cox transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCoxAuto"; functionParameters: "y,method,lower,upper,shift"; functionParamTypes: "number,string,number,number,number"; toolTip: qsTr("Two-parameter Box-Cox transform with an automatic determination of the shape parameter lambda, according to one of the two of methods:'loglik' or 'minitab'. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } - ListElement { type: "function"; friendlyFunctionName: "BoxCox\u207B\u00B9"; functionName: "invBoxCox"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Inverse two-parameter Box-Cox transform.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransform"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter power transform (scale-invariant Box-Box; transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransformAuto"; functionParameters: "y,lower,upper,shift"; functionParamTypes: "number,number,number,number"; toolTip: qsTr("Two-parameter power transform with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnson"; functionParameters: "y,lambda"; functionParamTypes: "number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnsonAuto"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCox"; functionParameters: "y,lambda,shift,continuityAdjustment"; functionParamTypes: "number,number,number,boolean"; toolTip: qsTr("Two-parameter Box-Cox transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCoxAuto"; functionParameters: "y,predictor,method,lower,upper,shift,continuityAdjustment"; functionParamTypes: "number,number,string,number,number,number,boolean"; toolTip: qsTr("Two-parameter Box-Cox transform with an automatic determination of the shape parameter lambda, according to one of the three of methods:'loglik', 'sd', or 'movingRange'. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: "BoxCox\u207B\u00B9"; functionName: "invBoxCox"; functionParameters: "y,lambda,shift,continuityAdjustment"; functionParamTypes: "number,number,number,bool"; toolTip: qsTr("Inverse two-parameter Box-Cox transform.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransform"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter power transform (scale-invariant Box-Box; transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransformAuto"; functionParameters: "y,predictor,lower,upper,shift"; functionParamTypes: "number,number,number,number,number"; toolTip: qsTr("Two-parameter power transform with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnson"; functionParameters: "y,lambda"; functionParamTypes: "number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnsonAuto"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "Johnson"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Johnson transform (transforms any real values). The search for optimal parameter is bounded within 'lower' and 'upper' limits.") } ListElement { type: "separator" } From edbb83214248395f42e8acb6f33665282d080c2b Mon Sep 17 00:00:00 2001 From: Kucharssim Date: Tue, 11 Nov 2025 15:31:30 +0100 Subject: [PATCH 3/3] update auto transform function (add groupSize arg) --- .../JASP/Widgets/ComputeColumnWindow.qml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml index 901fffd687..6a04ca6a73 100644 --- a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml +++ b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml @@ -205,14 +205,14 @@ FocusScope ListElement { type: "function"; friendlyFunctionName: "fishZ\u207B\u00B9"; functionName: "invFishZ"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse Fisher's Z-transform (i.e., the hyperbolic tangent) to transform real numbers to numbers between -1 and 1") } ListElement { type: "function"; friendlyFunctionName: ""; functionName: "logit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Logit transform (i.e., the inverse of the standard logit function, or log-odds transform) converts numbers between 0 and 1 to the real line.") } ListElement { type: "function"; friendlyFunctionName: "logit\u207B\u00B9"; functionName: "invLogit"; functionParameters: "y"; functionParamTypes: "number"; toolTip: qsTr("Inverse logit transform (i.e., the standard logit function) converts numbers on the real line to numbers between 0 and 1.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCox"; functionParameters: "y,lambda,shift,continuityAdjustment"; functionParamTypes: "number,number,number,boolean"; toolTip: qsTr("Two-parameter Box-Cox transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCoxAuto"; functionParameters: "y,predictor,method,lower,upper,shift,continuityAdjustment"; functionParamTypes: "number,number,string,number,number,number,boolean"; toolTip: qsTr("Two-parameter Box-Cox transform with an automatic determination of the shape parameter lambda, according to one of the three of methods:'loglik', 'sd', or 'movingRange'. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } - ListElement { type: "function"; friendlyFunctionName: "BoxCox\u207B\u00B9"; functionName: "invBoxCox"; functionParameters: "y,lambda,shift,continuityAdjustment"; functionParamTypes: "number,number,number,bool"; toolTip: qsTr("Inverse two-parameter Box-Cox transform.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransform"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter power transform (scale-invariant Box-Box; transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransformAuto"; functionParameters: "y,predictor,lower,upper,shift"; functionParamTypes: "number,number,number,number,number"; toolTip: qsTr("Two-parameter power transform with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnson"; functionParameters: "y,lambda"; functionParamTypes: "number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) to stabilize variance and attempt to make the data more normal distribution-like.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnsonAuto"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } - ListElement { type: "function"; friendlyFunctionName: ""; functionName: "Johnson"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Johnson transform (transforms any real values). The search for optimal parameter is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCox"; functionParameters: "y,lambda,shift,continuityAdjustment"; functionParamTypes: "number,number,number,boolean"; toolTip: qsTr("Two-parameter Box-Cox transform (transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "BoxCoxAuto"; functionParameters: "y,predictor,groupSize,method,lower,upper,shift,continuityAdjustment"; functionParamTypes: "number,number,number,string,number,number,number,boolean"; toolTip: qsTr("Two-parameter Box-Cox transform with an automatic determination of the shape parameter lambda, according to one of the three of methods:'loglik', 'sd', or 'movingRange'. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: "BoxCox\u207B\u00B9"; functionName: "invBoxCox"; functionParameters: "y,lambda,shift,continuityAdjustment"; functionParamTypes: "number,number,number,bool"; toolTip: qsTr("Inverse two-parameter Box-Cox transform.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransform"; functionParameters: "y,lambda,shift"; functionParamTypes: "number,number,number"; toolTip: qsTr("Two-parameter power transform (scale-invariant Box-Box; transforms values greater than -shift) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "powerTransformAuto"; functionParameters: "y,predictor,groupSize,lower,upper,shift"; functionParamTypes: "number,number,number,number,number,number"; toolTip: qsTr("Two-parameter power transform with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnson"; functionParameters: "y,lambda"; functionParamTypes: "number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) to stabilize variance and attempt to make the data more normal distribution-like.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "YeoJohnsonAuto"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Yeo-Johnson transform (transforms any real values) with an automatic determination of the shape parameter lambda. The search for optimal lambda is bounded within 'lower' and 'upper' limits.") } + ListElement { type: "function"; friendlyFunctionName: ""; functionName: "Johnson"; functionParameters: "y,lower,upper"; functionParamTypes: "number,number,number"; toolTip: qsTr("Johnson transform (transforms any real values). The search for optimal parameter is bounded within 'lower' and 'upper' limits.") } ListElement { type: "separator" }