Skip to content

Commit

Permalink
Renaming Process Control options for syntax (#192)
Browse files Browse the repository at this point in the history
* Fix unit tests

* Rename Type 1 Gauge Study

* Rename Linearity Study

* Renaming Type 2 and 3 Gauge RR Part 1

* Renaming Type 2 and 3 Gauge RR Part 2

* Feedback Simon 1

* Renaming gauge r&R non-replicable

* Set up upgrades.qml properly

* Renaming Attributes Agreement Analysis

* Renaming Test-retest

* Renaming Variable Charts for Subgroups

* Renaming Control Charts for Attributes

* Renaming Time Weighted Charts and updating version

* Renaming Process Capability Studies and fixing upgrade file

* Renaming Two-level Factorial Design

* Renaming General Full Factorial Design

* Renaming General Full Factorial Design missed option

* Renaming Response Surface Design

* Renaming Custom Design

* Renaming Probability of Detection

* Forgot to rename Probability of Detection options in unit test

* Fix capitalization of files issue

* Rename time weighted charts again

* Forgot to replace a line

* Change version upgrade file to current upgrade

* Fix renaming and upgrading individual charts

* bump version numbers

* fix little upgrade errors

* add stateless upgrade jasp files

---------

Co-authored-by: Kucharssim <[email protected]>
  • Loading branch information
JTPetter and Kucharssim authored Oct 26, 2023
1 parent d3d9330 commit 5030e70
Show file tree
Hide file tree
Showing 81 changed files with 2,974 additions and 1,964 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: jaspQualityControl
Type: Package
Title: Quality Control Module for JASP
Version: 0.18.1
Date: 2022-10-05
Version: 0.18.2
Date: 2022-10-25
Author: JASP Team
Website: https://github.com/jasp-stats/jaspQualityControl
Maintainer: JASP <[email protected]>
Expand Down
81 changes: 42 additions & 39 deletions R/TimeWeightedCharts.R
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
#' @export
timeWeightedCharts <- function(jaspResults, dataset, options) {
variables <- options$variables
variables <- options[["measurements"]]
numeric_variables <- variables[variables != ""]
dataset <- .readDataSetToEnd(columns.as.numeric = numeric_variables, exclude.na.listwise = numeric_variables)
#Checking for errors in the dataset
.hasErrors(dataset, type = c('infinity', 'missingValues'),
all.target = options$variables, exitAnalysisIfErrors = TRUE)
all.target = options[["measurements"]], exitAnalysisIfErrors = TRUE)

ready <- length(variables) > 0

#Cusum chart
if (options$Cumulativechart && is.null(jaspResults[["CusumPlot"]])) {
jaspResults[["CusumPlot"]] <- createJaspPlot(title = gettext("Cumulative sum chart"), width = 1200, height = 500)
jaspResults[["CusumPlot"]]$dependOn(c("Cumulativechart", "variables"))
jaspResults[["CusumPlot"]]$plotObject <- .Cusumchart(dataset = dataset, options = options, ready = ready)
}
#EWMA chart
if (options$Exponentialchart && is.null(jaspResults[["EWMAPlot"]])) {
jaspResults[["EWMAPlot"]] <- createJaspPlot(title = gettext("Exponentially weighted moving average chart"), width = 1200, height = 500)
jaspResults[["EWMAPlot"]]$dependOn(c("Exponentialchart", "variables"))
jaspResults[["EWMAPlot"]]$plotObject <- .EWMA(dataset = dataset, options = options, ready = ready)
}
#G chart
if (options$gchart && is.null(jaspResults[["GPlot"]])) {
jaspResults[["GPlot"]] <- createJaspPlot(title = gettext("G chart"), width = 1200, height = 500)
jaspResults[["GPlot"]]$dependOn(c("gchart", "variables"))
jaspResults[["GPlot"]]$plotObject <- .Gchart(dataset = dataset, options = options, ready = ready)$p
if (length(variables) > 0) {
#Cusum chart
if (options[["cumulativeSumChart"]] && is.null(jaspResults[["CusumPlot"]])) {
jaspResults[["CusumPlot"]] <- createJaspPlot(title = gettext("Cumulative sum chart"), width = 1200, height = 500)
jaspResults[["CusumPlot"]]$dependOn(c("cumulativeSumChart", "measurements"))
jaspResults[["CusumPlot"]]$plotObject <- .Cusumchart(dataset = dataset, options = options, ready = ready)
}
#EWMA chart
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)
}
#G chart
if (options[["gChart"]] && is.null(jaspResults[["GPlot"]])) {
jaspResults[["GPlot"]] <- createJaspPlot(title = gettext("G chart"), width = 1200, height = 500)
jaspResults[["GPlot"]]$dependOn(c("gChart", "measurements"))
jaspResults[["GPlot"]]$plotObject <- .Gchart(dataset = dataset, options = options, ready = ready)$p
}
#T chart
# if (options[["tChart"]] && is.null(jaspResults[["TPlot"]])) {
# jaspResults[["TPlot"]] <- createJaspPlot(title = gettext("T chart"), width = 1200, height = 500)
# jaspResults[["TPlot"]]$dependOn(c("tChart", "measurements"))
# jaspResults[["TPlot"]]$plotObject <- .Tchart(dataset = dataset, options = options, ready = ready)$p
# }
}
# #T chart
# if (options$tchart && is.null(jaspResults[["TPlot"]])) {
# jaspResults[["TPlot"]] <- createJaspPlot(title = gettext("T chart"), width = 1200, height = 500)
# jaspResults[["TPlot"]]$dependOn(c("tchart", "variables"))
# jaspResults[["TPlot"]]$plotObject <- .Tchart(dataset = dataset, options = options, ready = ready)$p
# }
}

