From ecea49d13895b7997a652e21f46ae5410ab559a1 Mon Sep 17 00:00:00 2001 From: JTPetter <61797391+JTPetter@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:35:06 +0200 Subject: [PATCH] Rename time weighted charts again --- R/TimeWeightedCharts.R | 18 +++++++++--------- inst/Upgrades.qml | 14 +++++++++----- inst/qml/timeWeightedCharts.qml | 20 ++++++++++---------- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/R/TimeWeightedCharts.R b/R/TimeWeightedCharts.R index a9a41fc4..9f385ade 100644 --- a/R/TimeWeightedCharts.R +++ b/R/TimeWeightedCharts.R @@ -17,7 +17,7 @@ timeWeightedCharts <- function(jaspResults, dataset, options) { jaspResults[["CusumPlot"]]$plotObject <- .Cusumchart(dataset = dataset, options = options, ready = ready) } #EWMA chart - if (options[["ExponentiallyWeightedMovingAverageChart"]] && is.null(jaspResults[["EWMAPlot"]])) { + if (options[["exponentiallyWeightedMovingAverageChart"]] && is.null(jaspResults[["EWMAPlot"]])) { jaspResults[["EWMAPlot"]] <- createJaspPlot(title = gettext("Exponentially weighted moving average chart"), width = 1200, height = 500) jaspResults[["EWMAPlot"]]$dependOn(c("ExponentiallyWeightedMovingAverageChart", "measurements")) jaspResults[["EWMAPlot"]]$plotObject <- .EWMA(dataset = dataset, options = options, ready = ready) @@ -41,8 +41,8 @@ timeWeightedCharts <- function(jaspResults, dataset, options) { if (!ready) return() - data1 <- dataset[, options$variables] - sixsigma <- qcc::cusum(data1, decision.interval = options$h, se.shift = options$k, plot = FALSE) + data1 <- dataset[, options[["measurements"]]] + sixsigma <- qcc::cusum(data1, decision.interval = options[["cumulativeSumChartNumberSd"]], se.shift = options[["cumulativeSumChartShiftSize"]], plot = FALSE) subgroups <- c(1:length(sixsigma$pos)) data_plot <- data.frame(y_neg = sixsigma$neg , y_pos = sixsigma$pos, x = subgroups) center <- 0 @@ -83,10 +83,10 @@ timeWeightedCharts <- function(jaspResults, dataset, options) { .EWMA <- function(dataset, options, ready) { if (!ready) return() - + decimals <- .numDecimals data1 <- dataset[, options[["measurements"]]] - sixsigma <- qcc::ewma(data1, center = options[["ExponentiallyWeightedMovingAverageChartCenter"]] , lambda = options[["ExponentiallyWeightedMovingAverageChartLambda"]], - std.dev = options[["ExponentiallyWeightedMovingAverageChartSd"]], nsigmas = options[["ExponentiallyWeightedMovingAverageChartSigmaControlLimits"]], plot = FALSE) + sixsigma <- qcc::ewma(data1, center = options[["exponentiallyWeightedMovingAverageChartCenter"]] , lambda = options[["exponentiallyWeightedMovingAverageChartLambda"]], + std.dev = options[["exponentiallyWeightedMovingAverageChartSd"]], nsigmas = options[["exponentiallyWeightedMovingAverageChartSigmaControlLimits"]], plot = FALSE) subgroups <- 1:length(sixsigma$sizes) center <- sixsigma$center UCL <- sixsigma$limits[,2] @@ -99,8 +99,8 @@ timeWeightedCharts <- function(jaspResults, dataset, options) { else xBreaks <- c(subgroups) xLimits <- c(1,max(xBreaks-0.5) * 1.15) - UCL.label <- center + options[["ExponentiallyWeightedMovingAverageChartSigmaControlLimits"]] * sqrt(options[["ExponentiallyWeightedMovingAverageChartLambda"]] / (2-options[["ExponentiallyWeightedMovingAverageChartLambda"]])) * options[["ExponentiallyWeightedMovingAverageChartSd"]] - LCL.label <- center - options[["ExponentiallyWeightedMovingAverageChartSigmaControlLimits"]] * sqrt(options[["ExponentiallyWeightedMovingAverageChartLambda"]] / (2-options[["ExponentiallyWeightedMovingAverageChartLambda"]])) * options[["ExponentiallyWeightedMovingAverageChartSd"]] + UCL.label <- center + options[["exponentiallyWeightedMovingAverageChartSigmaControlLimits"]] * sqrt(options[["exponentiallyWeightedMovingAverageChartLambda"]] / (2-options[["exponentiallyWeightedMovingAverageChartLambda"]])) * options[["exponentiallyWeightedMovingAverageChartSd"]] + LCL.label <- center - options[["exponentiallyWeightedMovingAverageChartSigmaControlLimits"]] * sqrt(options[["exponentiallyWeightedMovingAverageChartLambda"]] / (2-options[["exponentiallyWeightedMovingAverageChartLambda"]])) * options[["exponentiallyWeightedMovingAverageChartSd"]] dfLabel <- data.frame( x = max(xLimits) * 0.95, y = c(center, UCL.label, LCL.label), @@ -125,7 +125,7 @@ timeWeightedCharts <- function(jaspResults, dataset, options) { return(p) } -.Gchart <- function(dataset, options){ +.Gchart <- function(dataset, options, ready){ if (!ready) return() diff --git a/inst/Upgrades.qml b/inst/Upgrades.qml index fa080623..ff704a2a 100644 --- a/inst/Upgrades.qml +++ b/inst/Upgrades.qml @@ -434,6 +434,10 @@ Upgrades toVersion: "0.16.4" // main analysis + ChangeRename {from: "variables"; to: "measurement"} + ChangeRename {from: "subgroups"; to: "subgroup"} + ChangeRename {from: "ImRchart"; to: "xmrChart"} + ChangeRename {from: "ncol"; to: "xmrChartMovingRangeLength"} ChangeRename {from: "manualTicks"; to: "manualTicksXAxis"} ChangeRename {from: "nTicks"; to: "manualTicksXAxisValue"} ChangeRename {from: "CorPlot"; to: "autocorrelationPlot"} @@ -535,11 +539,11 @@ Upgrades ChangeRename {from: "Cumulativechart"; to: "cumulativeSumChart"} ChangeRename {from: "h"; to: "cumulativeSumChartNumberSd"} ChangeRename {from: "k"; to: "cumulativeSumChartShiftSize"} - ChangeRename {from: "Exponentialchart"; to: "ExponentiallyWeightedMovingAverageChart"} - ChangeRename {from: "EWMAlambda"; to: "ExponentiallyWeightedMovingAverageChartLambda"} - ChangeRename {from: "EWMAcenter"; to: "ExponentiallyWeightedMovingAverageChartCenter"} - ChangeRename {from: "EWMAStd"; to: "ExponentiallyWeightedMovingAverageChartSd"} - ChangeRename {from: "EWMANsigma"; to: "ExponentiallyWeightedMovingAverageChartSigmaControlLimits"} + ChangeRename {from: "Exponentialchart"; to: "exponentiallyWeightedMovingAverageChart"} + ChangeRename {from: "EWMAlambda"; to: "exponentiallyWeightedMovingAverageChartLambda"} + ChangeRename {from: "EWMAcenter"; to: "exponentiallyWeightedMovingAverageChartCenter"} + ChangeRename {from: "EWMAStd"; to: "exponentiallyWeightedMovingAverageChartSd"} + ChangeRename {from: "EWMANsigma"; to: "exponentiallyWeightedMovingAverageChartSigmaControlLimits"} ChangeRename {from: "gchart"; to: "gChart"} ChangeRename {from: "tchart"; to: "tChart"} diff --git a/inst/qml/timeWeightedCharts.qml b/inst/qml/timeWeightedCharts.qml index dace4b61..aac05c85 100644 --- a/inst/qml/timeWeightedCharts.qml +++ b/inst/qml/timeWeightedCharts.qml @@ -18,7 +18,7 @@ Form AssignedVariablesList { - name: "variables" + name: "measurements" title: qsTr("Measurements") allowedColumns: ["scale"] } @@ -30,13 +30,13 @@ Form CheckBox { - name: "Cumulativechart" + name: "cumulativeSumChart" label: qsTr("Cumulative sum chart") checked: true DoubleField { - name: "h" + name: "cumulativeSumChartNumberSd" label: qsTr("Number of standard deviations") defaultValue: 4 enabled: variationReference.currentValue != "studyVariation" @@ -44,7 +44,7 @@ Form DoubleField { - name: "k" + name: "cumulativeSumChartShiftSize" label: qsTr("Shift size") defaultValue: 0.5 enabled: variationReference.currentValue != "studyVariation" @@ -53,25 +53,25 @@ Form CheckBox { - name: "Exponentialchart" + name: "exponentiallyWeightedMovingAverageChart" label: qsTr("Exponentially weighted moving average chart") DoubleField { - name: "EWMAlambda" + name: "exponentiallyWeightedMovingAverageChartLambda" label: qsTr("Lambda") defaultValue: 0.3 } DoubleField { - name: "EWMAcenter" + name: "exponentiallyWeightedMovingAverageChartCenter" label: qsTr("Center") } DoubleField { - name: "EWMAStd" + name: "exponentiallyWeightedMovingAverageChartSd" label: qsTr("Within-group standard deviation") defaultValue: 3 fieldWidth: 50 @@ -79,7 +79,7 @@ Form DoubleField { - name: "EWMANsigma" + name: "exponentiallyWeightedMovingAverageChartSigmaControlLimits" label: qsTr("Sigmas for computing control limits") defaultValue: 3 } @@ -87,7 +87,7 @@ Form CheckBox { - name: "gchart" + name: "gChart" label: qsTr("g chart") }