diff --git a/NEWS.md b/NEWS.md
index 6e707bfb..c5435b3d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -16,7 +16,13 @@
# jaspProcess (development version)
+## Added
+* Residual plots for each model (`Residuals vs. predicted` and `Q-Q plot standardized residuals`), shown for every dependent variable (the outcome and each mediator), to check the homoscedasticity and normality assumptions of the regression equations. Available in the classical and Bayesian analysis, per model or for all models at once. As in the other JASP analyses, the Q-Q plot can show a confidence band (classical) or the credible interval of each residual (Bayesian).
+* `Set seed` option (Options > Repeatability) in the classical analysis, so bootstrapped standard errors and confidence intervals, and bootstrapped local tests, can be reproduced.
+
## Fixed
+* Changing the number of bootstrap replications in the classical analysis now refits the models; before, the results of the previous number of replications were kept.
+* Requesting output for a single model (e.g., a plot or a parameter estimates table) no longer recomputes the model summary and R² tables. In the Bayesian analysis, this avoids recomputing WAIC and LOO for every model.
* Process models with a categorical predictor no longer error when a factor level label contains a space or other special character (e.g. "emotion regulation"). Such labels are now coerced to syntactically valid names before being used in mean-centering and lavaan model syntax ([Issue #3597](https://github.com/jasp-stats/jasp-issues/issues/3597)).
---
diff --git a/R/bayesianProcess.R b/R/bayesianProcess.R
index a4633ab3..b4d269bc 100644
--- a/R/bayesianProcess.R
+++ b/R/bayesianProcess.R
@@ -64,6 +64,8 @@ BayesianProcess <- function(jaspResults, dataset = NULL, options) {
.procBayesParameterEstimateTables(parEstContainer, options, modelsContainer)
.procBayesMcmcPlots(jaspResults, options, modelsContainer)
+ # Create residual plots for each dependent variable of each model if requested
+ .procResidualPlots(jaspResults, options, modelsContainer)
# Create html output with lavaan syntax for each model
.procPlotSyntax(jaspResults, options, modelsContainer)
@@ -216,7 +218,10 @@ BayesianProcess <- function(jaspResults, dataset = NULL, options) {
tableRowIsValid <- modelNumberIsValid & resultIsValid
summaryTable <- createJaspTable(title = gettext("Model summary"), rowNames = modelNames[tableRowIsValid])
- summaryTable$dependOn(c(.procGetDependencies(), "processModels", "bicWeights", "hayesNumber"))
+ summaryTable$dependOn(
+ options = c(.procGetDependencies(), "bicWeights", "hayesNumber"),
+ nestedOptions = .procGetAllModelsDependencies(options)
+ )
summaryTable$position <- 1
ovtWaic <- gettext("WAIC")
@@ -671,6 +676,58 @@ BayesianProcess <- function(jaspResults, dataset = NULL, options) {
}
}
+.procBayesStandardizedResiduals <- function(fittedModel, dep, ciLevel = NULL) {
+ parTbl <- lavaan::parameterTable(fittedModel)
+ # Only extract the draws of the model parameters: the Stan output also contains, e.g., the log-likelihood of each observation
+ draws <- as.matrix(fittedModel@external$mcmcout, pars = unique(sub("\\[.*$", "", na.omit(parTbl$pxnames))))
+
+ return(.procBayesStandardizedResidualsFromDraws(parTbl, lavaan::lavInspect(fittedModel, "data"), draws, dep, ciLevel))
+}
+
+.procBayesStandardizedResidualsFromDraws <- function(parTbl, data, draws, dep, ciLevel = NULL, blockSize = 1000) {
+ # Posterior mean (and central credible interval) of the standardized residual of each observation in the regression
+ # equation of dep: for each draw, the observed minus the predicted value, divided by the residual standard deviation
+ parDraws <- function(rows) {
+ # Draws x parameters; fixed parameters have the same value in every draw
+ matrix(vapply(rows, function(r) {
+ if (is.na(parTbl$pxnames[r])) rep(parTbl$est[r], nrow(draws)) else draws[, parTbl$pxnames[r]]
+ }, numeric(nrow(draws))), nrow = nrow(draws))
+ }
+
+ regRows <- which(parTbl$lhs == dep & parTbl$op == "~")
+ preds <- data[, parTbl$rhs[regRows], drop = FALSE]
+ beta <- parDraws(regRows)
+ intRow <- which(parTbl$lhs == dep & parTbl$op == "~1")
+
+ # Without a mean structure the intercepts are implied by the sample means (as in .procResiduals)
+ if (length(intRow) == 0)
+ intercept <- mean(data[, dep], na.rm = TRUE) - drop(beta %*% colMeans(preds, na.rm = TRUE))
+ else
+ intercept <- drop(parDraws(intRow))
+
+ residualSd <- sqrt(drop(parDraws(which(parTbl$lhs == dep & parTbl$op == "~~" & parTbl$rhs == dep))))
+ complete <- which(stats::complete.cases(data[, dep], preds))
+ probs <- if (!is.null(ciLevel)) c((1 - ciLevel) / 2, (1 + ciLevel) / 2)
+
+ # Observations x draws matrices, in blocks of observations to limit memory use for large data sets
+ blocks <- split(complete, ceiling(seq_along(complete) / blockSize))
+ blockSummaries <- lapply(blocks, function(obs) {
+ predicted <- preds[obs, , drop = FALSE] %*% t(beta) + rep(intercept, each = length(obs))
+ standardized <- (data[obs, dep] - predicted) / rep(residualSd, each = length(obs))
+ blockSummary <- data.frame(mean = rowMeans(standardized))
+
+ if (!is.null(probs)) {
+ bounds <- apply(standardized, 1, stats::quantile, probs = probs, names = FALSE)
+ blockSummary$lower <- bounds[1, ]
+ blockSummary$upper <- bounds[2, ]
+ }
+
+ return(blockSummary)
+ })
+
+ return(do.call(rbind, unname(blockSummaries)))
+}
+
# Footnotes ----
.procBayesBadWaicFootnote <- function() gettext("Warning: WAIC estimate unreliable -- at least one effective parameter estimate (p_waic) larger than 0.4. We recommend using LOO instead.")
diff --git a/R/classicProcess.R b/R/classicProcess.R
index 3d85954b..f2d71a42 100644
--- a/R/classicProcess.R
+++ b/R/classicProcess.R
@@ -70,6 +70,8 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
localTestContainer <- .procContainerLocalTests(jaspResults, options)
# Create tables with local test results
.procLocalTestTables(localTestContainer, dataset, options, modelsContainer)
+ # Create residual plots for each dependent variable of each model if requested
+ .procResidualPlots(jaspResults, options, modelsContainer)
# Create html output with lavaan syntax for each model
.procPlotSyntax(jaspResults, options, modelsContainer)
}
@@ -81,8 +83,8 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
.procGetDependencies <- function() {
return(c(
"dependent", "covariates", "factors", "naAction", "emulation", "estimator",
- "meanCenteredModeration", "standardizedModelEstimates", "errorCalculationMethod", "bootstrapCiType",
- "mcmcBurnin", "mcmcSamples", "mcmcChains", "seed", "setSeed", "nuPriorMu",
+ "meanCenteredModeration", "standardizedModelEstimates", "errorCalculationMethod", "bootstrapSamples",
+ "bootstrapCiType", "mcmcBurnin", "mcmcSamples", "mcmcChains", "seed", "setSeed", "nuPriorMu",
"nuPriorSigma", "betaPriorMu", "betaPriorSigma", "psiPriorAlpha",
"psiPriorBeta", "rhoPriorAlpha", "rhoPriorBeta", "moderationProbes",
"moderationProbeType", "moderationProbesMeanSD"
@@ -138,6 +140,10 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
nestedOptions = .procGetSingleModelsDependencies(as.character(i))[-1] # omit model name
)
modelsContainer[[modelName]] <- container
+ # Tables that combine all models only depend on the options of the models they were created for (see
+ # .procGetAllModelsDependencies), so a model that was added has to be included by recreating them
+ jaspResults[["modelSummaryTable"]] <- NULL
+ jaspResults[["rSquaredTable"]] <- NULL
}
}
@@ -1700,6 +1706,8 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
if (doFit) {
if (options$errorCalculationMethod == "bootstrap") {
+ # Seed per model, so a model's bootstrap does not depend on which other models were (re)fitted in this run
+ jaspBase::.setSeedJASP(options)
fittedModel <- .procBootstrap(fittedModel, options$bootstrapSamples)
}
}
@@ -1724,6 +1732,12 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
))
}
+# Dependencies of output that combines all models: only the options that change a fitted model,
+# so that requesting output for a single model (e.g., a plot) does not update it
+.procGetAllModelsDependencies <- function(options) {
+ return(unlist(lapply(seq_along(options[["processModels"]]), function(i) .procGetSingleModelsDependencies(as.character(i))), recursive = FALSE))
+}
+
.procComputeResults <- function(jaspResults, dataset, options) {
modelsContainer <- jaspResults[["modelsContainer"]]
nModels <- length(options[["processModels"]])
@@ -1887,7 +1901,10 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
tableRowIsValid <- modelNumberIsValid & resultIsValid
summaryTable <- createJaspTable(title = gettext("Model summary"), rowNames = modelNames[tableRowIsValid])
- summaryTable$dependOn(c(.procGetDependencies(), "processModels", "aicWeights", "bicWeights", "naAction", "hayesNumber"))
+ summaryTable$dependOn(
+ options = c(.procGetDependencies(), "aicWeights", "bicWeights", "naAction", "hayesNumber"),
+ nestedOptions = .procGetAllModelsDependencies(options)
+ )
summaryTable$position <- 0
if (options[["naAction"]] == "fiml" && !options[["estimator"]] %in% c("default", "ml")) {
@@ -1968,7 +1985,7 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
if (any(validModel) && is.null(parEstContainer[["warning"]])) {
warningHtml <- createJaspHtml(text = .procCausalAssumptionsMsg())
warningHtml$position <- 0
- warningHtml$dependOn("processModels")
+ warningHtml$dependOn(nestedOptions = .procGetAllModelsDependencies(options))
parEstContainer[["warning"]] <- warningHtml
}
@@ -2607,6 +2624,8 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
graph <- dagitty::dagitty(paste("dag {", paste(arrows, collapse = "\n")," } "))
+ # Bootstrapped local tests (and cis.loess) resample the data
+ jaspBase::.setSeedJASP(options)
localTestResult <- dagitty::localTests(
graph,
dataset,
@@ -2658,7 +2677,10 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
overtitle = "R\u00B2", type = "number")
}
- tabr2$dependOn(c(.procGetDependencies(), "rSquared", "processModels"))
+ tabr2$dependOn(
+ options = c(.procGetDependencies(), "rSquared"),
+ nestedOptions = .procGetAllModelsDependencies(options)
+ )
tabr2$position <- 1
jaspResults[["rSquaredTable"]] <- tabr2
@@ -2756,6 +2778,171 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
procPathPlot$plotObject <- .procLavToGraph(modelContainer, type = "statistical", estimates = options[["statisticalPathPlotsParameterEstimates"]], options)
}
+# Residual plots ----
+.procContainerResidualPlots <- function(jaspResults, options) {
+ if (!is.null(jaspResults[["residualPlotContainer"]]))
+ return(jaspResults[["residualPlotContainer"]])
+
+ residualPlotContainer <- createJaspContainer(gettext("Residual plots"))
+ residualPlotContainer$dependOn(.procGetDependencies())
+
+ jaspResults[["residualPlotContainer"]] <- residualPlotContainer
+
+ return(residualPlotContainer)
+}
+
+.procResidualPlots <- function(jaspResults, options, modelsContainer) {
+ showPlots <- sapply(options[["processModels"]], function(mod) mod[["residualVsFittedPlot"]] || mod[["residualQqPlot"]])
+
+ if (!any(showPlots)) return()
+
+ container <- .procContainerResidualPlots(jaspResults, options)
+
+ for (i in which(showPlots)) {
+ modelName <- options[["processModels"]][[i]][["name"]]
+
+ # Models that cannot be fitted yet (e.g., incomplete Hayes configurations) have no residuals
+ if (!.procCheckFitModel(modelsContainer[[modelName]][["graph"]]$object)) next
+
+ if (is.null(container[[modelName]])) {
+ modelContainer <- createJaspContainer(title = modelName)
+ modelContainer$dependOn(
+ nestedOptions = .procGetSingleModelsDependencies(as.character(i))
+ )
+ container[[modelName]] <- modelContainer
+ } else {
+ modelContainer <- container[[modelName]]
+ }
+
+ fittedModel <- modelsContainer[[modelName]][["fittedModel"]]$object
+ .procSetContainerError(modelContainer, fittedModel)
+
+ if (modelContainer$getError()) next
+
+ residuals <- try(.procResiduals(fittedModel))
+
+ if (jaspBase::isTryError(residuals)) {
+ modelContainer$setError(jaspBase::.extractErrorMessage(residuals))
+ next
+ }
+
+ for (j in seq_along(residuals)) {
+ .procResidualPlotsSingleVariable(modelContainer, options, residuals[[j]], names(residuals)[j], j, i, fittedModel)
+ }
+ }
+}
+
+.procResiduals <- function(fittedModel) {
+ # Residuals of the regression equation of each dependent variable (outcome and mediators):
+ # observed values minus the values predicted by the path coefficients
+ parTbl <- lavaan::parameterTable(fittedModel)
+ data <- lavaan::lavInspect(fittedModel, "data")
+ regs <- parTbl[parTbl$op == "~", ]
+
+ residuals <- lapply(unique(regs$lhs), function(dep) {
+ reg <- regs[regs$lhs == dep, ]
+ preds <- data[, reg$rhs, drop = FALSE]
+ intercept <- parTbl$est[parTbl$lhs == dep & parTbl$op == "~1"]
+
+ # Without a mean structure the intercepts are implied by the sample means
+ if (length(intercept) == 0)
+ intercept <- mean(data[, dep], na.rm = TRUE) - sum(reg$est * colMeans(preds, na.rm = TRUE))
+
+ predicted <- drop(intercept + preds %*% reg$est)
+ residual <- data[, dep] - predicted
+ resVar <- parTbl$est[parTbl$lhs == dep & parTbl$op == "~~" & parTbl$rhs == dep]
+ complete <- !is.na(residual)
+
+ return(data.frame(
+ predicted = predicted[complete],
+ residual = residual[complete],
+ standardized = residual[complete] / sqrt(resVar)
+ ))
+ })
+ names(residuals) <- unique(regs$lhs)
+
+ return(residuals)
+}
+
+.procResidualPlotsSingleVariable <- function(container, options, residuals, varName, varIdx, modelIdx, fittedModel) {
+ varKey <- paste0("variable", varIdx)
+
+ if (is.null(container[[varKey]])) {
+ varContainer <- createJaspContainer(title = decodeColNames(varName))
+ varContainer$position <- varIdx
+ container[[varKey]] <- varContainer
+ } else {
+ varContainer <- container[[varKey]]
+ }
+
+ modelOptions <- options[["processModels"]][[modelIdx]]
+
+ if (modelOptions[["residualVsFittedPlot"]] && is.null(varContainer[["residualVsFittedPlot"]])) {
+ residualPlot <- createJaspPlot(title = gettext("Residuals vs. Predicted"), width = 530, height = 400)
+ residualPlot$dependOn(nestedOptions = list(c("processModels", as.character(modelIdx), "residualVsFittedPlot")))
+ residualPlot$position <- 1
+ varContainer[["residualVsFittedPlot"]] <- residualPlot
+
+ residualPlot$plotObject <- .procResidualVsFittedPlot(residuals)
+ }
+
+ if (modelOptions[["residualQqPlot"]] && is.null(varContainer[["residualQqPlot"]])) {
+ qqPlot <- createJaspPlot(title = gettext("Q-Q Plot Standardized Residuals"), width = 400, height = 400)
+ qqPlot$dependOn(nestedOptions = list(
+ c("processModels", as.character(modelIdx), "residualQqPlot"),
+ c("processModels", as.character(modelIdx), "qqPlotCi"),
+ c("processModels", as.character(modelIdx), "qqPlotCiLevel")
+ ))
+ qqPlot$position <- 2
+ varContainer[["residualQqPlot"]] <- qqPlot
+
+ ciLevel <- if (modelOptions[["qqPlotCi"]]) modelOptions[["qqPlotCiLevel"]] else NULL
+
+ if (inherits(fittedModel, "blavaan")) {
+ # Posterior means of the standardized residuals, with the credible interval of each as an error bar
+ stdResiduals <- try(.procBayesStandardizedResiduals(fittedModel, varName, ciLevel))
+
+ if (jaspBase::isTryError(stdResiduals)) {
+ qqPlot$setError(jaspBase::.extractErrorMessage(stdResiduals))
+ } else {
+ qqPlot$plotObject <- jaspGraphs::plotQQnorm(
+ stdResiduals[["mean"]],
+ lower = stdResiduals[["lower"]],
+ upper = stdResiduals[["upper"]],
+ yName = gettext("Standardized residuals"),
+ ablineColor = "darkred",
+ ablineOrigin = TRUE,
+ identicalAxes = TRUE
+ )
+ }
+ } else {
+ qqPlot$plotObject <- jaspGraphs::plotQQnorm(
+ residuals[["standardized"]],
+ yName = gettext("Standardized residuals"),
+ ablineColor = "darkred",
+ ablineOrigin = TRUE,
+ identicalAxes = TRUE,
+ ciLevel = ciLevel
+ )
+ }
+ }
+}
+
+.procResidualVsFittedPlot <- function(residuals) {
+ xBreaks <- jaspGraphs::getPrettyAxisBreaks(residuals[["predicted"]])
+ yBreaks <- jaspGraphs::getPrettyAxisBreaks(c(residuals[["residual"]], 0))
+
+ plotObj <- ggplot2::ggplot(residuals, ggplot2::aes(x = predicted, y = residual)) +
+ ggplot2::geom_hline(yintercept = 0, colour = "darkred") +
+ jaspGraphs::geom_point() +
+ ggplot2::scale_x_continuous(name = gettext("Predicted Values"), breaks = xBreaks, limits = range(xBreaks)) +
+ ggplot2::scale_y_continuous(name = gettext("Residuals"), breaks = yBreaks, limits = range(yBreaks)) +
+ jaspGraphs::geom_rangeframe() +
+ jaspGraphs::themeJaspRaw()
+
+ return(plotObj)
+}
+
.procMainGraphLayoutPosHelper <- function(nodes) {
# This function positions nodes alternatingly above and below zero with increasing distance
nUniqueNodes <- length(unique(nodes))
diff --git a/inst/help/BayesianProcess.md b/inst/help/BayesianProcess.md
index 1905c98c..23ef8abb 100644
--- a/inst/help/BayesianProcess.md
+++ b/inst/help/BayesianProcess.md
@@ -64,6 +64,10 @@ This section allows users to specify multiple process models through one of two
- Path plots: Displays path plots in the output.
- Conceptual: Shows a conceptual path plot. These plots contain no parameter labels or estimates and simplify moderation effects in the model structure by omitting direct effects and interactions. Instead moderators point to the path they are moderating. These plots can be shown even when the model is not complete yet (when `Input type` is `Model number`) and are easier to understand than the statistical path plots.
- Statistical: Shows a statistical path plot including parameter labels or estimates for all paths.
+- Residual plots: Displays residual plots for each dependent variable in the model (the outcome and each mediator), to check the assumptions of its regression equation. The predicted values are based on the posterior means of the parameters.
+ - Residuals vs. predicted: Scatterplot of the residuals against the predicted values. If the variance of the residuals is constant (homoscedasticity), the residuals scatter evenly around zero across the predicted values.
+ - Q-Q plot standardized residuals: Q-Q plot of the residuals divided by the residual standard deviation. The standardized residuals are computed for each posterior draw, and the points show their posterior means. If the residuals are normally distributed, the points lie close to the diagonal.
+ - Credible interval: Adds the central credible interval of each standardized residual as an error bar.
#### Options
diff --git a/inst/help/ClassicProcess.md b/inst/help/ClassicProcess.md
index df24c125..b46e9e5e 100644
--- a/inst/help/ClassicProcess.md
+++ b/inst/help/ClassicProcess.md
@@ -67,6 +67,10 @@ This section allows users to specify multiple process models through one of two
- Path plots: Displays path plots in the output.
- Conceptual: Shows a conceptual path plot. These plots contain no parameter labels or estimates and simplify moderation effects in the model structure by omitting direct effects and interactions. Instead moderators point to the path they are moderating. These plots can be shown even when the model is not complete yet (when `Input type` is `Model number`) and are easier to understand than the statistical path plots.
- Statistical: Shows a statistical path plot including parameter labels or estimates for all paths.
+- Residual plots: Displays residual plots for each dependent variable in the model (the outcome and each mediator), to check the assumptions of its regression equation.
+ - Residuals vs. predicted: Scatterplot of the residuals against the predicted values. If the variance of the residuals is constant (homoscedasticity), the residuals scatter evenly around zero across the predicted values.
+ - Q-Q plot standardized residuals: Q-Q plot of the residuals divided by their estimated standard deviation. If the residuals are normally distributed, the points lie close to the diagonal.
+ - Confidence interval: Adds a confidence band around the diagonal. The band shows the expected range of the standardized residuals under normality; points outside the band suggest deviations from normality.
- Tests:
- Local tests: Test the local implications of the specified causal model. Conducts (conditional) independence tests for each implication of the model. Significant independence tests indicate that the model does not correctly account for the local implication (*local misfit*) and is misspecified.
- Test type: Type of the local test. For tetrads test types, see Kenny (1979).
diff --git a/inst/qml/BayesianProcess.qml b/inst/qml/BayesianProcess.qml
index b7dfe8e4..4e1dd4f7 100644
--- a/inst/qml/BayesianProcess.qml
+++ b/inst/qml/BayesianProcess.qml
@@ -88,6 +88,15 @@ Form
conceptualPathPlotsChecked: conceptualPathPlotsForAllModels.checked
statisticalPathPlotsChecked: statisticalPathPlotsForAllModels.checked
}
+
+ Common.ResidualPlots
+ {
+ residualVsFittedPlotChecked: residualVsFittedPlotForAllModels.checked
+ residualQqPlotChecked: residualQqPlotForAllModels.checked
+ qqPlotCiChecked: qqPlotCiForAllModels.checked
+ qqPlotCiLevelValue: qqPlotCiLevelForAllModels.value
+ bayesian: true
+ }
}
}
}
@@ -341,6 +350,31 @@ Form
label: qsTr("Statistical")
}
}
+
+ Group
+ {
+ title: qsTr("Residual Plots")
+ CheckBox
+ {
+ id: residualVsFittedPlotForAllModels
+ name: "residualVsFittedPlotForAllModels"
+ label: qsTr("Residuals vs. predicted")
+ }
+ CheckBox
+ {
+ id: residualQqPlotForAllModels
+ name: "residualQqPlotForAllModels"
+ label: qsTr("Q-Q plot standardized residuals")
+
+ CheckBox
+ {
+ id: qqPlotCiForAllModels
+ name: "qqPlotCiForAllModels"
+ label: qsTr("Credible interval")
+ CIField { id: qqPlotCiLevelForAllModels; name: "qqPlotCiLevelForAllModels" }
+ }
+ }
+ }
}
Group
diff --git a/inst/qml/ClassicProcess.qml b/inst/qml/ClassicProcess.qml
index 5c718983..208d5f67 100644
--- a/inst/qml/ClassicProcess.qml
+++ b/inst/qml/ClassicProcess.qml
@@ -140,6 +140,14 @@ Form
conceptualPathPlotsChecked: conceptualPathPlotsForAllModels.checked
statisticalPathPlotsChecked: statisticalPathPlotsForAllModels.checked
}
+
+ Common.ResidualPlots
+ {
+ residualVsFittedPlotChecked: residualVsFittedPlotForAllModels.checked
+ residualQqPlotChecked: residualQqPlotForAllModels.checked
+ qqPlotCiChecked: qqPlotCiForAllModels.checked
+ qqPlotCiLevelValue: qqPlotCiLevelForAllModels.value
+ }
}
}
}
@@ -206,6 +214,7 @@ Form
}
}
}
+ SetSeed {}
}
}
@@ -326,6 +335,32 @@ Form
}
}
+ Group
+ {
+ title: qsTr("Residual Plots")
+ CheckBox
+ {
+ id: residualVsFittedPlotForAllModels
+ name: "residualVsFittedPlotForAllModels"
+ label: qsTr("Residuals vs. predicted")
+ }
+ CheckBox
+ {
+ id: residualQqPlotForAllModels
+ name: "residualQqPlotForAllModels"
+ label: qsTr("Q-Q plot standardized residuals")
+
+ CheckBox
+ {
+ id: qqPlotCiForAllModels
+ name: "qqPlotCiForAllModels"
+ label: qsTr("Confidence interval")
+ childrenOnSameRow: true
+ CIField { id: qqPlotCiLevelForAllModels; name: "qqPlotCiLevelForAllModels" }
+ }
+ }
+ }
+
Group
{
title: qsTr("Tests")
diff --git a/inst/qml/common/ResidualPlots.qml b/inst/qml/common/ResidualPlots.qml
new file mode 100644
index 00000000..96a9628d
--- /dev/null
+++ b/inst/qml/common/ResidualPlots.qml
@@ -0,0 +1,55 @@
+//
+// Copyright (C) 2026 University of Amsterdam
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public
+// License along with this program. If not, see
+// .
+//
+import QtQuick
+import JASP
+import JASP.Controls
+
+Group
+{
+ property bool residualVsFittedPlotChecked: false
+ property bool residualQqPlotChecked: false
+ property bool qqPlotCiChecked: false
+ property real qqPlotCiLevelValue: 95
+ property bool bayesian: false
+
+ title: qsTr("Residual Plots")
+ columns: 1
+ CheckBox
+ {
+ name: "residualVsFittedPlot"
+ label: qsTr("Residuals vs. predicted")
+ checked: residualVsFittedPlotChecked
+ info: qsTr("For each dependent variable (the outcome and each mediator), a scatterplot of the residuals against the predicted values. Under constant residual variance (homoscedasticity), the residuals scatter evenly around zero.")
+ }
+ CheckBox
+ {
+ name: "residualQqPlot"
+ label: qsTr("Q-Q plot standardized residuals")
+ checked: residualQqPlotChecked
+ info: qsTr("For each dependent variable (the outcome and each mediator), a Q-Q plot of the standardized residuals. If the residuals are normally distributed, the points lie close to the diagonal.")
+ CheckBox
+ {
+ name: "qqPlotCi"
+ label: bayesian ? qsTr("Credible interval") : qsTr("Confidence interval")
+ childrenOnSameRow: !bayesian // the Bayesian form has no room for the level next to the label
+ checked: qqPlotCiChecked
+ info: bayesian ? qsTr("Adds the central credible interval of each standardized residual as an error bar.") : qsTr("Adds a confidence band around the diagonal. The band shows the expected range of the standardized residuals under normality; points outside the band suggest deviations from normality.")
+ CIField { name: "qqPlotCiLevel"; defaultValue: qqPlotCiLevelValue }
+ }
+ }
+}
diff --git a/renv.lock b/renv.lock
index 64498d98..54229d45 100644
--- a/renv.lock
+++ b/renv.lock
@@ -905,7 +905,7 @@
"RemoteHost": "api.github.com",
"RemoteUsername": "jasp-stats",
"RemoteRepo": "jaspGraphs",
- "RemoteSha": "23cdda0d795329eb99a2659bf6f325a9194ff292"
+ "RemoteSha": "a1cccd474f9567e07b41f74ba76f371c1023d811"
},
"jaspJags": {
"Package": "jaspJags",
diff --git a/tests/testthat/_snaps/classic-process-integration-general/residuals-qq-plot-ci-contnormal.svg b/tests/testthat/_snaps/classic-process-integration-general/residuals-qq-plot-ci-contnormal.svg
new file mode 100644
index 00000000..8ec44627
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/residuals-qq-plot-ci-contnormal.svg
@@ -0,0 +1,181 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/residuals-qq-plot-contnormal.svg b/tests/testthat/_snaps/classic-process-integration-general/residuals-qq-plot-contnormal.svg
new file mode 100644
index 00000000..1cdc65b5
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/residuals-qq-plot-contnormal.svg
@@ -0,0 +1,174 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/residuals-vs-predicted-contnormal.svg b/tests/testthat/_snaps/classic-process-integration-general/residuals-vs-predicted-contnormal.svg
new file mode 100644
index 00000000..edcd1efd
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/residuals-vs-predicted-contnormal.svg
@@ -0,0 +1,168 @@
+
+
diff --git a/tests/testthat/generate-tests-helper.R b/tests/testthat/generate-tests-helper.R
index 899626b5..96d11ac3 100644
--- a/tests/testthat/generate-tests-helper.R
+++ b/tests/testthat/generate-tests-helper.R
@@ -26,6 +26,10 @@ getOptionsOneModel <- function() {
"processRelationships" = list(),
"residualCovariances" = TRUE,
"statisticalPathPlot" = TRUE,
+ "residualVsFittedPlot" = FALSE,
+ "residualQqPlot" = FALSE,
+ "qqPlotCi" = FALSE,
+ "qqPlotCiLevel" = 0.95,
"totalEffects" = TRUE,
"localTests" = FALSE,
"localTestType" = "cis",
@@ -191,6 +195,10 @@ getOptionsOneModelBadVarNames <- function(k, parms) {
"processRelationships" = list(),
"residualCovariances" = TRUE,
"statisticalPathPlot" = TRUE,
+ "residualVsFittedPlot" = FALSE,
+ "residualQqPlot" = FALSE,
+ "qqPlotCi" = FALSE,
+ "qqPlotCiLevel" = 0.95,
"totalEffects" = TRUE,
"localTests" = FALSE,
"localTestType" = "cis",
@@ -266,6 +274,10 @@ getOptionsOneModelBayes <- function() {
"processRelationships" = list(),
"residualCovariances" = TRUE,
"statisticalPathPlot" = TRUE,
+ "residualVsFittedPlot" = FALSE,
+ "residualQqPlot" = FALSE,
+ "qqPlotCi" = FALSE,
+ "qqPlotCiLevel" = 0.95,
"totalEffects" = TRUE
)
)
diff --git a/tests/testthat/helper-process-integration.R b/tests/testthat/helper-process-integration.R
index 98c2e1d9..848e01e1 100644
--- a/tests/testthat/helper-process-integration.R
+++ b/tests/testthat/helper-process-integration.R
@@ -126,7 +126,8 @@ getProcessModel <- function(processRelationships, name = "Model 1") {
modelNumberIndependent = list(value = ""), modelNumberMediators = list(value = c()),
modelNumberModeratorW = list(value = ""), modelNumberModeratorZ = list(value = ""), name = name,
pathCoefficients = TRUE, intercepts = FALSE, processRelationships = processRelationships,
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE,
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE,
+ qqPlotCi = FALSE, qqPlotCiLevel = 0.95, totalEffects = TRUE,
localTests = FALSE, localTestType = "cis", localTestBootstrap = FALSE,
localTestBootstrapSamples = 1000))
}
diff --git a/tests/testthat/test-bayesian-process-general.R b/tests/testthat/test-bayesian-process-general.R
index 5c929935..d9651097 100644
--- a/tests/testthat/test-bayesian-process-general.R
+++ b/tests/testthat/test-bayesian-process-general.R
@@ -105,3 +105,34 @@ test_that("Incomplete Hayes configuration works", {
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "statistical-path-plot-incomplete")
})
+
+test_that("Residual Q-Q plot with credible intervals works", {
+ skip_on_ci()
+ options <- getOptionsBayesian()
+ options$dependent <- "contNormal"
+ options$covariates <- list("contGamma", "contcor1")
+ options$factors <- list()
+ processModel <- getProcessModel(list(
+ list(processDependent = "contNormal", processIndependent = "contGamma",
+ processType = "mediators", processVariable = "contcor1")))
+ processModel$residualQqPlot <- TRUE
+ processModel$qqPlotCi <- TRUE
+ options$processModels <- list(processModel)
+ set.seed(1)
+ results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
+
+ modelPlots <- results[["results"]][["residualPlotContainer"]][["collection"]][["residualPlotContainer_Model 1"]][["collection"]]
+ # One container per dependent variable: the outcome and the mediator
+ expect_setequal(sapply(modelPlots, `[[`, "title"), c("contNormal", "contcor1"))
+
+ outcomePlots <- modelPlots[[which(sapply(modelPlots, `[[`, "title") == "contNormal")]][["collection"]]
+ plotName <- outcomePlots[[grep("residualQqPlot$", names(outcomePlots))]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+
+ # One credible interval (error bar) per observation, around its posterior mean
+ isErrorbar <- sapply(testPlot$layers, function(layer) inherits(layer$geom, "GeomErrorbar"))
+ expect_equal(sum(isErrorbar), 1)
+ bars <- ggplot2::layer_data(testPlot, which(isErrorbar))
+ expect_equal(nrow(bars), 100)
+ expect_true(all(bars$ymin < bars$y & bars$y < bars$ymax))
+})
diff --git a/tests/testthat/test-bayesian-process-integration.R b/tests/testthat/test-bayesian-process-integration.R
index 08a33d7e..45d7b67f 100644
--- a/tests/testthat/test-bayesian-process-integration.R
+++ b/tests/testthat/test-bayesian-process-integration.R
@@ -46,7 +46,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
pathCoefficients = TRUE, intercepts = FALSE, processRelationships = list(
list(processDependent = "contNormal", processIndependent = "contGamma",
processType = "moderators", processVariable = "contcor1")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -176,7 +176,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
pathCoefficients = TRUE, intercepts = FALSE, processRelationships = list(
list(processDependent = "contNormal", processIndependent = "facGender",
processType = "moderators", processVariable = "facExperim")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -305,7 +305,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "moderators", processVariable = "contcor1"),
list(processDependent = "contNormal", processIndependent = "contGamma",
processType = "moderators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -496,7 +496,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "moderators", processVariable = "facExperim"),
list(processDependent = "contNormal", processIndependent = "facGender",
processType = "moderators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -676,7 +676,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "moderators", processVariable = "contcor1"),
list(processDependent = "contNormal", processIndependent = "contcor1",
processType = "moderators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -909,7 +909,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "moderators", processVariable = "facExperim"),
list(processDependent = "contNormal", processIndependent = "facExperim",
processType = "moderators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -1133,7 +1133,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "mediators", processVariable = "debCollin1"),
list(processDependent = "contNormal", processIndependent = "contGamma",
processType = "mediators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -1264,7 +1264,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "mediators", processVariable = "debCollin1"),
list(processDependent = "contNormal", processIndependent = "facGender",
processType = "mediators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -1401,7 +1401,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "moderators", processVariable = "contcor2"),
list(processDependent = "contNormal", processIndependent = "contGamma",
processType = "moderators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -1409,204 +1409,204 @@ results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
table <- results[["results"]][["modelSummaryTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list("Model 1", 100, 1693.77119366349, 1630.67600883238, 67.1893733285394,
- 0.54, 1632.57087218328, 67.9647998516443))
+ list("Model 1", 100, 1693.22472630535, 1629.6116629699, 67.8297490047765,
+ 0.585, 1629.95348325244, 67.9176133621196))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_covariancesTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(140, -1.10578011683896, 0.444468712602288, "contGamma:contcor2",
- -0.307051966656027, -0.28702534711593, "", 0.998981966609724,
- "contGamma", 0.399137442235672, 154, 199, -0.401030046025362,
- 0.187151878691838, "contcor2", -0.0805066064609414, -0.0770481928535948,
- "", 0.999400517970576, "contGamma", 0.151330939284352,
- 149, 180, -1.45333525707932, 0.187600853714869, "contGamma:contcor1",
- -0.539280415697475, -0.532370111719705, "", 0.998043245933613,
- "contGamma", 0.412681583536199, 153, 134, -0.563301932192979,
- 0.04502582210312, "contcor1", -0.214483989673051, -0.201128159807714,
- "", 0.999298858640328, "contGamma", 0.153726525969987,
- 129, 298, 1.97992364162951, 3.270821303163, "contGamma", 2.46235818022523,
- 2.41426538328823, "", 1.00918250220483, "contGamma",
- 0.351581262559393, 177, 114, 0.83530045161455, 1.53879344346493,
- "contNormal", 1.15735725107844, 1.14415356383829, "",
- 1.01175339093468, "contNormal", 0.175682906350506, 98, 249,
- 0.00547417907820498, 0.00883984534436256, "debCollin1", 0.0070029217491707,
- 0.00698050587224585, "", 0.998677903548806, "debCollin1",
- 0.000861522560272353, 152, 147, 0.935474291294679, 2.09249461412965,
- "contGamma:contcor2", 1.43804576683407, 1.40038093705679, "",
- 0.99875528086404, "contcor1", 0.304156629007661, 92, 150, 0.421059081418766,
- 0.902709667208345, "contcor2", 0.615716215967707, 0.597152597024933,
- "", 0.999442635131443, "contcor1", 0.115782936878333,
- 92, 166, 1.52037520471415, 2.77395194035311, "contGamma:contcor1",
- 1.99927004240244, 1.93424637458086, "", 0.995209319654455,
- "contcor1", 0.32339199823998, 132, 132, 0.769988388203535, 1.35159132263985,
- "contcor1", 1.00966123801417, 0.989283744054233, "",
- 0.99702026605927, "contcor1", 0.145498297877487, 122, 182, 3.86057636043755,
- 7.20310020374271, "contGamma:contcor2", 5.29900951886372, 5.19694225463893,
- "", 0.999547400038983, "contGamma:contcor1", 0.840072304050717,
- 149, 182, 0.977764162203827, 2.15338955878112, "contcor2", 1.45554747440255,
- 1.42981219551963, "", 1.0273419724811, "contGamma:contcor1",
- 0.290192777143376, 38, 181, 5.07281542482652, 8.28973784364067,
- "contGamma:contcor1", 6.35260426086298, 6.26103237807955, "",
- 0.995103903690419, "contGamma:contcor1", 0.861855689402656,
- 154, 137, 1.556513489695, 2.97434519709331, "contGamma:contcor2",
- 2.20638771556626, 2.17527387916513, "", 1.01274570175417,
- "contcor2", 0.349694840125612, 113, 109, 0.729530386416436,
- 1.24818736522482, "contcor2", 0.973394629860563, 0.961113499162621,
- "", 1.01474824301999, "contcor2", 0.135380923702543,
- 136, 213, 5.42480809371025, 9.5606175951128, "contGamma:contcor2",
- 7.48660598309586, 7.40101696647511, "", 1.00729664081207,
- "contGamma:contcor2", 1.05503132350005, 110))
+ list(95, -1.08625910496005, 0.364224566826906, "contGamma:contcor2",
+ -0.334161296185348, -0.326088836217083, "", 0.999730527717789,
+ "contGamma", 0.358363547667633, 148, 110, -0.321356249283729,
+ 0.193123856243137, "contcor2", -0.0959840163515112, -0.101836399679445,
+ "", 1.00287765731788, "contGamma", 0.130665361154654,
+ 174, 91, -1.24246925762282, 0.120143359453343, "contGamma:contcor1",
+ -0.5872745765517, -0.589793448746714, "", 1.00467614204713,
+ "contGamma", 0.340273226704707, 72, 163, -0.540770714231111,
+ 0.0383752160280799, "contcor1", -0.238429517823631, -0.233616132840792,
+ "", 0.995485811952666, "contGamma", 0.146680459428312,
+ 116, 357, 1.86079546052894, 3.18543386777161, "contGamma", 2.46425056446623,
+ 2.44716148295214, "", 1.00249372247312, "contGamma",
+ 0.332282563994788, 106, 314, 0.900870556682937, 1.47039439595774,
+ "contNormal", 1.15509223236395, 1.12943815949248, "",
+ 1.00560773014887, "contNormal", 0.158561447357742, 133, 272,
+ 0.00532890621555802, 0.00912979963999324, "debCollin1", 0.0068040157706966,
+ 0.00663705751347781, "", 1.00164209437002, "debCollin1",
+ 0.000919371908338539, 133, 96, 0.956379479912261, 2.09470487826306,
+ "contGamma:contcor2", 1.44340355747535, 1.41298385202905, "",
+ 1.01092300157764, "contcor1", 0.279656573241294, 87, 126, 0.43359692986016,
+ 0.820206367085934, "contcor2", 0.607333062788211, 0.601202041353056,
+ "", 1.01083930719313, "contcor1", 0.101238918662985,
+ 100, 139, 1.509732464723, 2.57808835066442, "contGamma:contcor1",
+ 1.97391074703701, 1.9577787716275, "", 1.05600329740023,
+ "contcor1", 0.286616927524068, 137, 176, 0.77742344395242, 1.25057880837439,
+ "contcor1", 0.98648736338812, 0.977081303176568, "",
+ 1.00354395514371, "contcor1", 0.122020563181446, 154, 111, 3.76466455844276,
+ 7.45906850006956, "contGamma:contcor2", 5.41440929975628, 5.27688267181329,
+ "", 1.00024869207489, "contGamma:contcor1", 0.914879997555251,
+ 94, 99, 0.962568404308051, 2.10568612778086, "contcor2", 1.47045509197808,
+ 1.43448148501398, "", 1.0039222520292, "contGamma:contcor1",
+ 0.294067414118234, 104, 150, 4.92134590847031, 8.15930508397999,
+ "contGamma:contcor1", 6.37463595160487, 6.32379710111159, "",
+ 1.01659679845447, "contGamma:contcor1", 0.895311324195823, 94,
+ 113, 1.60491749606624, 3.12353246006672, "contGamma:contcor2",
+ 2.23970871862693, 2.16935011528491, "", 1.00079987367113,
+ "contcor2", 0.37397955632887, 95, 139, 0.740387851360677, 1.3130870065321,
+ "contcor2", 0.975718652570714, 0.959737612845886, "",
+ 1.00175656567369, "contcor2", 0.139052045867448, 120, 115, 5.65005964431794,
+ 10.1670527370095, "contGamma:contcor2", 7.663781015381, 7.57771601697862,
+ "", 0.998864398603919, "contGamma:contcor2", 1.16363937233196,
+ 148))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(180, -0.175164254946154, 0.221510589728766, 16, 16, "contGamma",
- "contNormal", "", 0.0238066598912154, 0.0298257664157129, "",
- "", 1.00515384098187, 0.103528146469731, 162, 77, -0.235719775386611,
- 0.30609707319795, 50, 16, "contGamma", "contNormal", "", 0.0141904000234719,
- 0.0078355127449481, "", "", 0.995444549945092, 0.142831422227466,
- 102, 70, -0.528954988225345, 0.524258336991064, 84, 16, "contGamma",
- "contNormal", "", 0.0037047058890329, -0.00815831234150002,
- "", "", 0.996294865301874, 0.264486686164776, 112,
- 80, -0.336667310531986, 0.251967024988196, 16, 50, "contGamma",
- "contNormal", "", -0.0088577393708124, -0.0110127729650236,
- "", "", 1.00918958622424, 0.15088096444417, 122, 136,
- -0.158926177956876, 0.104852302465534, 50, 50, "contGamma",
- "contNormal", "", -0.018473999238556, -0.0144301936935509, "",
- "", 1.01582071465031, 0.0702317568206226, 95, 94, -0.305000702263558,
- 0.317092803384613, 84, 50, "contGamma", "contNormal", "", -0.0289596933729949,
- -0.0400580494525863, "", "", 0.995373747076925, 0.156466764765576,
- 94, 64, -0.510892191153586, 0.498139255435612, 16, 84, "contGamma",
- "contNormal", "", -0.0471909968573129, -0.0363487601591132,
- "", "", 1.00573610165568, 0.27869798523232, 128, 63,
- -0.335922541310565, 0.274330408335954, 50, 84, "contGamma",
- "contNormal", "", -0.0568072567250564, -0.0554671557478265,
- "", "", 1.00929701726885, 0.165980291169278, 113, 153,
- -0.307061661362052, 0.134503782815686, 84, 84, "contGamma",
- "contNormal", "", -0.0672929508594954, -0.0695225639217348,
- "", "", 1.01189659054095, 0.109035677125006, 159, 101,
- -0.0247213330585478, 0.0154949213233161, 16, 16, "contGamma",
- "debCollin1", "contNormal", -0.00122921284059313, -0.000176828874751836,
- "", "", 1.00745570038162, 0.0098963273558484,
- 132, 59, -0.0340580912543412, 0.016073669972779, 50, 16, "contGamma",
- "debCollin1", "contNormal", -0.0031684274833913, -0.00080322680021722,
- "", "", 1.01161774635345, 0.0134712174774901,
- 97, 70, -0.0510292392545626, 0.0349770067879073, 84, 16, "contGamma",
- "debCollin1", "contNormal", -0.00528297221128645, -0.00162338048809232,
- "", "", 1.00569089037732, 0.0222895173926444,
- 55, 186, -0.0354194930861152, 0.0164454359758523, 16, 50, "contGamma",
- "debCollin1", "contNormal", -0.000627379744148592, 0.000219287022623011,
- "", "", 1.00744702976833, 0.0121939828590878,
- 123, 37, -0.0250982780604699, 0.0148949991222565, 50, 50, "contGamma",
- "debCollin1", "contNormal", -0.00256659438694676, -0.00118902701094705,
- "", "", 1.02306028208841, 0.0100452433144953,
- 56, 43, -0.0566416110588716, 0.0193363390113733, 84, 50, "contGamma",
- "debCollin1", "contNormal", -0.00468113911484191, -0.00148815533434619,
- "", "", 1.01873346490581, 0.0165245216914321,
- 70, 217, -0.04842546896881, 0.0347624429394011, 16, 84, "contGamma",
- "debCollin1", "contNormal", 7.89005968685916e-05, 0.000796305894329921,
- "", "", 1.00119360803618, 0.0208134519440197,
- 116, 94, -0.0429364150377641, 0.01953524918184, 50, 84, "contGamma",
- "debCollin1", "contNormal", -0.00186031404592958, 0.000282495246880103,
- "", "", 1.00346209187446, 0.0152085471015829,
- 91, 34, -0.0456903323527392, 0.019478145244326, 84, 84, "contGamma",
- "debCollin1", "contNormal", -0.00397485877382473, -0.00142857783888295,
- "", "", 1.02926139950434, 0.0153429259420723,
- 81))
+ list(195, -0.173682351736758, 0.21688178370042, 16, 16, "contGamma",
+ "contNormal", "", 0.00654278386084343, -0.00370025984405296,
+ "", "", 0.999797358129797, 0.105027372131217, 184,
+ 99, -0.2674796636633, 0.280809607610037, 50, 16, "contGamma",
+ "contNormal", "", -0.00261854685506238, -0.000858511030904891,
+ "", "", 1.00198603816999, 0.141147063209823, 95, 66,
+ -0.525504169227738, 0.470559728008329, 84, 16, "contGamma",
+ "contNormal", "", -0.0126081803583809, -0.00136478581400297,
+ "", "", 0.99879066362209, 0.251866337299116, 65, 76,
+ -0.236606941613819, 0.247201256225244, 16, 50, "contGamma",
+ "contNormal", "", -0.014329012690406, -0.02754699630709, "",
+ "", 0.996505613405404, 0.137417016178235, 73, 332, -0.162674500338086,
+ 0.14859489706769, 50, 50, "contGamma", "contNormal", "", -0.0234903434063118,
+ -0.0194646540238253, "", "", 0.996204102160961, 0.0739879993240351,
+ 151, 85, -0.33066749107329, 0.239091757019962, 84, 50, "contGamma",
+ "contNormal", "", -0.0334799769096304, -0.0195912993703959,
+ "", "", 0.995541080351004, 0.157070464039399, 91, 57,
+ -0.505677559933045, 0.496577952524493, 16, 84, "contGamma",
+ "contNormal", "", -0.0388230786913378, -0.0474613918934423,
+ "", "", 1.0028125315414, 0.249704921094004, 90, 81,
+ -0.307781740610852, 0.274816111971464, 50, 84, "contGamma",
+ "contNormal", "", -0.0479844094072436, -0.0496951526931543,
+ "", "", 1.01431880244713, 0.15090420926089, 130, 154,
+ -0.262483539384871, 0.185299235231714, 84, 84, "contGamma",
+ "contNormal", "", -0.0579740429105622, -0.0710193676067323,
+ "", "", 1.01323423045752, 0.115894400668743, 128, 31,
+ -0.0134160595884967, 0.024517464548607, 16, 16, "contGamma",
+ "debCollin1", "contNormal", 0.00154739405223033, 7.58161319496144e-05,
+ "", "", 1.08025856472927, 0.00930465021913109,
+ 111, 5, -0.0254529517724318, 0.0349887114151555, 50, 16, "contGamma",
+ "debCollin1", "contNormal", 0.00278620513879082, 0.000930656147941854,
+ "", "", 1.16488783606166, 0.015297138872743,
+ 27, 6, -0.0410299947439532, 0.0658037544332756, 84, 16, "contGamma",
+ "debCollin1", "contNormal", 0.00413702077009438, 0.00114400056327888,
+ "", "", 1.14142419483854, 0.0266130218102079,
+ 26, 55, -0.0288541911118944, 0.02771687590101, 16, 50, "contGamma",
+ "debCollin1", "contNormal", 0.00153649123390858, 0.000826631551199544,
+ "", "", 1.03908410541457, 0.0129620449240413,
+ 74, 3, -0.0208534930495718, 0.0276470995514311, 50, 50, "contGamma",
+ "debCollin1", "contNormal", 0.00277530232046906, 0.00241038435854837,
+ "", "", 1.27439210742095, 0.0123060457129706,
+ 29, 3, -0.0377050555263724, 0.050804906438363, 84, 50, "contGamma",
+ "debCollin1", "contNormal", 0.00412611795177262, 0.00251964622660125,
+ "", "", 1.24716869125818, 0.0211390529782518,
+ 19, 99, -0.0446891579356106, 0.0499017638717733, 16, 84, "contGamma",
+ "debCollin1", "contNormal", 0.00152369624757793, 0.000455521920940727,
+ "", "", 1.01037456188511, 0.0222080889157197,
+ 90, 7, -0.0338702992418698, 0.0378472522660625, 50, 84, "contGamma",
+ "debCollin1", "contNormal", 0.00276250733413841, 0.0018994484054926,
+ "", "", 1.12491592304885, 0.016857025479666,
+ 98, 3, -0.039744161888052, 0.0393368149062943, 84, 84, "contGamma",
+ "debCollin1", "contNormal", 0.00411332296544198, 0.00565006250516107,
+ "", "", 1.28466278765983, 0.0192279694689132,
+ 22))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_pathCoefficientsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(143, -0.162639392447408, 0.107389417152544, "contGamma", -0.0203206715529496,
- -0.0144655662699013, "", "Normal(0,10)", 1.01592794311801,
- "contNormal", 0.070219981681631, 116, 23, -1.26494735351279,
- 2.01635526103746, "debCollin1", 0.286161933245242, 0.325520323743492,
- "", "Normal(0,10)", 1.0542689892764, "contNormal",
- 0.857544771710748, 26, 79, -0.271438529371976, 0.787252781283628,
- "contcor1", 0.283822180183722, 0.25323027220294, "",
- "Normal(0,10)", 1.00401820690305, "contNormal", 0.274551612698555,
- 128, 76, -0.251212653449895, 0.239634878462375, "contGamma:contcor1",
- -0.00990244039516379, -0.0185449119026858, "", "Normal(0,10)",
- 1.00822534785385, "contNormal", 0.134686654434048, 128, 61,
- -0.665779620609297, 0.52434754553914, "contcor2", -0.0621813482974446,
- -0.0681608185827784, "", "Normal(0,10)", 1.00622210629433,
- "contNormal", 0.310021333744703, 87, 60, -0.281469062750617,
- 0.233586733047642, "contGamma:contcor2", -0.0342322356550281,
- -0.0372427431450717, "", "Normal(0,10)", 1.00092829052877,
- "contNormal", 0.132493494930469, 105, 221, -0.020249713008892,
- 0.0022252885334867, "contGamma", -0.00939497676200258, -0.00955823647285957,
- "", "Normal(0,10)", 1.00764908537541, "debCollin1",
- 0.0056404890101736, 66, 329, -0.0358913433220594, 0.041332843681485,
- "contcor1", 0.00394389617969163, 0.00212618575055752, "",
- "Normal(0,10)", 1.01476481886041, "debCollin1", 0.01993524984759,
- 182, 261, -0.0230017591417102, 0.0146217435005917, "contGamma:contcor1",
- -0.00453338865104486, -0.00447576570400419, "", "Normal(0,10)",
- 1.00644841606524, "debCollin1", 0.00953284286150826, 115, 314,
- -0.0324406706385607, 0.0487541880527463, "contcor2", 0.00803101458014618,
- 0.0086018084768232, "", "Normal(0,10)", 1.00604268940606,
- "debCollin1", 0.0214783501568858, 142, 241, -0.0179102696154205,
- 0.0176796862557574, "contGamma:contcor2", 0.000227409936800691,
- 0.00036716668540366, "", "Normal(0,10)", 1.01140380265589,
- "debCollin1", 0.00945779581816946, 182))
+ list(326, -0.162516367287395, 0.144363298863632, "contGamma", -0.024822234252587,
+ -0.020753266944737, "", "Normal(0,10)", 0.996343282437141,
+ "contNormal", 0.0742813171760249, 151, 2, -2.06960288953075,
+ 1.78247132301171, "debCollin1", -0.29715100689637, -0.476600482668766,
+ "", "Normal(0,10)", 1.38041537562313, "contNormal",
+ 1.15279754041933, 31, 48, -0.164856045858433, 0.749213163301185,
+ "contcor1", 0.265717879509864, 0.246538855113319, "",
+ "Normal(0,10)", 1.00051251468716, "contNormal", 0.236719100533818,
+ 68, 54, -0.270990436154854, 0.225320879828928, "contGamma:contcor1",
+ -0.0094339725217854, -0.00417484126874283, "", "Normal(0,10)",
+ 0.996083448010397, "contNormal", 0.125430046104704, 53, 49,
+ -0.580811665350709, 0.453985026146509, "contcor2", -0.0919715489202572,
+ -0.100205346011289, "", "Normal(0,10)", 1.03062934134982,
+ "contNormal", 0.248021172201841, 76, 69, -0.291505742484325,
+ 0.218522687927275, "contGamma:contcor2", -0.021873607787937,
+ -0.0196152650436904, "", "Normal(0,10)", 1.00870493352782,
+ "contNormal", 0.121444685104788, 70, 278, -0.0193438375502631,
+ 0.00067238631299476, "contGamma", -0.0096689638568205, -0.00974100278413923,
+ "", "Normal(0,10)", 0.995027816556879, "debCollin1",
+ 0.00515378302173381, 152, 186, -0.0292766983881246, 0.0426504387939506,
+ "contcor1", 0.00565346362160643, 0.00429115434636951, "",
+ "Normal(0,10)", 1.00870620518226, "debCollin1", 0.0191982138203322,
+ 134, 229, -0.0255376091953851, 0.0137761952854534, "contGamma:contcor1",
+ -0.00534418361971656, -0.00644083023743031, "", "Normal(0,10)",
+ 1.0046117043977, "debCollin1", 0.0101567509428574, 155, 227,
+ -0.0366436080226745, 0.0461010911816976, "contcor2", 0.0087378821078791,
+ 0.0112298549478987, "", "Normal(0,10)", 0.998733410298939,
+ "debCollin1", 0.0213729075296855, 160, 249, -0.0188805663160768,
+ 0.0192080602583633, "contGamma:contcor2", 6.2588997002551e-07,
+ 0.000210817741350628, "", "Normal(0,10)", 1.00290870865997,
+ "debCollin1", 0.0100096833575728, 151))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(192, -0.176419062955223, 0.216052226831667, 16, 16, "Total", "contGamma",
- "contNormal", 0.0225774470506223, 0.0281889011290565, "",
- 1.00119452892422, 0.104096522822997, 162, 78, -0.243957506204456,
- 0.315941666546356, 50, 16, "Total", "contGamma", "contNormal",
- 0.0110219725400806, 0.00555282442552389, "", 0.995784304278338,
- 0.142983541194368, 117, 70, -0.528787429420716, 0.54175865672131,
- 84, 16, "Total", "contGamma", "contNormal", -0.00157826632225353,
- -0.00133534104455207, "", 0.996680498623672, 0.26616108584909,
- 79, 81, -0.336702321352876, 0.256553376203225, 16, 50, "Total",
- "contGamma", "contNormal", -0.009485119114961, -0.00867206300349724,
- "", 1.00658743690464, 0.152441301182198, 119, 176,
- -0.157391653643486, 0.106341782529723, 50, 50, "Total", "contGamma",
- "contNormal", -0.0210405936255027, -0.015263636283122, "",
- 1.01675119758771, 0.0701404999219642, 95, 93, -0.324037635081689,
- 0.291889915486827, 84, 50, "Total", "contGamma", "contNormal",
- -0.0336408324878368, -0.0399445777532911, "", 0.995013437661159,
- 0.157687357463014, 77, 64, -0.522567803811216, 0.496702420072045,
- 16, 84, "Total", "contGamma", "contNormal", -0.0471120962604443,
- -0.0329316312015037, "", 1.00643168673991, 0.280805634975281,
- 112, 65, -0.339959879796358, 0.279917456306998, 50, 84, "Total",
- "contGamma", "contNormal", -0.058667570770986, -0.0508767763341862,
- "", 1.00931117394339, 0.166612154096011, 113, 172,
- -0.30684777763108, 0.130602674635308, 84, 84, "Total", "contGamma",
- "contNormal", -0.0712678096333201, -0.0767781684524591, "",
- 1.00597201389188, 0.109400810453912, 159, 101, -0.0247213330585478,
- 0.0154949213233161, 16, 16, "Total indirect", "contGamma", "contNormal",
- -0.00122921284059313, -0.000176828874751836, "", 1.00745570038162,
- 0.0098963273558484, 132, 59, -0.0340580912543412, 0.016073669972779,
- 50, 16, "Total indirect", "contGamma", "contNormal", -0.0031684274833913,
- -0.00080322680021722, "", 1.01161774635345, 0.0134712174774901,
- 97, 70, -0.0510292392545626, 0.0349770067879073, 84, 16, "Total indirect",
- "contGamma", "contNormal", -0.00528297221128645, -0.00162338048809232,
- "", 1.00569089037732, 0.0222895173926444, 55, 186,
- -0.0354194930861152, 0.0164454359758523, 16, 50, "Total indirect",
- "contGamma", "contNormal", -0.000627379744148592, 0.000219287022623011,
- "", 1.00744702976833, 0.0121939828590878, 123, 37,
- -0.0250982780604699, 0.0148949991222565, 50, 50, "Total indirect",
- "contGamma", "contNormal", -0.00256659438694676, -0.00118902701094705,
- "", 1.02306028208841, 0.0100452433144953, 56, 43, -0.0566416110588716,
- 0.0193363390113733, 84, 50, "Total indirect", "contGamma", "contNormal",
- -0.00468113911484191, -0.00148815533434619, "", 1.01873346490581,
- 0.0165245216914321, 70, 217, -0.04842546896881, 0.0347624429394011,
- 16, 84, "Total indirect", "contGamma", "contNormal", 7.89005968685916e-05,
- 0.000796305894329921, "", 1.00119360803618, 0.0208134519440197,
- 116, 94, -0.0429364150377641, 0.01953524918184, 50, 84, "Total indirect",
- "contGamma", "contNormal", -0.00186031404592958, 0.000282495246880103,
- "", 1.00346209187446, 0.0152085471015829, 91, 34, -0.0456903323527392,
- 0.019478145244326, 84, 84, "Total indirect", "contGamma", "contNormal",
- -0.00397485877382473, -0.00142857783888295, "", 1.02926139950434,
- 0.0153429259420723, 81))
+ list(195, -0.172175298688778, 0.21679931120771, 16, 16, "Total", "contGamma",
+ "contNormal", 0.00809017791307376, 0.00344165826021509, "",
+ 1.00374607043212, 0.10508581356254, 182, 94, -0.264869546987337,
+ 0.278118297746762, 50, 16, "Total", "contGamma", "contNormal",
+ 0.000167658283728438, 0.00311873347797014, "", 1.01101260264568,
+ 0.142125657896208, 119, 58, -0.482445986575387, 0.47125381344271,
+ 84, 16, "Total", "contGamma", "contNormal", -0.00847115958828657,
+ 0.00229743974147677, "", 1.00426866614326, 0.254957332334752,
+ 65, 77, -0.244039804354894, 0.270146277950821, 16, 50, "Total",
+ "contGamma", "contNormal", -0.0127925214564974, -0.0264306440598269,
+ "", 0.995674450224942, 0.139755302874533, 57, 351,
+ -0.163025117052484, 0.140492715378662, 50, 50, "Total", "contGamma",
+ "contNormal", -0.0207150410858428, -0.0219741119450304, "",
+ 0.996731479200166, 0.074801921527064, 182, 69, -0.337118802669377,
+ 0.272963859572018, 84, 50, "Total", "contGamma", "contNormal",
+ -0.0293538589578578, -0.024146514787919, "", 0.999847209956037,
+ 0.158802010134141, 76, 61, -0.508983704220075, 0.540242206785745,
+ 16, 84, "Total", "contGamma", "contNormal", -0.0372993824437599,
+ -0.0457338030515361, "", 1.00096922902921, 0.254543291651079,
+ 61, 96, -0.303738509209623, 0.275072348346696, 50, 84, "Total",
+ "contGamma", "contNormal", -0.0452219020731052, -0.0483166779019381,
+ "", 1.01717670180275, 0.154128002807842, 130, 184,
+ -0.256985980253621, 0.181399338451299, 84, 84, "Total", "contGamma",
+ "contNormal", -0.0538607199451202, -0.0620530010700475, "",
+ 0.997649231190117, 0.117589608333143, 106, 31, -0.0134160595884967,
+ 0.024517464548607, 16, 16, "Total indirect", "contGamma", "contNormal",
+ 0.00154739405223033, 7.58161319496144e-05, "", 1.08025856472927,
+ 0.00930465021913109, 111, 5, -0.0254529517724318, 0.0349887114151555,
+ 50, 16, "Total indirect", "contGamma", "contNormal", 0.00278620513879082,
+ 0.000930656147941854, "", 1.16488783606166, 0.015297138872743,
+ 27, 6, -0.0410299947439532, 0.0658037544332756, 84, 16, "Total indirect",
+ "contGamma", "contNormal", 0.00413702077009438, 0.00114400056327888,
+ "", 1.14142419483854, 0.0266130218102079, 26, 55, -0.0288541911118944,
+ 0.02771687590101, 16, 50, "Total indirect", "contGamma", "contNormal",
+ 0.00153649123390858, 0.000826631551199544, "", 1.03908410541457,
+ 0.0129620449240413, 74, 3, -0.0208534930495718, 0.0276470995514311,
+ 50, 50, "Total indirect", "contGamma", "contNormal", 0.00277530232046906,
+ 0.00241038435854837, "", 1.27439210742095, 0.0123060457129706,
+ 29, 3, -0.0377050555263724, 0.050804906438363, 84, 50, "Total indirect",
+ "contGamma", "contNormal", 0.00412611795177262, 0.00251964622660125,
+ "", 1.24716869125818, 0.0211390529782518, 19, 99, -0.0446891579356106,
+ 0.0499017638717733, 16, 84, "Total indirect", "contGamma", "contNormal",
+ 0.00152369624757793, 0.000455521920940727, "", 1.01037456188511,
+ 0.0222080889157197, 90, 7, -0.0338702992418698, 0.0378472522660625,
+ 50, 84, "Total indirect", "contGamma", "contNormal", 0.00276250733413841,
+ 0.0018994484054926, "", 1.12491592304885, 0.016857025479666,
+ 98, 3, -0.039744161888052, 0.0393368149062943, 84, 84, "Total indirect",
+ "contGamma", "contNormal", 0.00411332296544198, 0.00565006250516107,
+ "", 1.28466278765983, 0.0192279694689132, 22))
@@ -1672,7 +1672,7 @@ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovaria
processType = "moderators", processVariable = "contcor2"),
list(processDependent = "contNormal", processIndependent = "facGender",
processType = "moderators", processVariable = "contcor2")),
- residualCovariances = TRUE, statisticalPathPlot = TRUE, totalEffects = TRUE))
+ residualCovariances = TRUE, statisticalPathPlot = TRUE, residualVsFittedPlot = FALSE, residualQqPlot = FALSE, totalEffects = TRUE))
set.seed(1)
results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
@@ -1687,166 +1687,167 @@ results <- jaspTools::runAnalysis("BayesianProcess", "debug.csv", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_covariancesTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(174, -0.0844251089712655, 0.0638737416165507, "facGenderm:contcor2",
- -0.0101476117170482, -0.0101764923414383, "", 0.998940411612732,
- "facGenderm", 0.0349420167987609, 92, 189, -0.156785472896874,
- 0.0449794109330763, "contcor2", -0.0608084695441341, -0.0615866038220158,
- "", 1.00758779962043, "facGenderm", 0.0509331658124856,
- 150, 139, 0.098016715240886, 0.209082470035926, "facGenderm:facExperimexperimental",
- 0.146175971834894, 0.145711631818078, "", 1.02688738211913,
- "facGenderm", 0.0299788389292739, 153, 135, -0.0134674486663281,
- 0.0889030234672452, "facExperimexperimental", 0.0349725024260161,
- 0.0347050588586803, "", 1.01153255470051, "facGenderm",
- 0.0265445955739178, 131, 102, 0.195324238720501, 0.345908289019366,
- "facGenderm", 0.263020264742172, 0.260857186208784, "",
- 1.02462758226954, "facGenderm", 0.0399208405525256, 154, 347,
- 0.840057141070582, 1.53392200271342, "contNormal", 1.1279926868422,
- 1.12302749057377, "", 1.00082803994315, "contNormal",
- 0.167965476844233, 116, 220, 0.00547357892766102, 0.00954777268630914,
- "debCollin1", 0.00713219359636282, 0.0069741601221662, "",
- 0.995067957245349, "debCollin1", 0.00111021280423279, 106, 247,
- -0.138084915446199, 0.00352269141417142, "facGenderm:contcor2",
- -0.060007589799769, -0.0598806497745945, "", 1.00257919225315,
- "facExperimexperimental", 0.0365270015368796, 184, 185, -0.162917631560786,
- 0.0412097511608624, "contcor2", -0.0604085679743879, -0.0549177153287991,
- "", 1.00199576088392, "facExperimexperimental", 0.0534790203516274,
- 142, 191, 0.0988198351223463, 0.21037315885912, "facGenderm:facExperimexperimental",
- 0.14393502925008, 0.14281717889876, "", 0.997691993833799,
- "facExperimexperimental", 0.0279875747238634, 145, 225, 0.191262996107586,
- 0.36235140311183, "facExperimexperimental", 0.259732176562213,
- 0.254772199459658, "", 0.997116746809252, "facExperimexperimental",
- 0.0401634129899251, 153, 168, -0.127909118364966, -0.00871403334336523,
- "facGenderm:contcor2", -0.0681398584425141, -0.0669122149648511,
- "", 1.03524342962459, "facGenderm:facExperimexperimental",
- 0.0317647248998065, 116, 166, -0.188905436732074, -0.0107112049712024,
- "contcor2", -0.0943660312846713, -0.091424739412201, "",
- 1.03685436704423, "facGenderm:facExperimexperimental", 0.0458284335786479,
- 147, 217, 0.159122911215857, 0.279960507516104, "facGenderm:facExperimexperimental",
- 0.20871618496456, 0.20689948932886, "", 1.00640177151173,
- "facGenderm:facExperimexperimental", 0.0323688619402047, 131,
- 279, 0.311799179398307, 0.639270252214261, "facGenderm:contcor2",
- 0.44342670050049, 0.438891883267607, "", 0.99726558269231,
- "contcor2", 0.0802339382909809, 120, 291, 0.806583734964407,
- 1.36891985939496, "contcor2", 1.02609969353655, 0.992970630710759,
- "", 0.997992049342911, "contcor2", 0.147762977262825,
- 179, 395, 0.349660849377926, 0.603739240664339, "facGenderm:contcor2",
- 0.460111606600185, 0.451427345191205, "", 0.996071584978056,
- "facGenderm:contcor2", 0.0670810473609467, 217))
+ list(174, -0.0844236355139998, 0.0638749598900535, "facGenderm:contcor2",
+ -0.0101472059891128, -0.0101744872630842, "", 0.998895597560712,
+ "facGenderm", 0.0349408568796145, 92, 189, -0.156788243268401,
+ 0.0449801752643136, "contcor2", -0.0608082012127363, -0.061583632338628,
+ "", 1.00678056564402, "facGenderm", 0.0509326616868028,
+ 150, 139, 0.0980248150491693, 0.209081197915647, "facGenderm:facExperimexperimental",
+ 0.146175795039892, 0.145706016890601, "", 1.02692477712257,
+ "facGenderm", 0.0299792179773541, 153, 135, -0.0134673528848354,
+ 0.088906696953491, "facExperimexperimental", 0.0349726155632284,
+ 0.0347094595027335, "", 1.01153255470051, "facGenderm",
+ 0.0265450348385468, 131, 102, 0.195319018906227, 0.345908541266477,
+ "facGenderm", 0.263020327387673, 0.260854515091559, "",
+ 1.02462758226954, "facGenderm", 0.039921659844121, 154, 347,
+ 0.840056936874269, 1.53382949624726, "contNormal", 1.12799112923929,
+ 1.12303675246392, "", 1.00111581443711, "contNormal",
+ 0.167961674107186, 116, 220, 0.00547385454821578, 0.00954786037073813,
+ "debCollin1", 0.00713219598167237, 0.00697403117942412, "",
+ 0.995067957245349, "debCollin1", 0.00111022897716757, 106, 247,
+ -0.13807967205083, 0.00351917265515121, "facGenderm:contcor2",
+ -0.060007961409022, -0.059881014067051, "", 1.00325068617582,
+ "facExperimexperimental", 0.0365266777600382, 184, 184, -0.162913795980379,
+ 0.0412121242603446, "contcor2", -0.0604095694024072, -0.0549172317252299,
+ "", 1.00199576088392, "facExperimexperimental", 0.0534793173620919,
+ 142, 191, 0.0988191079585608, 0.210370833782717, "facGenderm:facExperimexperimental",
+ 0.14393556660926, 0.142812027779419, "", 0.997678072775379,
+ "facExperimexperimental", 0.0279886581004617, 145, 225, 0.191258064263059,
+ 0.362369656531212, "facExperimexperimental", 0.259733112732179,
+ 0.254768718031403, "", 0.997116746809252, "facExperimexperimental",
+ 0.0401640187385519, 153, 171, -0.127914793886895, -0.00871348831250935,
+ "facGenderm:contcor2", -0.068139955703562, -0.0669183027923071,
+ "", 1.03469374408089, "facGenderm:facExperimexperimental",
+ 0.0317637310119703, 116, 166, -0.188909526006136, -0.0107024955524541,
+ "contcor2", -0.0943659575669936, -0.0914276651987763, "",
+ 1.03657773111155, "facGenderm:facExperimexperimental", 0.0458288243245446,
+ 147, 216, 0.159120636630008, 0.279959744514357, "facGenderm:facExperimexperimental",
+ 0.208716339291203, 0.206897305510754, "", 1.00642930848339,
+ "facGenderm:facExperimexperimental", 0.0323700902596528, 131,
+ 279, 0.311808370189961, 0.639269978437555, "facGenderm:contcor2",
+ 0.443427282706811, 0.43890928681234, "", 0.997442099771186,
+ "contcor2", 0.0802348887339926, 120, 291, 0.806586052566888,
+ 1.36891463069141, "contcor2", 1.02610167523013, 0.992983931164982,
+ "", 0.998019909001967, "contcor2", 0.147758551974158,
+ 179, 395, 0.349660525071563, 0.603728944560356, "facGenderm:contcor2",
+ 0.460111189902261, 0.451422215260858, "", 0.996071584978056,
+ "facGenderm:contcor2", 0.0670810579692373, 217))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(82, -0.191836125702442, 1.31951490045017, 16, 0, "m", "facGender",
- "contNormal", "", 0.661129746218312, 0.74598490864103, "",
- "", 0.999379590166104, 0.397608627962179, 108, 82, -0.613745810348523,
- 1.13756628363991, 16, 1, "m", "facGender", "contNormal", "",
- 0.357047863774022, 0.409525666882302, "", "", 1.01790895890798,
- 0.430614590721088, 93, 68, 0.104520045593472, 1.18214495302642,
- 50, 0, "m", "facGender", "contNormal", "", 0.654934676882882,
- 0.651507492414831, "", "", 1.00073147515725, 0.306386527082308,
- 81, 56, -0.312870269016481, 0.930269997361262, 50, 1, "m", "facGender",
- "contNormal", "", 0.350852794438591, 0.35963786533413, "",
- "", 1.0295821860891, 0.316432847153676, 59, 90, -0.145085319879829,
- 1.36648244092637, 84, 0, "m", "facGender", "contNormal", "",
- 0.647664462418602, 0.661647805531622, "", "", 1.00405579454645,
- 0.387840630327321, 102, 75, -0.320494717591706, 1.10518419990617,
- 84, 1, "m", "facGender", "contNormal", "", 0.343582579974312,
- 0.337399494104808, "", "", 1.01366577418057, 0.363235268966721,
- 117, 190, -0.100902195386793, 0.0917273447998423, 16, 0, "m",
- "facGender", "debCollin1", "contNormal", 0.00247852066106476,
- 0.000461474422860513, "", "", 1.00026753369468,
- 0.0422701843525073, 145, 103, -0.0734561675777281, 0.0564178659853693,
- 16, 1, "m", "facGender", "debCollin1", "contNormal", -0.00160124181811128,
- 1.03694380666496e-05, "", "", 1.00876392994231,
- 0.0340394917246542, 118, 155, -0.0636113280841656, 0.0568520924972602,
- 50, 0, "m", "facGender", "debCollin1", "contNormal", 0.00209727580305588,
- 0.000549597896622437, "", "", 1.00567411894243,
- 0.0330735749449848, 94, 41, -0.0657159093276131, 0.0661405975998291,
- 50, 1, "m", "facGender", "debCollin1", "contNormal", -0.00198248667612016,
- -0.00116715289576816, "", "", 1.01840640417775,
- 0.030053236012331, 105, 145, -0.060057750909041, 0.0724825398666654,
- 84, 0, "m", "facGender", "debCollin1", "contNormal", 0.00164986646329655,
- 0.00048152542233328, "", "", 1.0175038857377,
- 0.0359073032827735, 101, 45, -0.0814934104513791, 0.0868307230719548,
- 84, 1, "m", "facGender", "debCollin1", "contNormal", -0.00242989601587949,
- -0.0017083505464987, "", "", 1.00657567880362,
- 0.0401497233256559, 97))
+ list(82, -0.191878509430502, 1.31950241083847, 16, 0, "m", "facGender",
+ "contNormal", "", 0.661129000597408, 0.745963207692577, "",
+ "", 0.999644808365157, 0.397608139135071, 108, 82, -0.6137955935246,
+ 1.13756509890899, 16, 1, "m", "facGender", "contNormal", "",
+ 0.35704471235644, 0.409527460839267, "", "", 1.01727448178858,
+ 0.430615482316083, 93, 68, 0.104571490792747, 1.18212502295418,
+ 50, 0, "m", "facGender", "contNormal", "", 0.654936068206708,
+ 0.651499411693291, "", "", 1.00073147515725, 0.306386402756289,
+ 81, 56, -0.312852470648349, 0.930260090415481, 50, 1, "m", "facGender",
+ "contNormal", "", 0.35085177996574, 0.359622278835557, "",
+ "", 1.0295821860891, 0.316432667623736, 59, 90, -0.14505066809368,
+ 1.36648323814686, 84, 0, "m", "facGender", "contNormal", "",
+ 0.647668361550759, 0.66165011356623, "", "", 1.00405579454645,
+ 0.387842007986826, 102, 75, -0.320513621313083, 1.10517781655838,
+ 84, 1, "m", "facGender", "contNormal", "", 0.343584073309791,
+ 0.337412126092534, "", "", 1.01357643247615, 0.363234759577075,
+ 117, 190, -0.100973511231866, 0.0917749263102377, 16, 0, "m",
+ "facGender", "debCollin1", "contNormal", 0.0024809976757283,
+ 0.000461914745579604, "", "", 1.00007594448556,
+ 0.0422727972660215, 145, 103, -0.0735002446589368, 0.056454930949015,
+ 16, 1, "m", "facGender", "debCollin1", "contNormal", -0.00159999841398309,
+ 1.03669785213736e-05, "", "", 1.00880353525171,
+ 0.0340419468435645, 118, 155, -0.063663485763366, 0.0568838351629101,
+ 50, 0, "m", "facGender", "debCollin1", "contNormal", 0.00209908132496837,
+ 0.00054942066906401, "", "", 1.00564647863681,
+ 0.0330779069551802, 94, 41, -0.0657439165053475, 0.0661674542041897,
+ 50, 1, "m", "facGender", "debCollin1", "contNormal", -0.00198191476474302,
+ -0.0011645355185909, "", "", 1.01840509246632,
+ 0.0300532978225451, 105, 145, -0.0600653355047617, 0.0724974662861756,
+ 84, 0, "m", "facGender", "debCollin1", "contNormal", 0.00165088395588331,
+ 0.000481938396550926, "", "", 1.01861561732013,
+ 0.0359171495750646, 101, 45, -0.0816038804878075, 0.0867858935498839,
+ 84, 1, "m", "facGender", "debCollin1", "contNormal", -0.00243011213382809,
+ -0.00170736500312087, "", "", 1.00662460700973,
+ 0.0401516596930216, 97))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_pathCoefficientsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(68, 0.0922513675649501, 1.18070824597082, "facGenderm", 0.65467627847631,
- 0.647038377575234, "", "Normal(0,10)", 1.00083991268707,
- "contNormal", 0.305681356575256, 81, 20, -1.927376244171, 2.676207875817,
- "debCollin1", 0.197915193159127, 0.0900959335674483, "",
- "Normal(0,10)", 1.03093346778237, "contNormal", 1.18103112672184,
- 31, 62, -0.398775481981878, 0.784099684360749, "facExperimexperimental",
- 0.199476584204629, 0.202190793857861, "", "Normal(0,10)",
- 1.04710226686027, "contNormal", 0.287020467556949, 23, 43, -1.13738555797337,
- 0.617487815337192, "facGenderm:facExperimexperimental", -0.30408188244429,
- -0.311119008544788, "", "Normal(0,10)", 1.0290949412596,
- "contNormal", 0.434588939654575, 67, 114, -0.233737465506069,
- 0.40065215335306, "contcor2", 0.073710398751098, 0.0764923088233239,
- "", "Normal(0,10)", 0.998924286573345, "contNormal",
- 0.148065686967297, 104, 144, -0.474944752512803, 0.445426983443596,
- "facGenderm:contcor2", -0.0064924222756559, -0.0292401623094652,
- "", "Normal(0,10)", 1.00556342316609, "contNormal",
- 0.238324629494883, 119, 186, -0.0447366513330847, 0.0539675369854098,
- "facGenderm", 0.00602750096722916, 0.00740713060813046, "",
- "Normal(0,10)", 0.999723913542977, "debCollin1", 0.0247685759104635,
- 154, 192, -0.0498776185641672, 0.0470204079493371, "facExperimexperimental",
- -0.00374255540720738, -0.00503306827464118, "", "Normal(0,10)",
- 0.99588845831576, "debCollin1", 0.0249627400236845, 148, 202,
- -0.0918377222228258, 0.0398309215289809, "facGenderm:facExperimexperimental",
- -0.0226274551589106, -0.0214300684154702, "", "Normal(0,10)",
- 1.01968183524231, "debCollin1", 0.0362530026521001, 135, 198,
- -0.0160248863645047, 0.0223105168550628, "contcor2", 0.00383641507990415,
- 0.00423837674507292, "", "Normal(0,10)", 1.0970573759656,
- "debCollin1", 0.0109507948855639, 134, 223, -0.0397499158127657,
- 0.0258598454170336, "facGenderm:contcor2", -0.00522222294465848,
- -0.00510111391162145, "", "Normal(0,10)", 1.01065364347226,
- "debCollin1", 0.0166459636232476, 172))
+ list(68, 0.0923020191473048, 1.18068736559089, "facGenderm", 0.654677758932814,
+ 0.647037071780223, "", "Normal(0,10)", 1.00083991268707,
+ "contNormal", 0.305681274963444, 81, 20, -1.92741865532647,
+ 2.67623412817762, "debCollin1", 0.197912736730353, 0.0901154589433409,
+ "", "Normal(0,10)", 1.03093346778237, "contNormal",
+ 1.18104236201294, 31, 62, -0.398775131331559, 0.784115799044069,
+ "facExperimexperimental", 0.199476169129923, 0.202198624183788,
+ "", "Normal(0,10)", 1.04710226686027, "contNormal",
+ 0.287022741864475, 23, 43, -1.13738573224891, 0.617511080349004,
+ "facGenderm:facExperimexperimental", -0.304084288240968, -0.311144280061046,
+ "", "Normal(0,10)", 1.0290949412596, "contNormal",
+ 0.434590440653995, 67, 114, -0.233742269780831, 0.400651078863377,
+ "contcor2", 0.0737078857468107, 0.0764875502930769, "",
+ "Normal(0,10)", 0.998940240164328, "contNormal", 0.148065767032666,
+ 104, 144, -0.474958784498514, 0.445435146821907, "facGenderm:contcor2",
+ -0.00649018276116166, -0.0292368182303984, "", "Normal(0,10)",
+ 1.00550056967693, "contNormal", 0.238325332319973, 119, 186,
+ -0.0447484282553966, 0.0539926383669284, "facGenderm", 0.0060289240378107,
+ 0.00741865475570109, "", "Normal(0,10)", 0.999723913542977,
+ "debCollin1", 0.0247701780708921, 154, 192, -0.049878535458753,
+ 0.0470214713170861, "facExperimexperimental", -0.00374506456681068,
+ -0.00501383395028876, "", "Normal(0,10)", 0.996031939252042,
+ "debCollin1", 0.0249634692847362, 148, 203, -0.0918437859807034,
+ 0.0398462503468324, "facGenderm:facExperimexperimental", -0.0226288864610864,
+ -0.021419694548727, "", "Normal(0,10)", 1.0197400944043,
+ "debCollin1", 0.036251674320413, 135, 198, -0.0160124617640794,
+ 0.0223499710819246, "contcor2", 0.0038352197128212, 0.00428687041551302,
+ "", "Normal(0,10)", 1.09755280371502, "debCollin1",
+ 0.0109552647186332, 148, 222, -0.0397434047589209, 0.0258656567895738,
+ "facGenderm:contcor2", -0.00522520234609658, -0.00509339508179825,
+ "", "Normal(0,10)", 1.01019531575242, "debCollin1",
+ 0.0166477626895952, 172))
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(82, -0.178381582075549, 1.31990254479899, 16, 0, "m", "Total",
- "facGender", "contNormal", 0.663608266879377, 0.738494269200506,
- "", 0.997258046082294, 0.398232598315837, 120, 74,
- -0.618480493481946, 1.14953102693075, 16, 1, "m", "Total", "facGender",
- "contNormal", 0.355446621955911, 0.399579679773466, "",
- 1.01878778975416, 0.432947372874716, 93, 67, 0.0649759824159949,
- 1.17002261235334, 50, 0, "m", "Total", "facGender", "contNormal",
- 0.657031952685938, 0.664768471517875, "", 0.999824941393204,
- 0.308376545357745, 104, 47, -0.314206608739156, 0.918435296158521,
- 50, 1, "m", "Total", "facGender", "contNormal", 0.348870307762471,
- 0.356866141566677, "", 1.03428268925937, 0.315857621327769,
- 59, 87, -0.200224719373597, 1.36823944581218, 84, 0, "m", "Total",
- "facGender", "contNormal", 0.649314328881899, 0.649643899794557,
- "", 1.00279229154323, 0.392300264719387, 103, 78, -0.332832051730568,
- 1.12407108537852, 84, 1, "m", "Total", "facGender", "contNormal",
- 0.341152683958433, 0.314974650752946, "", 1.01611703985661,
- 0.360815759645416, 126, 190, -0.100902195386793, 0.0917273447998423,
- 16, 0, "m", "Total indirect", "facGender", "contNormal", 0.00247852066106476,
- 0.000461474422860513, "", 1.00026753369468, 0.0422701843525073,
- 145, 103, -0.0734561675777281, 0.0564178659853693, 16, 1, "m",
- "Total indirect", "facGender", "contNormal", -0.00160124181811128,
- 1.03694380666496e-05, "", 1.00876392994231, 0.0340394917246542,
- 118, 155, -0.0636113280841656, 0.0568520924972602, 50, 0, "m",
- "Total indirect", "facGender", "contNormal", 0.00209727580305588,
- 0.000549597896622437, "", 1.00567411894243, 0.0330735749449848,
- 94, 41, -0.0657159093276131, 0.0661405975998291, 50, 1, "m",
- "Total indirect", "facGender", "contNormal", -0.00198248667612016,
- -0.00116715289576816, "", 1.01840640417775, 0.030053236012331,
- 105, 145, -0.060057750909041, 0.0724825398666654, 84, 0, "m",
- "Total indirect", "facGender", "contNormal", 0.00164986646329655,
- 0.00048152542233328, "", 1.0175038857377, 0.0359073032827735,
- 101, 45, -0.0814934104513791, 0.0868307230719548, 84, 1, "m",
- "Total indirect", "facGender", "contNormal", -0.00242989601587949,
- -0.0017083505464987, "", 1.00657567880362, 0.0401497233256559,
+ list(82, -0.178476523387352, 1.31988973454839, 16, 0, "m", "Total",
+ "facGender", "contNormal", 0.663609998273136, 0.738456550933998,
+ "", 0.997258046082294, 0.39823270604726, 120, 74, -0.618545693759456,
+ 1.14952357705646, 16, 1, "m", "Total", "facGender", "contNormal",
+ 0.355444713942457, 0.399578237337209, "", 1.01897077469534,
+ 0.432945114136515, 93, 67, 0.0651103869588595, 1.17010501923259,
+ 50, 0, "m", "Total", "facGender", "contNormal", 0.657035149531676,
+ 0.664759169534624, "", 0.999824941393204, 0.308377217311972,
+ 104, 47, -0.314186463842191, 0.918437278136057, 50, 1, "m",
+ "Total", "facGender", "contNormal", 0.348869865200997, 0.356861175622985,
+ "", 1.03428268925937, 0.315854821655784, 59, 87, -0.200211312005056,
+ 1.36825527421257, 84, 0, "m", "Total", "facGender", "contNormal",
+ 0.649319245506642, 0.649658360958646, "