From 564daac969537e75963731ad181b7257cacc9768 Mon Sep 17 00:00:00 2001 From: JTPetter Date: Thu, 28 May 2026 14:50:06 +0200 Subject: [PATCH 1/2] Fix doe bug with saturated design and update unit tests --- R/doeAnalysis.R | 168 ++++++++++++----- ...pareto-chart-of-standardized-effects27.svg | 172 +++++++++--------- ...pareto-chart-of-standardized-effects27.rds | Bin 1371 -> 1381 bytes 3 files changed, 216 insertions(+), 124 deletions(-) diff --git a/R/doeAnalysis.R b/R/doeAnalysis.R index bd47f4dd4..274000b9f 100644 --- a/R/doeAnalysis.R +++ b/R/doeAnalysis.R @@ -1629,47 +1629,84 @@ get_levels <- function(var, num_levels, dataset) { if (!is.null(jaspResults[[dep]][["plotPareto"]]) || !options[["plotPareto"]]) { return() } - plot <- createJaspPlot(title = gettext("Pareto Chart of Standardized Effects"), width = 600, height = 400) - plot$dependOn(options = c("plotPareto", "tableAlias", .doeAnalysisBaseDependencies())) - plot$position <- 6 - jaspResults[[dep]][["plotPareto"]] <- plot if (!ready || is.null(jaspResults[[dep]][["doeResult"]]) || jaspResults[[dep]]$getError()) { return() } result <- if (options[["codeFactors"]]) jaspResults[[dep]][["doeResultCoded"]]$object[["regression"]] else jaspResults[[dep]][["doeResult"]]$object[["regression"]] fac <- if (options[["tableAlias"]]) result[["coefficients"]][["termsAliased"]][-1] else result[["coefficients"]][["terms"]][-1] - coefDf <- data.frame(result[["objectSummary"]]$coefficients) - tDf <- data.frame("tValue" = coefDf[["t.value"]], - terms = result[["coefficients"]][["terms"]]) + coefTerms <- result[["coefficients"]][["terms"]] + metricValues <- result[["coefficients"]][["effects"]] + df <- result[["objectSummary"]]$df[2] + pse <- NA_real_ + if (!is.na(df) && df > 0) { + metricValues <- result[["objectSummary"]]$coefficients[, "t value"] + } else { + effectAbs <- abs(metricValues) + effectAbs <- effectAbs[is.finite(effectAbs)] + if (length(effectAbs) > 0) { + s0 <- 1.5 * stats::median(effectAbs) + s1 <- effectAbs[effectAbs < 2.5 * s0] + if (length(s1) > 0) { + pse <- 1.5 * stats::median(s1) + } + } + } + metricDf <- data.frame(metric = metricValues, terms = coefTerms) # Do not include intercept, covariates and blocks in pareto plot - tDf <- tDf[-1, ] # remove intercept + metricDf <- metricDf[-1, ] # remove intercept if (length(blocks) > 0 && !identical(blocks, "")) { - tDf <- tDf[!grepl(blocks, tDf$terms),] + metricDf <- metricDf[!grepl(blocks, metricDf$terms),] fac <- if (options[["tableAlias"]]) fac[!grepl("BLK", fac)] else fac[!grepl(blocks, fac)] } if (length(covariates) > 0 && !identical(covariates, "")) { - tDf <- tDf[!tDf$terms %in% unlist(covariates), ] # remove the covariate(s) + metricDf <- metricDf[!metricDf$terms %in% unlist(covariates), ] # remove the covariate(s) fac <- if (options[["tableAlias"]]) fac[!grepl("COV", fac)] else fac[!fac %in% unlist(covariates)] } - t <- abs(tDf[["tValue"]]) - df <- result[["objectSummary"]]$df[2] - crit <- abs(qt(0.025, df)) - fac_t <- cbind.data.frame(fac, t) - fac_t <- cbind(fac_t[order(fac_t$t), ], y = seq_len(length(t))) - xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, t, crit)) - critLabelDf <- data.frame(x = 0, y = crit, label = sprintf("t = %.2f", crit)) - p <- ggplot2::ggplot(data = fac_t, mapping = ggplot2::aes(y = t, x = y)) + + metric <- abs(metricDf[["metric"]]) + facMetric <- cbind.data.frame(fac, metric) + facMetric <- cbind(facMetric[order(facMetric$metric), ], y = seq_len(length(metric))) + xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, metric)) + axisLabel <- if (!is.na(df) && df > 0) gettext("Standardized Effect") else gettext("Effect") + plotTitle <- if (!is.na(df) && df > 0) { + gettext("Pareto Chart of Standardized Effects") + } else { + gettext("Pareto Chart of Effects") + } + plot <- createJaspPlot(title = plotTitle, width = 600, height = 400) + plot$dependOn(options = c("plotPareto", "tableAlias", .doeAnalysisBaseDependencies())) + plot$position <- 6 + jaspResults[[dep]][["plotPareto"]] <- plot + p <- ggplot2::ggplot(data = facMetric, mapping = ggplot2::aes(y = metric, x = y)) + ggplot2::geom_bar(stat = "identity") + - ggplot2::geom_hline(yintercept = crit, linetype = "dashed", color = "red") + - ggplot2::geom_label(data = critLabelDf, mapping = ggplot2::aes(x = x, y = y, label = label), col = "red", size = 5) + - ggplot2::scale_x_continuous(name = gettext("Term"), breaks = fac_t$y, labels = fac_t$fac) + - ggplot2::scale_y_continuous(name = - gettext("Standardized Effect"), breaks = xBreaks, limits = range(xBreaks)) + + ggplot2::scale_x_continuous(name = gettext("Term"), breaks = facMetric$y, labels = facMetric$fac) + + ggplot2::scale_y_continuous(name = axisLabel, breaks = xBreaks, limits = range(xBreaks)) + ggplot2::coord_flip() + jaspGraphs::geom_rangeframe() + jaspGraphs::themeJaspRaw() + + df <- result[["objectSummary"]]$df[2] + if (!is.na(df) && df > 0) { + crit <- abs(qt(0.025, df)) + xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, metric, crit)) + critLabelDf <- data.frame(x = 0, y = crit, label = sprintf("t = %.2f", crit)) + p <- p + + ggplot2::geom_hline(yintercept = crit, linetype = "dashed", color = "red") + + ggplot2::geom_label(data = critLabelDf, mapping = ggplot2::aes(x = x, y = y, label = label), col = "red", size = 5) + + ggplot2::scale_y_continuous(name = axisLabel, breaks = xBreaks, limits = range(xBreaks)) + } else if (!is.na(pse) && pse > 0) { + effectAbs <- abs(metric) + dfLenth <- max(1, floor(length(effectAbs) / 3)) + crit <- stats::qt(0.975, dfLenth) * pse + xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(0, metric, crit)) + critLabelDf <- data.frame(x = 0, y = crit, label = sprintf("ME = %.2f", crit)) + p <- p + + ggplot2::geom_hline(yintercept = crit, linetype = "dashed", color = "red") + + ggplot2::geom_label(data = critLabelDf, mapping = ggplot2::aes(x = x, y = y, label = label), col = "red", size = 5) + + ggplot2::scale_y_continuous(name = axisLabel, breaks = xBreaks, limits = range(xBreaks)) + } + plot$plotObject <- p } } @@ -1679,18 +1716,30 @@ get_levels <- function(var, num_levels, dataset) { if (!is.null(jaspResults[[dep]][["normalEffectsPlot"]]) || !options[["normalEffectsPlot"]]) { return() } - plot <- createJaspPlot(title = gettext("Normal Plot of Standardized Effects"), width = 600, height = 600) - plot$dependOn(options = c("normalEffectsPlot", "tableAlias", .doeAnalysisBaseDependencies())) - plot$position <- 11 - jaspResults[[dep]][["normalEffectsPlot"]] <- plot if (!ready || is.null(jaspResults[[dep]][["doeResult"]]) || jaspResults[[dep]]$getError()) { return() } result <- if (options[["codeFactors"]]) jaspResults[[dep]][["doeResultCoded"]]$object[["regression"]] else jaspResults[[dep]][["doeResult"]]$object[["regression"]] fac <- if (options[["tableAlias"]]) result[["coefficients"]][["termsAliased"]][-1] else result[["coefficients"]][["terms"]][-1] - coefDf <- data.frame(result[["objectSummary"]]$coefficients) - tDf <- data.frame("tValue" = coefDf[["t.value"]], - "terms" = result[["coefficients"]][["terms"]], + coefTerms <- result[["coefficients"]][["terms"]] + metricValues <- result[["coefficients"]][["effects"]] + df <- result[["objectSummary"]]$df[2] + pse <- NA_real_ + if (!is.na(df) && df > 0) { + metricValues <- result[["objectSummary"]]$coefficients[, "t value"] + } else { + effectAbs <- abs(metricValues) + effectAbs <- effectAbs[is.finite(effectAbs)] + if (length(effectAbs) > 0) { + s0 <- 1.5 * stats::median(effectAbs) + s1 <- effectAbs[effectAbs < 2.5 * s0] + if (length(s1) > 0) { + pse <- 1.5 * stats::median(s1) + } + } + } + tDf <- data.frame("metric" = metricValues, + "terms" = coefTerms, "pValue" = result[["coefficients"]][["p"]]) # Do not include intercept, covariates and blocks in normal effects plot @@ -1707,26 +1756,61 @@ get_levels <- function(var, num_levels, dataset) { tDf$fac <- fac # median rank order function - x <- tDf$tValue[order(tDf$tValue)] - n <- length(x) - i <- rank(x) - p <- (i - 0.3) / (n + 0.4) - tDf$percentile <- p[order(tDf$tValue)] + orderIdx <- order(tDf$metric) + n <- length(orderIdx) + p <- (seq_len(n) - 0.3) / (n + 0.4) + tDf$percentile <- NA_real_ + tDf$percentile[orderIdx] <- p # statistical significance - tDf$significant <- ifelse(tDf$pValue < 0.05, "S", "N") + if (!is.na(df) && df > 0) { + tDf$significant <- ifelse(!is.na(tDf$pValue) & tDf$pValue < 0.05, "S", "N") + } else if (!is.na(pse) && pse > 0) { + dfLenth <- max(1, floor(nrow(tDf) / 3)) + crit <- stats::qt(0.975, dfLenth) * pse + tDf$significant <- ifelse(abs(tDf$metric) > crit, "S", "N") + } else { + tDf$significant <- "N" + } tDf$labelYPos <- stats::pnorm(stats::qnorm(tDf$percentile) + 0.2) # offset the label by a small amount (0.2) so it is displayed above the point yLabels <- c(0.1, 1, 5, seq(10, 90, 10), 95, 99, 99.9) yBreaks <- yLabels/100 - xBreaks <- jaspGraphs::getPrettyAxisBreaks(c(tDf$tValue, -3, 3)) - xLimits <- range(c(tDf$tValue, xBreaks)) + yLimits <- range(yBreaks) + lineSpan <- if (!is.na(df) && df > 0) { + stats::qnorm(yLimits) + } else if (!is.na(pse) && pse > 0) { + stats::qnorm(yLimits, mean = 0, sd = pse) + } else { + stats::qnorm(yLimits) + } + xLimits <- range(c(tDf$metric, lineSpan)) + xBreaks <- jaspGraphs::getPrettyAxisBreaks(xLimits) + xLimits <- range(xBreaks) + axisLabel <- if (!is.na(df) && df > 0) gettext("Standardized Effect") else gettext("Effect") + plotTitle <- if (!is.na(df) && df > 0) { + gettext("Normal Plot of Standardized Effects") + } else { + gettext("Normal Plot of Effects") + } + plot <- createJaspPlot(title = plotTitle, width = 600, height = 600) + plot$dependOn(options = c("normalEffectsPlot", "tableAlias", .doeAnalysisBaseDependencies())) + plot$position <- 11 + jaspResults[[dep]][["normalEffectsPlot"]] <- plot # Create the ggplot with probit transformation - p <- ggplot2::ggplot(data = tDf, mapping = ggplot2::aes(x = tValue, y = percentile)) + - ggplot2::stat_function(fun = pnorm, linewidth = 1) + # Reference line using the pnorm function + lineFn <- if (!is.na(df) && df > 0) { + function(x) stats::pnorm(x) + } else if (!is.na(pse) && pse > 0) { + function(x) stats::pnorm(x, mean = 0, sd = pse) + } else { + function(x) stats::pnorm(x) + } + + p <- ggplot2::ggplot(data = tDf, mapping = ggplot2::aes(x = metric, y = percentile)) + + ggplot2::stat_function(fun = lineFn, linewidth = 1) + jaspGraphs::geom_point(mapping = ggplot2::aes(fill = significant), size = 4) + - ggplot2::scale_y_continuous(trans = 'probit', labels = yLabels, breaks = yBreaks, name = "Percent", limits = c(0.0001, 0.9999)) + - ggplot2::scale_x_continuous(name = "Standardized Effect", breaks = xBreaks, limits = xLimits) + + ggplot2::scale_y_continuous(trans = 'probit', labels = yLabels, breaks = yBreaks, name = "Percent", limits = yLimits) + + ggplot2::scale_x_continuous(name = axisLabel, breaks = xBreaks, limits = xLimits) + ggplot2::scale_fill_manual(values = c("S" = "darkred", "N" = "grey"), name = NULL, labels = c(gettext("Significant"), gettext("Not Significant")), breaks = c("S", "N")) + ggplot2::geom_label(mapping = ggplot2::aes(label = fac, y = labelYPos), size = 4) + jaspGraphs::themeJaspRaw() + diff --git a/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.svg b/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.svg index 6681f6131..7225e4fdc 100644 --- a/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.svg +++ b/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.svg @@ -1,5 +1,6 @@ - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - -t = 2.12 - - - + + + + + + + + + + + + + + + + + + + + + +t = 2.12 + + + + +C +BE +AD +AC +CD +AE +D +AB +BD +BC +A +DE +CE +B +E + + + + + + + + + + + + + + + + + + + + + + + + +0.0 +0.5 +1.0 +1.5 +2.0 +2.5 +3.0 +3.5 +Standardized Effect +Term - - -C -BE -AD -AC -CD -AE -D -AB -BD -BC -A -DE -CE -B -E - - - - - - - - - - - - - - - - - - - - - - - - -0.0 -0.5 -1.0 -1.5 -2.0 -2.5 -3.0 -3.5 -Standardized Effect -Term -pareto-chart-of-standardized-effects27 diff --git a/tests/testthat/_snaps/doeAnalysis/reference_plotobject/pareto-chart-of-standardized-effects27.rds b/tests/testthat/_snaps/doeAnalysis/reference_plotobject/pareto-chart-of-standardized-effects27.rds index 4799b4ac9447839c3ae4c1d5779795ca2247f143..080199297563d7086cd9c9853e81374b34035ea5 100644 GIT binary patch literal 1381 zcmV-r1)BOFiwFP!000002IW{=Y#T)s9k0EPIWZ4{2=jx5E23*-r|SP@CFq`Aqo#6 z8fJFyjAyqSCygP6veEkNo#&l%@7z0+BWZ+C93^B4#bxq|ZbxAc@h%& ziJ=7Qq~)eo!8P*H=U1Y$I@lq#ioP>t}pvtuf?-F_ZkP^9uZz`k<$v0v*;G`TTQGzQ%}xz8>3ifj<}>-@iwn z_tzRx$Q@MRNKFCu0d4@i9B?b(0N^0t4#1s&!+^U0M*uV29RB>jUgte(`~-cTQM&*y z@%26L91>nHfMf#|NfI9$p0uBT20vrL%_{it~%%4yB4aQ9r{dV1e>p{QE05=0} z1KhsJ*LMi;O2DfCuLisZaJP?q{#S39Hb+wDD#gUdv@cE+m(eMw*3A{_etfCQ+MCl z{qZl#*?UIO)@}Ex=%w$9BY!5<*!cR%+|f5w>B+YkbAlAehY`#WC6TWqmHE>y>D>QIvgJ2HmtXi`fb{3(zKsxTPyf=Jc z$s1aY9avalx}Z5)rdTEYk(WNaqe~L`xiSVri9O^QL(AU}i7*ySOwuBX&POpJKZt|z z2pMYz@PNgV%Ui6aNdgu~)bwN6pCBI6l$IqH(MrhaXhBZAiVNpKjo39=&}wDcJIu!t zgsEuZ(QiL^{KXJq9c>cU+K1DwZaTP{$F|cpkNqJYdtj8PW&6Aaio#9g*|P3nbdJBB zr=LdCo^l3m8W_#&8RhNf{lswYd?0@ml!bM*TBl&%4WR+&mK>m!JM>4ngRGe)14sHs zvZz&bgU22r7^aGr=@hj*j`AY8e6(J3m|$o#m~~52e=1|WRCZSCaUEv8P{O%JP;{gG z(cjTf@qn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_uBoD0tI*z_ zQwWimEkvWHprD0Ezy09x7b8~eSl)_lm?`6GhJ)<_wj6)nL}XdCEV+nQ!ef7g#~v6Z zZrMJsp`vILX||#{nA69}U$HTkqCM>l+%zzn-80JD&HJ(M-1$KMC@crowbVKT=G_n( zaIWP5OSwaToI6OWQPy#+Z=_0URnz(Q3heiE$uyjjTEKB$Bvp>qYYr21bq2F;8R}0J ztd%RyNWY#oCGY!&) za?0n3(trYW0y9obyTENUYgheFv3w@WL|IM?(U9?HfktdmRn@XIqs$l~sV{G-gb|hj zyJ%-t)KoG`PA4VjR%)E{pr?<~)1p2Uo4sj8v}_dRStrDc80%V1Z@L)hANPXPD!g-o zh9js<#D%<2>{-eXkwCu!6TqJRZ`0pH>7OJy2u{_w%2GR-Cq)4VIBZE0)-{ z7(2-C1Hnv{m^^qFBX??S|M-FYk+3-3P8tiT!Z&n*vcm*=>|y5awp0V_gmu@fJE-}e zO|b>f8>b4Yj>pL1Ni*tZy~bP^nsr5khS<24-*~XWRLC@%!5soaLpNtJ4-A2uQigu# zOPZlFx9A{ur(%&G`GQxe4E+u@PBrS}UKdT=X^n5W7KC{hsHV?573^pQel>K6QwD>= zDru5}i%x}BCHZRe& Date: Fri, 29 May 2026 17:01:19 +0200 Subject: [PATCH 2/2] Add new unit test --- .../doeAnalysis/histogram-of-residuals.svg | 64 ++++++++++ .../matrix-residual-plot-subplot-1.svg | 65 ++++++++++ .../matrix-residual-plot-subplot-2.svg | 64 ++++++++++ .../matrix-residual-plot-subplot-3.svg | 64 ++++++++++ .../matrix-residual-plot-subplot-4.svg | 62 ++++++++++ .../doeAnalysis/normal-plot-of-effects.svg | 100 ++++++++++++++++ .../normal-probability-plot-of-residuals.svg | 62 ++++++++++ .../doeAnalysis/pareto-chart-of-effects.svg | 65 ++++++++++ ...to-chart-of-standardized-effects27.new.svg | 113 ++++++++++++++++++ .../histogram-of-residuals.rds | Bin 0 -> 997 bytes .../matrix-residual-plot-subplot-1.rds | Bin 0 -> 916 bytes .../matrix-residual-plot-subplot-2.rds | Bin 0 -> 865 bytes .../matrix-residual-plot-subplot-3.rds | Bin 0 -> 997 bytes .../matrix-residual-plot-subplot-4.rds | Bin 0 -> 951 bytes .../normal-plot-of-effects.rds | Bin 0 -> 1876 bytes .../normal-probability-plot-of-residuals.rds | Bin 0 -> 951 bytes .../pareto-chart-of-effects.rds | Bin 0 -> 1122 bytes .../residuals-versus-fitted-values.rds | Bin 0 -> 865 bytes .../residuals-versus-run-order.rds | Bin 0 -> 916 bytes .../residuals-versus-fitted-values.svg | 64 ++++++++++ .../residuals-versus-run-order.svg | 65 ++++++++++ .../doe_realDataExampleSaturated.csv | 5 + tests/testthat/test-doeAnalysis.R | 100 ++++++++++++++++ 23 files changed, 893 insertions(+) create mode 100644 tests/testthat/_snaps/doeAnalysis/histogram-of-residuals.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-1.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-2.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-3.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-4.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/normal-plot-of-effects.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/normal-probability-plot-of-residuals.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/pareto-chart-of-effects.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.new.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/histogram-of-residuals.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/matrix-residual-plot-subplot-1.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/matrix-residual-plot-subplot-2.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/matrix-residual-plot-subplot-3.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/matrix-residual-plot-subplot-4.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/normal-plot-of-effects.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/normal-probability-plot-of-residuals.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/pareto-chart-of-effects.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/residuals-versus-fitted-values.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/reference_plotobject/residuals-versus-run-order.rds create mode 100644 tests/testthat/_snaps/doeAnalysis/residuals-versus-fitted-values.svg create mode 100644 tests/testthat/_snaps/doeAnalysis/residuals-versus-run-order.svg create mode 100644 tests/testthat/datasets/doeAnalysis/doe_realDataExampleSaturated.csv diff --git a/tests/testthat/_snaps/doeAnalysis/histogram-of-residuals.svg b/tests/testthat/_snaps/doeAnalysis/histogram-of-residuals.svg new file mode 100644 index 000000000..aaea3da7e --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/histogram-of-residuals.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +1 +2 +3 +4 + + + + + + + + + + + + +-1 +-0.8 +-0.6 +-0.4 +-0.2 +0 +Counts +histogram-of-residuals + + diff --git a/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-1.svg b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-1.svg new file mode 100644 index 000000000..b160af190 --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-1.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-1 +0 + + + + + + + + + + +1.0 +1.5 +2.0 +2.5 +3.0 +3.5 +4.0 +Run order +Residuals +matrix-residual-plot-subplot-1 + + diff --git a/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-2.svg b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-2.svg new file mode 100644 index 000000000..5fbf57ecf --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-2.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-1 +0 + + + + + + + + + + +4 +6 +8 +10 +12 +14 +16 +Fitted values +Residuals +matrix-residual-plot-subplot-2 + + diff --git a/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-3.svg b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-3.svg new file mode 100644 index 000000000..ee87deece --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-3.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +1 +2 +3 +4 + + + + + + + + + + + + +-1 +-0.8 +-0.6 +-0.4 +-0.2 +0 +Counts +matrix-residual-plot-subplot-3 + + diff --git a/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-4.svg b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-4.svg new file mode 100644 index 000000000..cdf0f1688 --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/matrix-residual-plot-subplot-4.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.10 +-0.05 +0.00 +0.05 +0.10 + + + + + + + + + +-1 +0 +1 +Theoretical quantiles +Observed quantiles +matrix-residual-plot-subplot-4 + + diff --git a/tests/testthat/_snaps/doeAnalysis/normal-plot-of-effects.svg b/tests/testthat/_snaps/doeAnalysis/normal-plot-of-effects.svg new file mode 100644 index 000000000..253f07b3b --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/normal-plot-of-effects.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +A + +B + +AB + + + + + + +0.1 +1 +5 +10 +20 +30 +40 +50 +60 +70 +80 +90 +95 +99 +99.9 + + + + + + + + + + + + + + + + + + + + + + + +-30 +-20 +-10 +0 +10 +20 +30 +Effect +Percent + + + + +Not Significant +normal-plot-of-effects + + diff --git a/tests/testthat/_snaps/doeAnalysis/normal-probability-plot-of-residuals.svg b/tests/testthat/_snaps/doeAnalysis/normal-probability-plot-of-residuals.svg new file mode 100644 index 000000000..7eb62ff7e --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/normal-probability-plot-of-residuals.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.10 +-0.05 +0.00 +0.05 +0.10 + + + + + + + + + +-1 +0 +1 +Theoretical quantiles +Observed quantiles +normal-probability-plot-of-residuals + + diff --git a/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-effects.svg b/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-effects.svg new file mode 100644 index 000000000..c7cafd7ec --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-effects.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +ME = 85.77 + + + + +A +AB +B + + + + + + + + + + +0 +20 +40 +60 +80 +100 +Effect +Term +pareto-chart-of-effects + + diff --git a/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.new.svg b/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.new.svg new file mode 100644 index 000000000..7225e4fdc --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/pareto-chart-of-standardized-effects27.new.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +t = 2.12 + + + + +C +BE +AD +AC +CD +AE +D +AB +BD +BC +A +DE +CE +B +E + + + + + + + + + + + + + + + + + + + + + + + + +0.0 +0.5 +1.0 +1.5 +2.0 +2.5 +3.0 +3.5 +Standardized Effect +Term + + + diff --git a/tests/testthat/_snaps/doeAnalysis/reference_plotobject/histogram-of-residuals.rds b/tests/testthat/_snaps/doeAnalysis/reference_plotobject/histogram-of-residuals.rds new file mode 100644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*#?O&H4gSzSc#pYh?S{XMk~AXJRw?{&N0LCI3?#P04|p{QtU4 zjrYMBX&~P>E@i5EDhrZwYU?F4&F5KJl1jMt%G$F(!zhl^aD-D%GKwR6k{sZG@S}w| zk5s#syfH1g*)$G!*v7c~s-xcMxIXFV`%CZi_zNID8|@wLkIzl>>nfX%5lXKTv;3vq)=tzoRwdg65eEAKgt z^7)K#8q}9CE|jS+4G+ZB*9Ywzqv}^-*C$_vv#4rvV;Upi&Ca=OOTAqH~a=OBfw=65dZ*Ki@~x0 literal 0 HcmV?d00001 diff --git a/tests/testthat/_snaps/doeAnalysis/reference_plotobject/matrix-residual-plot-subplot-2.rds b/tests/testthat/_snaps/doeAnalysis/reference_plotobject/matrix-residual-plot-subplot-2.rds new file mode 100644 index 0000000000000000000000000000000000000000..b77da5501af2f5b708f4bfec2bcf2c01d207b7d0 GIT binary patch literal 865 zcmV-n1D^aJiwFP!000002IZFBZqqOnfZa4{*N**2LxM|QfN5MHaR*bi@uO**HW1^g z@)EbTmfBI`XbD$)GhT&9;0ZSD*e8jjWSy9}KvYU?A0Hp*eCPN$7h{A_AGw}``kw3} z@5|@Imv0bqcGSSM^5;78uZLVTQgViuB$1tMJ&A7Rvr||?ebo--qb&Ds^!#>hu{)1R zE)8!g*^ghwg1teH$-j+4pr6}@kwJiy1qo!YF!S~&n6b2auRx)kF81l&8O0$ugu`fo z!M4vsp2jdWk9iuI!CFWe5qU(+c%;VHG!P5WKHWb)I5LBAPMILFPa@IqZxr+EU4U5g z)28f)I7u2VjRP$3?ktvTHI{<+*gUS{U4P7K7ffD;*uQ${z+S84_K?1gtqZa3YPGx0 zT}PCM#UQf$ic*Fbiae%tdKO|RM0ccGI zeZotuNEGs+Vl?-%$KN;UqfclG!6;aBE+krE}BDSEgCHc8GG&!AWtQ?FOQT2{w%u5xLht2;fgyz=yGm!BR6XI|pWYdG^JPB*Us%$oq^Y(*@ui2XH2 rt>!e^RdT>`93s2TXE5r{4d zUcWke{0t#~R|=~2#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#k*3t($+=Mw@DFtH^L?u0RKVRpKm@`-AOf6Ba702s#6>)2sChcuGr)ed zAK;MmV$RWM9FH@gtu&iAOQxMa2V&(Uf)Khn-)WKtB!M`*Jd96BeJ|%DoY%Iz?+<8% z;ijI;N3`D$Nn=c-#+XK$v6qkeyEiq`Xw&+b%>b-?KQ=sPM}*O!emXPGOtldFAxy5C zw5Mg|R$002NSyfgp+ literal 0 HcmV?d00001 diff --git a/tests/testthat/_snaps/doeAnalysis/reference_plotobject/normal-plot-of-effects.rds b/tests/testthat/_snaps/doeAnalysis/reference_plotobject/normal-plot-of-effects.rds new file mode 100644 index 0000000000000000000000000000000000000000..b35fb03bf3d07844868eec00a500b35ff9767a44 GIT binary patch literal 1876 zcmV-a2dnrWiwFP!000002JKo~Y!p=(p558q-nLLAplL|FauKB#5aed()JhGCrJ+_K zM9Z+9?T*aOEIYGyS23V3KAPx*Q9?+(^cm6MVu6KA_)ex3L1$Bp4s`% z?96nxEg%8oOfvn?fByg6zW@8rIqh^)Bgb((7mG(ZK2D2Vy#I;rMJqTiI@4Al=@X06 z9}zCbHQ4p4n3Z%|XmO0(Mf%!~G1{3e>*;IvEbXR0!uQ5{IVWxs3+6UOOl=R9PzjY# z2^EjRantOL(j0Sk%}|Cil(i*?d=a3BGL)gLEx9mXLK(`-$(I(c@{4O^aaafoVc|L# zaEMtQPKH_!rpu4D<}>>_X02ITeyr7R+Rt0oYWS^!-%9wcgx?DIt$^PH@LLYQWw-kO$;I{;Ri{aM}zjpZD2iXR{dttu^?H8im-SArgzj^SR3%|SIcPISr zfZuKKyA}0wptr*R7WmCVKQrOi0>30=J^XmbZeDQe&9l%?IFiF7Ko?*a;7`z=pg)5C z3C1HBpI|-&^COrq!Tbr3$49|ArR@QZ+N1pFi5BLP1N_)5TE0zMP)n}F{G{3pl<(!nC) zI>ypOCz)7FEnBeSh|e}DhhqfcA0 zee2GRoPN*ZPj$S0X8LKyJ1hF){4YySzFc{@J{+`R8vpf1&+89^GZ0rv2$XN%Iu?IZ4}_Kh8H#&~_)=KQw=! z{>h!4=6BRjdUdb)HMJjm=MD1J?d)j8cwW z8XIhVSROPo%)7UXAVb`BPOJ4_0y?wayrG*vZ7R@ zmXA4cJtMj#i|O+7tent|ytZAcMX=~4&d(>_spr`YC#DdiQIJB@oStevE!-7Tj2kBd z-3@1CLz+Ng5gK#aj%T66QWJVmI{3sGZeDUu#vJc7Bb}`95DL-Ghul8cWho#hpF8ZI zqdp+H$s=<)k()39TO9vumSAK33uo=y^Syau^p$7!j1b|db6y1!Y-Y6ti;L=zB2~?{ zL|V+sN~ucj)u%PpNQ)_{YA$A;E$9YQ6mgrxnl;)RenygqGR!>bkx-`=28X19qF-fm z@}<2u)8o&1=J0PPdV+HjJ+iw(1NX>5nwIk>GQ~WJ1pcZL2{I^BVT3QDiK{$;tKjDc z2s51;I8prDNtA))^-ew_Y1!_AnlfZf4cht)(Wqf->D6@Eu3tAOsfKKnJYz-1-c$Y#QNYQzAr`#O#@$i)1RjxwJvsFl+i_^M)CKFgeoikz*|84F@; zh$7_1f+E6#mIDGT2eM)=C#yp&45FkDxn?sHbD2rLA1d}bbWcln>w1!49y;UYlAUbZTqyh zum2yY(`-;T(o;(6##VDRJiX}uH#&E9+GtHy OBm4tMAxyv{EdT%}t*asc literal 0 HcmV?d00001 diff --git a/tests/testthat/_snaps/doeAnalysis/reference_plotobject/normal-probability-plot-of-residuals.rds b/tests/testthat/_snaps/doeAnalysis/reference_plotobject/normal-probability-plot-of-residuals.rds new file mode 100644 index 0000000000000000000000000000000000000000..2cfd1d53f0cf4666029082fc69f456d3a06fc9b2 GIT binary patch literal 951 zcmV;o14#TIiwFP!000002IW>UPuwsRc5+F$I|@Z&=+wDOi`t=5yA;p~s#XXPv?`q< zlk*)GxgLXjE>X=l! zPCYGMD^f7CBxY&=D%WPQ&slp}xt`V5c5SJj(Sn`H|0(A|Cj0e`_4>!!*|#U(pE{3E zSD}@9utT?g+NtQ?ekz;+4Z~^2L1Vj{9pU<5I2k>KzL&8yJ|?pcg?%M=#h%FUD!mI4 z-b_pnRm8O9Y;^{(tYnL&v%-UARWg)z%7Iax)eNwjozal=Zb$OQVxpm00jL8cBfT3q zwk+*7fTUWt-;#K=#g{kq5B3>m@A@QSloiI<(r%nlM&rmBx2J7vxvFJ&sBR4nGs}Rf z3EhHyor1J-rLCkRR2Q~uTj30Oo;9L8H^@Jcxk!0#gp-6uLjaSPe?P$-Ot=N+#bi)5 zL7KQO2wdOeEZL2D@xCXxm-N6HZjrStT__5@ zo%#k*3t($+=Mw@DFtH^L?u0RKVRpKm@`-AOf6Ba702s#6>)2sChcuGr)ed zAK;MmV$RWM9FH@gtu&iAOQxMa2V&(Uf)Khn-)WKtB!M`*Jd96BeJ|%DoY%Iz?+<8% z;ijI;N3`D$Nn=c-#+XK$v6qkeyEiq`Xw&+b%>b-?KQ=sPM}*O!emXPGOtldFAxy5C zw5Mg|R$002NSyfgp+ literal 0 HcmV?d00001 diff --git a/tests/testthat/_snaps/doeAnalysis/reference_plotobject/pareto-chart-of-effects.rds b/tests/testthat/_snaps/doeAnalysis/reference_plotobject/pareto-chart-of-effects.rds new file mode 100644 index 0000000000000000000000000000000000000000..1f4ee82d5ae0a1b8356823d4f05598b857f726ba GIT binary patch literal 1122 zcmV-o1fBaIiwFP!000002HjWBZre5(r)0@alr#yJ0tE&PD6sQ_4MWlPP}FS@Zv(Ql zXjZH{8H_|*Y-LH6sKwf;kFoVF_5^!@4cH@e_ZqmOO@;O;X)Gfo_k_pfSAp;f>quHyW*=5axi9+#RO-=?^a1xwQ@_rGHl%1^?JO z8UuGl2Rm2wuY}&pt@SvcbQGkC-+yN57dyA7Fcfx&8`c#5`m{;I-VZFj9B%Pk)&Iuj zyMJ@LLvPX~SwGwscHa~E`=cPUqFm^5k6uXi$Fv(*mgnpPMSyc$ho8Tl7<*iAA z^BhHENC_r-PK&I{g|Ly}6p=bdk`GKi#}SET>xcJFj*g|E*En-I-h2kNGEQZKS}JR; zLCqSNyxA!C}9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ccGI zeZotuNEGs+Vl?-%$KN;UqfclG!6;aBE+krE}BDSEgCHc8GG&!AWtQ?FOQT2{w%u5xLht2;fgyz=yGm!BR6XI|pWYdG^JPB*Us%$oq^Y(*@ui2XH2 rt>!e^RdTqjz*(2-;*zCk7vAqNe6&KT1DYcJ%>>U5{_t*IlA=E=&-$lK?$fEw| zPX{mGBIG`ohDycHbH$&7JT#Ey5uTGwWVWhGbR!<==!wo`DxGA{-nIDCAJxW#jxHDu zE|)b_pXkruQ(6A~XJvGy;J2gfuJj&$`dFOTw`Ht8cU1?w>nhzc-`z4s>nA^m^Gn4r z08p4EGpr0hh*`Wym9;TpG)YJ}#^TEr}gINRBVCJvL%s^Br zaRoT8+ErbEqb6eejB*-BTK$c=)z>(XR_DM+ zYVp&K2HWYpYShZrn~I=oJR(Ton5dwXy*9^5LZc~=5!=={!Ga9zUK_G86g5HGkTwC* zNi5|0pHe%efu!`Ft*#?O&H4gSzSc#pYh?S{XMk~AXJRw?{&N0LCI3?#P04|p{QtU4 zjrYMBX&~P>E@i5EDhrZwYU?F4&F5KJl1jMt%G$F(!zhl^aD-D%GKwR6k{sZG@S}w| zk5s#syfH1g*)$G!*v7c~s-xcMxIXFV`%CZi_zNID8|@wLkIzl>>nfX%5lXKTv;3vq)=tzoRwdg65eEAKgt z^7)K#8q}9CE|jS+4G+ZB*9Ywzqv}^-*C$_vv#4rvV;Upi&Ca=OOTAqH~a=OBfw=65dZ*Ki@~x0 literal 0 HcmV?d00001 diff --git a/tests/testthat/_snaps/doeAnalysis/residuals-versus-fitted-values.svg b/tests/testthat/_snaps/doeAnalysis/residuals-versus-fitted-values.svg new file mode 100644 index 000000000..5c4e3dd74 --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/residuals-versus-fitted-values.svg @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-1 +0 + + + + + + + + + + +4 +6 +8 +10 +12 +14 +16 +Fitted values +Residuals +residuals-versus-fitted-values + + diff --git a/tests/testthat/_snaps/doeAnalysis/residuals-versus-run-order.svg b/tests/testthat/_snaps/doeAnalysis/residuals-versus-run-order.svg new file mode 100644 index 000000000..79c2d0100 --- /dev/null +++ b/tests/testthat/_snaps/doeAnalysis/residuals-versus-run-order.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +-1 +0 + + + + + + + + + + +1.0 +1.5 +2.0 +2.5 +3.0 +3.5 +4.0 +Run order +Residuals +residuals-versus-run-order + + diff --git a/tests/testthat/datasets/doeAnalysis/doe_realDataExampleSaturated.csv b/tests/testthat/datasets/doeAnalysis/doe_realDataExampleSaturated.csv new file mode 100644 index 000000000..d07aad12a --- /dev/null +++ b/tests/testthat/datasets/doeAnalysis/doe_realDataExampleSaturated.csv @@ -0,0 +1,5 @@ +RunOrder,StandardOrder,Fac1,Fac2,Response +1,2,65,75,16 +2,3,40,100,6 +3,1,40,75,8 +4,4,65,100,5 diff --git a/tests/testthat/test-doeAnalysis.R b/tests/testthat/test-doeAnalysis.R index a520082ed..48153bfee 100644 --- a/tests/testthat/test-doeAnalysis.R +++ b/tests/testthat/test-doeAnalysis.R @@ -5159,3 +5159,103 @@ test_that("53.4 Response Optimizer Response Surface Change All Options - Respons options("jaspRoundToPrecision" = NULL) # reset default + +## Factorial Design Saturated #### +options <- analysisOptions("doeAnalysis") +options$dependentFactorial <- "Response" +options$continuousFactorsFactorial <- c("Fac1", "Fac2") +options$codeFactors <- TRUE +options$codeFactorsMethod <- "automatic" +options$tableEquation <- TRUE +options$tableAlias <- TRUE +options$highestOrder <- FALSE +options$histogramBinWidthType <- "doane" +options$plotNorm <- TRUE +options$plotHist <- TRUE +options$plotFitted <- TRUE +options$plotRunOrder <- TRUE +options$fourInOneResidualPlot <- TRUE +options$normalEffectsPlot <- TRUE +options$plotPareto <- TRUE +options$modelTerms <- list( + list(components = "Fac1"), + list(components = "Fac2"), + list(components = c("Fac1", "Fac2")) +) +set.seed(123) +results <- runAnalysis("doeAnalysis", "datasets/doeAnalysis/doe_realDataExampleSaturated.csv", options) + +test_that("54.1 Factorial Design Saturated - Matrix residual plot matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_fourInOneResidualPlot"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "matrix-residual-plot") +}) + +test_that("54.2 Factorial Design Saturated - Normal Plot of Effects matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_normalEffectsPlot"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "normal-plot-of-effects") +}) + +test_that("54.3 Factorial Design Saturated - Residuals versus Fitted Values plot matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_plotFitted"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "residuals-versus-fitted-values") +}) + +test_that("54.4 Factorial Design Saturated - Histogram of Residuals plot matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_plotHist"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "histogram-of-residuals") +}) + +test_that("54.5 Factorial Design Saturated - Normal Probability Plot of Residuals matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_plotNorm"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "normal-probability-plot-of-residuals") +}) + +test_that("54.6 Factorial Design Saturated - Pareto Chart of Effects plot matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_plotPareto"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "pareto-chart-of-effects") +}) + +test_that("54.7 Factorial Design Saturated - Residuals versus Run Order plot matches", { + plotName <- results[["results"]][["Response"]][["collection"]][["Response_plotRunOrder"]][["data"]] + testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]] + jaspTools::expect_equal_plots(testPlot, "residuals-versus-run-order") +}) + +test_that("54.8 Factorial Design Saturated - ANOVA table results match", { + table <- results[["results"]][["Response"]][["collection"]][["Response_tableAnova"]][["data"]] + jaspTools::expect_equal_tables(table, + list(24.9166666666667, 74.75, 3, "", "", "Model", "", 54.5, 2, "", + "", " Linear terms", 12.25, 12.25, 1, "", "", " Fac1", + 42.25, 42.25, 1, "", "", " Fac2", "", 20.25, + 1, "", "", " Interaction terms", 20.25, 20.25, 1, "", + "", " Fac1Fac2", + 0, 0, 0, "", "", "Error", "", 74.75, 3, "", "", "Total")) +}) + +test_that("54.9 Factorial Design Saturated - Coded Coefficients table results match", { + table <- results[["results"]][["Response"]][["collection"]][["Response_tableCoefficients"]][["data"]] + jaspTools::expect_equal_tables(table, + list("(Intercept)", 8.75, "", "", "", "(Intercept)", "", "", "A", 1.75, + 3.5, "", "", "Fac1", "", "NaN", "B", -3.25, -6.5, "", "", "Fac2", + "", "NaN", "AB", -2.25, -4.5, "", "", "Fac1Fac2", "", + "NaN")) +}) + +test_that("54.10 Factorial Design Saturated - Regression equation in Coded Units table results match", { + table <- results[["results"]][["Response"]][["collection"]][["Response_tableEquation"]][["data"]] + jaspTools::expect_equal_tables(table, + list("Response = 8.75 + 1.75 A 3.25 B 2.25 AB" + )) +}) + +test_that("54.11 Factorial Design Saturated - Model Summary table results match", { + table <- results[["results"]][["Response"]][["collection"]][["Response_tableSummary"]][["data"]] + jaspTools::expect_equal_tables(table, + list("", "", 1, "")) +})