.Cusumchart <- function(dataset, options, ready) {
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 @@ -79,11 +83,10 @@ timeWeightedCharts <- function(jaspResults, dataset, options) {
.EWMA <- function(dataset, options, ready) {
if (!ready)
return()

data1 <- dataset[, options$variables]
decimals <- max(.decimalplaces(data1))
sixsigma <- qcc::ewma(data1, center = options$EWMAcenter , lambda = options$EWMAlambda,
std.dev = options$EWMAStd, nsigmas = options$EWMANsigma, plot = FALSE)
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)
subgroups <- 1:length(sixsigma$sizes)
center <- sixsigma$center
UCL <- sixsigma$limits[,2]
Expand All @@ -96,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$EWMANsigma * sqrt(options$EWMAlambda/(2-options$EWMAlambda))*options$EWMAStd
LCL.label <- center - options$EWMANsigma * sqrt(options$EWMAlambda/(2-options$EWMAlambda))*options$EWMAStd
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 Down Expand Up @@ -125,8 +128,8 @@ timeWeightedCharts <- function(jaspResults, dataset, options) {
.Gchart <- function(dataset, options, ready){
if (!ready)
return()
data1 <- dataset[, options$variables]

data1 <- dataset[, options[["measurements"]]]
subgroups <- c(1:length(data1))
data_plot <- data.frame(x = subgroups, y = data1)
center = mean(data1)
Expand Down Expand Up @@ -165,11 +168,11 @@ timeWeightedCharts <- function(jaspResults, dataset, options) {

return(list(p = p, sixsigma = sixsigma))
}
.Tchart <- function(dataset, options, ready){
.Tchart <- function(dataset, options){
if (!ready)
return()
data1 <- dataset[, options$variables]

data1 <- dataset[, options[["measurements"]]]
subgroups <- c(1:length(data1))
data_plot <- data.frame(x = subgroups , y = data1^0.2777)
data2 <- data.frame(process = data1)
Expand Down
Loading

0 comments on commit 5030e70

Please sign in to comment.