Skip to content

Commit

Permalink
Rename time weighted charts again
Browse files Browse the repository at this point in the history
  • Loading branch information
JTPetter committed Sep 24, 2023
1 parent b896bb7 commit ecea49d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
18 changes: 9 additions & 9 deletions R/TimeWeightedCharts.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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]
Expand All @@ -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),
Expand All @@ -125,7 +125,7 @@ timeWeightedCharts <- function(jaspResults, dataset, options) {

return(p)
}
.Gchart <- function(dataset, options){
.Gchart <- function(dataset, options, ready){
if (!ready)
return()

Expand Down
14 changes: 9 additions & 5 deletions inst/Upgrades.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down Expand Up @@ -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"}

Expand Down
20 changes: 10 additions & 10 deletions inst/qml/timeWeightedCharts.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Form

AssignedVariablesList
{
name: "variables"
name: "measurements"
title: qsTr("Measurements")
allowedColumns: ["scale"]
}
Expand All @@ -30,21 +30,21 @@ 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"
}

DoubleField
{
name: "k"
name: "cumulativeSumChartShiftSize"
label: qsTr("Shift size")
defaultValue: 0.5
enabled: variationReference.currentValue != "studyVariation"
Expand All @@ -53,41 +53,41 @@ 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
}

DoubleField
{
name: "EWMANsigma"
name: "exponentiallyWeightedMovingAverageChartSigmaControlLimits"
label: qsTr("Sigmas for computing control limits")
defaultValue: 3
}
}

CheckBox
{
name: "gchart"
name: "gChart"
label: qsTr("g chart")
}

Expand Down

0 comments on commit ecea49d

Please sign in to comment.