diff --git a/R/classicProcess.R b/R/classicProcess.R
index b34136a..78ad609 100644
--- a/R/classicProcess.R
+++ b/R/classicProcess.R
@@ -291,26 +291,34 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
igraph::E(graph)$isMod <- FALSE
# Which are moderation variables for each edge; NULL if none
+ igraph::E(graph)$modVars <- NA
+
for (i in 1:length(igraph::E(graph))) {
sourceNode <- igraph::V(graph)[igraph::E(graph)$source[i]]
if (sourceNode$isInt) {
sourceNodeIntVars <- unlist(sourceNode$intVars)
-
+
for (v in sourceNodeIntVars) {
# Set all edges from var interacting with sourceNode to target as isMod
igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$isMod <- TRUE
# Store unique moderating variables
- igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$modVars <- list(
- unique(c(
- igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$modVars[[1]],
- sourceNodeIntVars[sourceNodeIntVars != v]
- ))
- )
+ if (length(sourceNodeIntVars[sourceNodeIntVars != v]) > 0) {
+ if (any(is.na(igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$modVars))) {
+ igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$modVars <- sourceNodeIntVars[sourceNodeIntVars != v]
+ } else {
+ igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$modVars <- list(
+ unique(c(
+ igraph::E(graph)[source == v & target == igraph::E(graph)$target[i]]$modVars[[1]],
+ sourceNodeIntVars[sourceNodeIntVars != v]
+ ))
+ )
+ }
+ }
}
}
}
-
+
return(graph)
}
@@ -472,35 +480,69 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
contrastList[[f]] <- do.call(contrasts[[f]], list(levels(as.factor(dataset[[f]]))))
}
+ # We need to make a new graph, otherwise igraph messes up the order of nodes
+ facGraph <- igraph::make_empty_graph()
+
# Decode names to match with graph node names (FIXME)
names(contrastList) <- decodeColNames(names(contrastList))
+
+ # Split terms of predictor vars
+ sourcVarsSplit <- strsplit(unique(igraph::E(graph)$source), ":|__")
# Replace dummy-coded variables in graph
- for (v in names(contrastList)) {
- newNodeNames <- paste0(v, colnames(contrastList[[v]]))
-
- # If dummy coding needs additional variables add them as nodes with same edges to target variable
- if (length(newNodeNames) > 1) {
- graph <- igraph::add_vertices(graph, length(newNodeNames[-1]), name = newNodeNames[-1])
- graph <- igraph::add_edges(graph,
- edges = as.vector(rbind(newNodeNames[-1], igraph::E(graph)[.from(v)]$source)),
- source = newNodeNames[-1],
- target = igraph::E(graph)[.from(v)]$source
- )
+ # Goes through all source variables and replaces them with dummy coded variable names
+ # if necessary
+ for (vars in sourcVarsSplit) {
+ # Concatenate variable with factor levels from contrast list to get dummy variable name
+ contr <- lapply(vars, function(v) {
+ if (v %in% names(contrastList)) {
+ return(paste0(v, colnames(contrastList[[v]])))
+ } else {
+ return(v)
+ }
+ })
+
+ # Concatenate source var and interaction terms in dummy coded variable
+ if (length(vars) < 3) {
+ contr <- .doCallPaste(contr, sep = ":")
+ sourceName <- paste(vars, collapse = ":")
+ } else {
+ contr <- .doCallPaste(contr, sep = "__")
+ sourceName <- paste(vars, collapse = "__")
}
-
- # Update graph attributes with dummy variables
- igraph::V(graph)$name <- gsub(v, newNodeNames[1], igraph::V(graph)$name)
- igraph::V(graph)$intVars <- sapply(igraph::V(graph)$intVars, function(x) if (!is.null(x)) gsub(v, newNodeNames[1], x)) # Returns a list!
- igraph::E(graph)$source <- gsub(v, newNodeNames[1], igraph::E(graph)$source)
- igraph::E(graph)$target <- gsub(v, newNodeNames[1], igraph::E(graph)$target)
- if (!is.null(igraph::E(graph)$modVars)) {
- igraph::E(graph)$modVars <- sapply(igraph::E(graph)$modVars, function(x) if (!is.null(x)) gsub(v, newNodeNames[1], x)) # Returns a list!
+
+ # Add nodes for source variables not in graph
+ contrNotInGraph <- contr[!contr %in% igraph::V(facGraph)$name]
+
+ if (length(contrNotInGraph) > 0) {
+ facGraph <- igraph::add_vertices(facGraph, length(contrNotInGraph), name = contrNotInGraph)
+ }
+
+ # Get target variable
+ target <- igraph::E(graph)[.from(sourceName)]$target
+
+ # Add nodes for targets not in graph
+ targetNotInGraph <- target[!target %in% igraph::V(facGraph)$name]
+
+ if (length(targetNotInGraph) > 0) {
+ facGraph <- igraph::add_vertices(facGraph, length(targetNotInGraph), name = targetNotInGraph)
+ }
+
+ # Add edges between source and target variables
+ for (t in target) {
+ facGraph <- igraph::add_edges(facGraph,
+ edges = as.vector(rbind(contr, t)),
+ source = contr,
+ target = t
+ )
}
}
-
+
+ # Add attributes to graph
+ facGraph <- .procGraphAddAttributes(facGraph)
+
modelsContainer[[modelName]][["contrasts"]] <- createJaspState(contrastList)
- modelsContainer[[modelName]][["graph"]]$object <- graph
+ modelsContainer[[modelName]][["graph"]]$object <- facGraph
}
return(dataset)
@@ -563,7 +605,7 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
),
exitAnalysisIfErrors = TRUE
)
- if (length(options[["covariates"]]) > 0) {
+ if (length(options[["covariates"]]) > 1) {
.hasErrors(dataset, "run",
type = "varCovData",
varCovData.target = options[["covariates"]],
@@ -766,101 +808,165 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
return(paste(regLines, collapse = "\n"))
}
-.procMedEffectsSyntax <- function(graph, modProbs, contrasts) {
- # Get all simple paths from X to Y
- medPaths <- igraph::all_simple_paths(graph,
- from = igraph::V(graph)[isTreat]$name,
- to = igraph::V(graph)[isDep]$name,
- mode = "out"
- )
+.procMedEffectsSyntaxModPars <- function(pathEdge, sourceNode, graph, modProbes) {
+ # Get moderator parameters for two-way interactions
+ modPars <- lapply(pathEdge$modVars[[1]], function(v) {
+ # Get edge for two way interaction between X and M
+ twoWayEdge <- igraph::E(graph)[paste(sourceNode, v, sep = ":") %--% pathEdge$target]$parName
+
+ # Concatenate two way edge parName with moderator probes
+ return(apply(expand.grid(
+ twoWayEdge,
+ format(modProbes[[v]], digits = 3)
+ ), 1, paste, collapse = "*"))
+ })
- medEffects <- lapply(medPaths, function(path) {
- # Left hand side of lavaan syntax
- lhs <- paste(names(path), collapse = "__")
-
- # Get moderators on path
- modName <- unlist(Filter(Negate(is.null), sapply(2:length(path), function(i) {
- return(igraph::E(graph)[.from(names(path)[i-1]) & .to(names(path)[i])]$modVars)
- })))
-
- # Right hand side of lavaan syntax
- rhs <- lapply(2:length(path), function(i) {
- # Get edge from path[-1] to path[i]
- pathEdge <- igraph::E(graph)[.from(names(path)[i-1]) & .to(names(path)[i])]
+ # Get all possible combinations of probes from different moderators
+ modPars <- apply(expand.grid(modPars), 1, paste, collapse = "+")
+
+ # Get name of potential three-way interaction
+ threeWayInt <- paste(c(pathEdge$source, pathEdge$modVars[[1]]), collapse = "__")
+
+ if (threeWayInt %in% igraph::E(graph)$source) { # If three-way int
+ # Get edge of three way interaction X x M1 x M2
+ threeWayEdge <- igraph::E(graph)[threeWayInt %--% pathEdge$target]
+ # Combine three way int parName with moderator probes
+ threeWayModPars <- paste(
+ threeWayEdge$parName,
+ apply(
+ expand.grid(lapply(pathEdge$modVars[[1]], function(v) format(modProbes[[v]], digits = 3))),
+ 1, paste, collapse = "*"
+ ),
+ sep = "*"
+ )
+ # Add to previous moderator probes
+ modPars <- paste(modPars, threeWayModPars, sep = "+")
+ }
+ return(modPars)
+}
- # If no moderators on edge, return only parName
- if(is.null(pathEdge$modVars[[1]])) return(pathEdge$parName)
-
- modPars <- lapply(pathEdge$modVars[[1]], function(v) { # If moderators
- # Get edge for two way interaction between X and M
- twoWayEdge <- igraph::E(graph)[
- .from(paste(names(path)[i-1], v, sep = ":")) &
- .to(names(path)[i])
- ]$parName
-
- # Concatenate two way edge parName with moderator probes
- return(paste(
- twoWayEdge,
- format(modProbs[[v]], digits = 3),
- sep = "*"
- ))
- })
- # Get all possible combinations of probes from different moderators
- modPars <- apply(expand.grid(modPars), 1, paste, collapse = "+")
-
- # Get name of potential three-way interaction
- threeWayInt <- paste(c(pathEdge$source, pathEdge$modVars[[1]]), collapse = "__")
-
- if (threeWayInt %in% igraph::E(graph)$source) { # If three-way int
- # Get edge of three way interaction X x M1 x M2
- threeWayEdge <- igraph::E(graph)[.from(threeWayInt) & .to(names(path)[i])]
- # Combine three way int parName with moderator probes
- threeWayModPars <- paste(
- threeWayEdge$parName,
- apply(
- expand.grid(lapply(pathEdge$modVars[[1]], function(v) format(modProbs[[v]], digits = 3))),
- 1, paste, collapse = "*"
- ),
- sep = "*"
- )
- # Add to previous moderator probes
- modPars <- paste(modPars, threeWayModPars, sep = "+")
- }
-
- # If indirect path add parentheses
- if (i > 1) {
- return(paste0("(", pathEdge$parName, " + ", modPars, ")"))
- }
- # Concanenate path edge parName with moderator probes
- return(paste(pathEdge$parName, modPars, sep = " + "))
+.procContrFacVars <- function(contrasts) {
+ # Concatenate factor names with levels
+ return(lapply(names(contrasts), function(contr) paste0(contr, colnames(contrasts[[contr]]))))
+}
+
+.procMedEffectsSyntaxGetLhs <- function(path, graph, modProbes, contrasts) {
+ # Get factor names with level names
+ contrFacVars <- .procContrFacVars(contrasts)
+ # Is source node a factor with contrast
+ sourceInContrFacVars <- sapply(contrFacVars, function(v) names(path)[1] %in% v)
+
+ if (any(sourceInContrFacVars)) {
+ # Replace factor in lhs with factor with level names appended
+ facContr <- names(contrasts)[sourceInContrFacVars]
+ facContrLevels <- paste(facContr, colnames(contrasts[[facContr]]), sep = "__")
+ lhs <- paste(c(facContr, names(path)[-1]), collapse = "__")
+ lhs <- apply(expand.grid(lhs, facContrLevels), 1, paste, collapse = ".")
+ } else {
+ # Just concatenate path vars to lhs
+ lhs <- paste(names(path), collapse = "__")
+ }
+
+ # Get moderators on path
+ modsOnPath <- unique(na.omit(unlist(sapply(2:length(path), function(i) {
+ return(igraph::E(graph)[names(path)[i-1] %--% names(path)[i]]$modVars)
+ }))))
+
+ if (!is.null(modsOnPath) && length(modsOnPath) > 0) { # If path is moderated
+ # Get combinations of moderators
+ modsOnPath <- lapply(modsOnPath, function(v) {
+ return(apply(
+ expand.grid(v, gsub("\\%", "", names(modProbes[[v]]))), # Remove `%` from quantile name strings
+ 1, paste, collapse = "__"
+ ))
})
- # If indirect paths, multiply their steps
- rhs <- .doCallPaste(rhs, sep = "*")
-
- if (!is.null(modName) && length(modName) > 0) { # If path is moderated
- # Get combinations of moderators
- modName <- lapply(modName, function(v) {
- return(apply(
- expand.grid(v, gsub("\\%", "", names(modProbs[[v]]))), # Remove `%` from quantile name strings
- 1, paste, collapse = "__"
- ))
- })
- # Add moderator combinations to left hand side
- lhs <- apply(expand.grid(lhs, apply(expand.grid(modName), 1, paste, collapse = ".")), 1, paste, collapse = ".")
+ # Add moderator combinations to left hand side
+ lhs <- apply(expand.grid(lhs, apply(expand.grid(modsOnPath), 1, paste, collapse = ".")), 1, paste, collapse = ".")
+ }
+
+ return(lhs)
+}
+
+.procMedEffectsSyntaxGetRhs <- function(path, graph, modProbes, contrasts) {
+ # Get factor names with level names
+ contrFacVars <- .procContrFacVars(contrasts)
+ # Is source node a factor with contrast
+ sourceInContrFacVars <- sapply(contrFacVars, function(v) names(path)[1] %in% v)
+
+ if (any(sourceInContrFacVars)) {
+ sourceFacVars <- contrFacVars[[which(sourceInContrFacVars)]]
+ } else {
+ sourceFacVars <- numeric(0)
+ }
+
+ # Right hand side of lavaan syntax
+ rhs <- lapply(2:length(path), function(i) {
+ # Get edge from path[-1] to path[i]
+ if (any(sourceInContrFacVars) && names(path)[i-1] %in% sourceFacVars) {
+ # Get all vars with factor levels as source nodes
+ sourceNode <- sourceFacVars
+ } else {
+ # Just get previous node as source node
+ sourceNode <- names(path)[i-1]
}
- return(list(lhs = lhs, rhs = rhs, modName = modName))
+ # Edge from previous node to current node
+ pathEdge <- igraph::E(graph)[sourceNode %--% names(path)[i]]
+
+ # If no moderators on edge, return only parName
+ if(any(is.na(unlist(pathEdge$modVars)))) return(pathEdge$parName)
+
+ # Get pars from moderators
+ modPars <- .procMedEffectsSyntaxModPars(pathEdge, sourceNode, graph, modProbes)
+
+ # If indirect path add parentheses
+ if (i > 1) {
+ return(paste0("(", pathEdge$parName, " + ", modPars, ")"))
+ }
+ # Concanenate path edge parName with moderator probes
+ return(paste(pathEdge$parName, modPars, sep = " + "))
})
+
+ # If indirect paths, multiply their steps
+ rhs <- .doCallPaste(rhs, sep = "*")
+
+ return(rhs)
+}
+
+.procMedEffectsSyntaxSinglePath <- function(path, graph, modProbes, contrasts) {
+ # Right hand side of lavaan syntax
+ rhs <- .procMedEffectsSyntaxGetRhs(path, graph, modProbes, contrasts)
+
+ # Left hand side of lavaan syntax
+ lhs <- .procMedEffectsSyntaxGetLhs(path, graph, modProbes, contrasts)
+
+ return(list(lhs = lhs, rhs = rhs))
+}
+
+.procMedEffectsSyntax <- function(graph, modProbes, contrasts) {
+ # Get all simple paths from X to Y
+ medPaths <- igraph::all_simple_paths(graph,
+ from = igraph::V(graph)[isTreat]$name,
+ to = igraph::V(graph)[isDep]$name,
+ mode = "out"
+ )
+ # Get lhs and rhs plus moderator names for each path
+ medEffects <- lapply(medPaths, .procMedEffectsSyntaxSinglePath, graph = graph, modProbes = modProbes, contrasts = contrasts)
+ # Sort effects according to path length to preserve order
+ medEffects <- medEffects[sort.int(sapply(medPaths, length), index.return = TRUE)$ix]
# All rhs effects
totRhs <- lapply(medEffects, function(path) path$rhs)
- # All moderators of total effects
- totLhsMods <- lapply(medEffects, function(path) apply(expand.grid(path$modName), 1, paste, collapse = "."))
# Add rhs effects
totEffects <- .doCallPaste(totRhs, sep = " + ")
# Concatenate rhs and lhs effects
medEffectsLabeled <- unlist(lapply(medEffects, function(path) paste(path$lhs, path$rhs, sep = " := ")))
+ # Get conditional effect labels from lhs of each path
+ totEffectsConditional <- Filter(function(x) !is.null(x) & all(x != ""), lapply(medEffects, function(path) {
+ # Split lhs and remove first chunk, then paste together again
+ return(sapply(strsplit(path$lhs, "\\."), function(path) paste(path[-1], collapse = ".")))
+ }))
# Concatenate total effects
- totEffectsLabeled <- paste(paste("tot", unlist(totLhsMods), sep = "."), totEffects, sep = " := ")
+ totEffectsLabeled <- paste(paste0("tot.", unlist(totEffectsConditional)), totEffects, sep = " := ")
# Only return total effects when no indirect path
if (length(medEffects) < 2) {
return(paste(c(medEffectsLabeled, totEffectsLabeled), collapse = "\n"))
@@ -868,7 +974,7 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
# Add rhs indirect effects
totIndEffects <- .doCallPaste(totRhs[-1], sep = " + ")
# Concatenate indirect effects
- totIndEffectsLabeled <- paste(paste("totInd", unlist(totLhsMods[-1]), sep = "."), totIndEffects, sep = " := ")
+ totIndEffectsLabeled <- paste(paste("totInd", unlist(totEffectsConditional[-1]), sep = "."), totIndEffects, sep = " := ")
return(paste(c(medEffectsLabeled, totEffectsLabeled, totIndEffectsLabeled), collapse = "\n"))
}
diff --git a/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-facthree-int-factwo.svg b/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-facthree-int-factwo.svg
new file mode 100644
index 0000000..4e534d1
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-facthree-int-factwo.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-facthree.svg b/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-facthree.svg
new file mode 100644
index 0000000..d655a1f
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-facthree.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-factwo-int-facthree.svg b/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-factwo-int-facthree.svg
new file mode 100644
index 0000000..4b38641
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/conceptual-path-plot-factwo-int-facthree.svg
@@ -0,0 +1,59 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-facthree-int-factwo.svg b/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-facthree-int-factwo.svg
new file mode 100644
index 0000000..aacfcd9
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-facthree-int-factwo.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-facthree.svg b/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-facthree.svg
new file mode 100644
index 0000000..c433fba
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-facthree.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-factwo-int-facthree.svg b/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-factwo-int-facthree.svg
new file mode 100644
index 0000000..42c6909
--- /dev/null
+++ b/tests/testthat/_snaps/classic-process-integration-general/statistical-path-plot-factwo-int-facthree.svg
@@ -0,0 +1,91 @@
+
+
diff --git a/tests/testthat/test-classic-process-integration-custom-models.R b/tests/testthat/test-classic-process-integration-custom-models.R
index 9247487..b231bee 100644
--- a/tests/testthat/test-classic-process-integration-custom-models.R
+++ b/tests/testthat/test-classic-process-integration-custom-models.R
@@ -2,7 +2,7 @@
test_that("Test that model number one_confounder - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -13,19 +13,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "contcor1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "contcor1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -77,9 +77,9 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.0338982352403213, 0.370786700700972, 0.168444232730325, "Total",
- 0.102761008338914, 0.10323785006597, 1.63161314016795, -0.0420059521826613,
- 0.367482204548676, 0.162738126183007, "Total indirect", 0.11926845840203,
- 0.1044631840078, 1.55785148355095))
+ 0.102761008338914, 0.10323785006597, 1.63161314016795, -0.027115002941041,
+ 0.0385272160356765, 0.00570610654731776, "Total indirect", 0.733292476299653,
+ 0.0167457717321581, 0.34074909407489))
@@ -95,7 +95,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number one_confounder - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -106,19 +106,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "facExperim")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "facExperim")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -147,10 +147,10 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.329844405685614, 0.496024877188678, 0.0830902357515322, "facExperimexperimental",
- "contNormal", "", "", "", 0.693299245993837, 0.210684810891589,
- 0.394381708865987, -0.0500653809891558, 0.0303840547660915,
- -0.00984066311153218, "facExperimexperimental", "contGamma",
+ list(-0.329844405685614, 0.496024877188678, 0.0830902357515322, "experimental",
+ "facExperim", "contNormal", "", "", "", 0.693299245993837,
+ 0.210684810891589, 0.394381708865987, -0.0500653809891558, 0.0303840547660915,
+ -0.00984066311153218, "experimental", "facExperim", "contGamma",
"contNormal", "", "", 0.63159016355888, 0.0205231923621613,
-0.479489883341709))
@@ -170,10 +170,13 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.339311551617825, 0.485810696897825, 0.07324957264, "Total",
- 0.727848824673947, 0.210494237400306, 0.347988493864076, -0.329844405685614,
- 0.496024877188678, 0.0830902357515322, "Total indirect", 0.693299245993837,
- 0.210684810891589, 0.394381708865987))
+ list(-0.339311551617825, 0.485810696897825, 0.07324957264, "experimental",
+ "Total", 0.727848824673947, 0.210494237400306, 0.347988493864076,
+ -0.339311551617825, 0.485810696897825, 0.07324957264, "experimental",
+ "Total", 0.727848824673947, 0.210494237400306, 0.347988493864076,
+ -0.0500653809891558, 0.0303840547660915, -0.00984066311153218,
+ "experimental", "Total indirect", 0.63159016355888, 0.0205231923621613,
+ -0.479489883341709))
@@ -189,7 +192,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number one_direct - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -200,19 +203,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "directs",
- processVariable = "")), residualCovariances = TRUE, statisticalPathPlot = TRUE,
- totalEffects = TRUE, localTests = FALSE, localTestType = "cis",
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "directs",
+ processVariable = "")), residualCovariances = TRUE, statisticalPathPlot = TRUE,
+ totalEffects = TRUE, localTests = FALSE, localTestType = "cis",
localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -271,7 +274,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number one_direct - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -282,19 +285,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "directs",
- processVariable = "")), residualCovariances = TRUE, statisticalPathPlot = TRUE,
- totalEffects = TRUE, localTests = FALSE, localTestType = "cis",
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "directs",
+ processVariable = "")), residualCovariances = TRUE, statisticalPathPlot = TRUE,
+ totalEffects = TRUE, localTests = FALSE, localTestType = "cis",
localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -353,7 +356,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number two_confounder - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -364,21 +367,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "contcor1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "contcor1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -438,9 +441,9 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.00931723446549082, 0.524832920777229, 0.257757843155869, "Total",
- 0.0585458573430464, 0.136265298611614, 1.89158828977093, -0.0183967830162192,
- 0.521461905534409, 0.251532561259095, "Total indirect", 0.067792370251071,
- 0.137721583868113, 1.8263844649069))
+ 0.0585458573430464, 0.136265298611614, 1.89158828977093, -0.0345845435803312,
+ 0.0470351073738792, 0.00622528189677404, "Total indirect", 0.7649551805981,
+ 0.0208217221331657, 0.298980163934575))
@@ -456,7 +459,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number two_confounder - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -467,21 +470,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "facExperim"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "facGender")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "facExperim"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "facGender")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -514,12 +517,12 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.397396510584462, 0.416025502052742, 0.0093144957341401, "facExperimexperimental",
- "contNormal", "", "", "", 0.964197302009531, 0.207509428503119,
- 0.0448870964627041, -0.0543727189027194, 0.0333398342079703,
- -0.0105164423473746, "facExperimexperimental", "contGamma",
- "contNormal", "", "", 0.63836482029219, 0.0223760624691461,
- -0.469986279394574))
+ list(-0.397396510584462, 0.416025502052742, 0.0093144957341401, "experimental",
+ "facExperim", "contNormal", "", "", "", 0.964197302009531,
+ 0.207509428503119, 0.0448870964627041, -0.0543727189027194,
+ 0.0333398342079703, -0.0105164423473746, "experimental", "facExperim",
+ "contGamma", "contNormal", "", "", 0.63836482029219,
+ 0.0223760624691461, -0.469986279394574))
@@ -542,10 +545,13 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.409075392315575, 0.406671499089106, -0.00120194661323445, "Total",
- 0.995391649700707, 0.208102520719562, -0.005775742692008, -0.397396510584462,
- 0.416025502052742, 0.0093144957341401, "Total indirect", 0.964197302009531,
- 0.207509428503119, 0.0448870964627041))
+ list(-0.409075392315575, 0.406671499089106, -0.00120194661323445, "experimental",
+ "Total", 0.995391649700707, 0.208102520719562, -0.005775742692008,
+ -0.409075392315575, 0.406671499089106, -0.00120194661323445,
+ "experimental", "Total", 0.995391649700707, 0.208102520719562,
+ -0.005775742692008, -0.0543727189027194, 0.0333398342079703,
+ -0.0105164423473746, "experimental", "Total indirect", 0.63836482029219,
+ 0.0223760624691461, -0.469986279394574))
@@ -561,7 +567,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_X_Y - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -572,21 +578,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -651,9 +657,9 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.172816800526246, 0.240148499061018, 0.0336658492673863, "Total",
- 0.749300959047747, 0.105350226546172, 0.319561242259233, -0.17738968874516,
- 0.235906781207678, 0.0292585462312589, "Total indirect", 0.78139319035638,
- 0.105434710334697, 0.277503927675992))
+ 0.749300959047747, 0.105350226546172, 0.319561242259233, -0.0179628726375066,
+ 0.0242572794460163, 0.00314720340425485, "Total indirect", 0.770132222942081,
+ 0.0107706448732094, 0.292201947172458))
@@ -669,7 +675,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_X_Y - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -680,21 +686,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "facGender")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "facGender")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -727,13 +733,13 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0859003151554296, 0.895699802278834, 0.490800058717132, "facGenderm",
- "contNormal", "", "", "", "", "", 0.0175121668886125,
+ list(0.0859003151554296, 0.895699802278834, 0.490800058717132, "m",
+ "facGender", "contNormal", "", "", "", "", "", 0.0175121668886125,
0.206585297870522, 2.37577438363858, -0.0953627168761149, 0.0411095548346247,
- -0.0271265810207451, "facGenderm", "contGamma", "contNormal",
+ -0.0271265810207451, "m", "facGender", "contGamma", "contNormal",
"", "", "", "", 0.435883275295673, 0.0348149947619486,
-0.779163725464449, -0.0210117568450086, 0.0239241658212091,
- 0.00145620448810027, "facGenderm", "contGamma", "debCollin1",
+ 0.00145620448810027, "m", "facGender", "contGamma", "debCollin1",
"contNormal", "", "", "", 0.898916540794359,
0.0114634562218149, 0.127030143433454))
@@ -758,10 +764,17 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0625107971036305, 0.867748567265343, 0.465129682184487, "Total",
- 0.0235575803680084, 0.205421573180254, 2.264268912868, 0.0874078079953342,
- 0.89710471841513, 0.492256263205232, "Total indirect", 0.0171663559416233,
- 0.206559129863248, 2.3831251783987))
+ list(0.0625107971036305, 0.867748567265343, 0.465129682184487, "m",
+ "Total", 0.0235575803680084, 0.205421573180254, 2.264268912868,
+ 0.0625107971036305, 0.867748567265343, 0.465129682184487, "m",
+ "Total", 0.0235575803680084, 0.205421573180254, 2.264268912868,
+ 0.0625107971036305, 0.867748567265343, 0.465129682184487, "m",
+ "Total", 0.0235575803680084, 0.205421573180254, 2.264268912868,
+ -0.0941334753506578, 0.0427927222853681, -0.0256703765326449,
+ "m", "Total indirect", 0.462405005295899, 0.0349307943197126,
+ -0.734892436103528, -0.0941334753506578, 0.0427927222853681,
+ -0.0256703765326449, "m", "Total indirect", 0.462405005295899,
+ 0.0349307943197126, -0.734892436103528))
@@ -777,7 +790,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_X_M - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -788,21 +801,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -887,7 +900,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_X_M - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -898,21 +911,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "facGender")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "facGender")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -943,13 +956,14 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.0812046417471832, 0.0448619220894113, -0.018171359828886, "facGenderm",
- "contGamma", "contNormal", "", "", "", "",
- 0.572058586763452, 0.0321604286688407, -0.565022314099054, "",
- "", 0.00130342699162342, "facGenderm", "debCollin1", "contNormal",
- "", "", "", "", "", "", "", "", "", 0.000970569137243933,
- "facGenderm", "contGamma", "debCollin1", "contNormal", "",
- "", "", "", "", ""))
+ list(-0.0812046417471832, 0.0448619220894113, -0.018171359828886, "m",
+ "facGender", "contGamma", "contNormal", "", "", "",
+ "", 0.572058586763452, 0.0321604286688407, -0.565022314099054,
+ "", "", 0.00130342699162342, "m", "facGender", "debCollin1",
+ "contNormal", "", "", "", "", "", "", "",
+ "", "", 0.000970569137243933, "m", "facGender", "contGamma",
+ "debCollin1", "contNormal", "", "", "",
+ "", "", ""))
@@ -970,10 +984,17 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.079416444198823, 0.0476217167987858, -0.0158973637000186, "Total",
- 0.623756169473329, 0.0324082896419704, -0.490533868823201, -0.0216391957105213,
- 0.0261871879682561, 0.00227399612886735, "Total indirect", 0.852146453356244,
- 0.0122008322744769, 0.18638041059087))
+ list(-0.079416444198823, 0.0476217167987858, -0.0158973637000186, "m",
+ "Total", 0.623756169473329, 0.0324082896419704, -0.490533868823201,
+ -0.079416444198823, 0.0476217167987858, -0.0158973637000186,
+ "m", "Total", 0.623756169473329, 0.0324082896419704, -0.490533868823201,
+ -0.079416444198823, 0.0476217167987858, -0.0158973637000186,
+ "m", "Total", 0.623756169473329, 0.0324082896419704, -0.490533868823201,
+ -0.0216391957105213, 0.0261871879682561, 0.00227399612886735,
+ "m", "Total indirect", 0.852146453356244, 0.0122008322744769,
+ 0.18638041059087, -0.0216391957105213, 0.0261871879682561, 0.00227399612886735,
+ "m", "Total indirect", 0.852146453356244, 0.0122008322744769,
+ 0.18638041059087))
@@ -989,7 +1010,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_M_Y - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1000,21 +1021,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "contNormal",
- processIndependent = "debCollin1", processType = "confounders",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "contNormal",
+ processIndependent = "debCollin1", processType = "confounders",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1094,7 +1115,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_M_Y - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1105,21 +1126,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "contNormal",
- processIndependent = "debCollin1", processType = "confounders",
- processVariable = "facGender")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "contNormal",
+ processIndependent = "debCollin1", processType = "confounders",
+ processVariable = "facGender")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1198,7 +1219,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_moderator - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1209,21 +1230,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1258,16 +1279,16 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(-0.396528663809054, 0.156057671983207, 16, -0.120235495912924,
+ list(-0.396528663809054, 0.156057671983207, "", -0.120235495912924,
"contcor2", "contNormal", "", "", "", 0.393701114822503,
0.140968492316949, -0.85292460702914, -0.0206079744902215, 0.0187008168621928,
- 50, -0.00095357881401436, "contcor2", "contGamma", "contNormal",
+ 16, -0.00095357881401436, "contcor2", "contGamma", "contNormal",
"", "", 0.924241577037212, 0.0100279371617226,
-0.0950922207265357, -0.0132920341139206, 0.0180760774799312,
- 84, 0.00239202168300531, "contcor2", "contGamma", "contNormal",
+ 50, 0.00239202168300531, "contcor2", "contGamma", "contNormal",
"", "", 0.765001164933273, 0.00800221632674874,
0.298919897355134, -0.0215739037623553, 0.0336605425836526,
- "", 0.00604331941064863, "contcor2", "contGamma", "contNormal",
+ 84, 0.00604331941064863, "contcor2", "contGamma", "contNormal",
"", "", 0.668004923764089, 0.014090678905758,
0.428887738558792))
@@ -1298,8 +1319,13 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
"Total", 0.405319255104091, 0.14161174406949, -0.832158907470919,
-0.396174412496076, 0.167790059491526, 84, -0.114192176502275,
"Total", 0.427363383697888, 0.143871131417741, -0.79371153460043,
- -0.396528663809054, 0.156057671983207, -0.120235495912924, "Total indirect",
- 0.393701114822503, 0.140968492316949, -0.85292460702914))
+ -0.0215739037623553, 0.0336605425836526, 0.00604331941064863,
+ "Total indirect", 0.668004923764089, 0.014090678905758, 0.428887738558792,
+ -0.0215739037623553, 0.0336605425836526, 0.00604331941064863,
+ "Total indirect", 0.668004923764089, 0.014090678905758, 0.428887738558792,
+ -0.0215739037623553, 0.0336605425836526, 0.00604331941064863,
+ "Total indirect", 0.668004923764089, 0.014090678905758, 0.428887738558792
+ ))
@@ -1315,7 +1341,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number confounder_moderator - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1326,21 +1352,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "confounders",
- processVariable = "facGender")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "confounders",
+ processVariable = "facGender")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1376,14 +1402,15 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.108832957868417, 0.914012147270688, 0.511422552569552, 0, "facGenderm",
- "contNormal", "", "", "", 0.0127813022805476, 0.205406628834362,
- 2.48980549202216, -0.198988505343462, 0.0527669505225173, -0.0731107774104725,
- 1, "facGenderm", "contGamma", "contNormal", "", "",
- 0.254969127608045, 0.0642245107185118, -1.1383625440279, -0.0618215513880583,
- 0.132974655309278, 0.0355765519606098, "", "facGenderm", "contGamma",
- "contNormal", "", "", 0.474043852370205, 0.0496938230074287,
- 0.715914973080085))
+ list(0.108832957868417, 0.914012147270688, 0.511422552569552, "", "m",
+ "facGender", "contNormal", "", "", "", 0.0127813022805476,
+ 0.205406628834362, 2.48980549202216, -0.198988505343462, 0.0527669505225173,
+ -0.0731107774104725, 0, "m", "facGender", "contGamma", "contNormal",
+ "", "", 0.254969127608045, 0.0642245107185118,
+ -1.1383625440279, -0.0618215513880583, 0.132974655309278, 0.0355765519606098,
+ 1, "m", "facGender", "contGamma", "contNormal", "",
+ "", 0.474043852370205, 0.0496938230074287, 0.715914973080085
+ ))
@@ -1406,12 +1433,17 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0256784470944819, 0.850945103223677, 0.43831177515908, 0, "Total",
- 0.037348512364032, 0.210531076754163, 2.08193384994129, 0.13633783786735,
- 0.957660371192974, 0.546999104530162, 1, "Total", 0.00903666574412432,
- 0.20952490448909, 2.61066390109555, 0.108832957868417, 0.914012147270688,
- 0.511422552569552, "Total indirect", 0.0127813022805476, 0.205406628834362,
- 2.48980549202216))
+ list(0.0256784470944819, 0.850945103223677, 0.43831177515908, "", "m",
+ "Total", 0.037348512364032, 0.210531076754163, 2.08193384994129,
+ 0.13633783786735, 0.957660371192974, 0.546999104530162, 0, "m",
+ "Total", 0.00903666574412432, 0.20952490448909, 2.61066390109555,
+ 0.0256784470944819, 0.850945103223677, 0.43831177515908, 1,
+ "m", "Total", 0.037348512364032, 0.210531076754163, 2.08193384994129,
+ -0.198988505343462, 0.0527669505225173, -0.0731107774104725,
+ 0, "m", "Total indirect", 0.254969127608045, 0.0642245107185118,
+ -1.1383625440279, -0.0618215513880583, 0.132974655309278, 0.0355765519606098,
+ 1, "m", "Total indirect", 0.474043852370205, 0.0496938230074287,
+ 0.715914973080085))
diff --git a/tests/testthat/test-classic-process-integration-general.R b/tests/testthat/test-classic-process-integration-general.R
index e51091b..1f66d31 100644
--- a/tests/testthat/test-classic-process-integration-general.R
+++ b/tests/testthat/test-classic-process-integration-general.R
@@ -42,3 +42,354 @@ test_that("Error handling works - covariance", {
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
expect_identical(results[["status"]], "validationError", label = "Covariance check")
})
+
+get_fac_df <- function() {
+ df <- data.frame(
+ contNormal = rnorm(100),
+ contcor1 = rnorm(100),
+ facThree = cut(rnorm(100), breaks = 3, labels = c("A", "B", "C")),
+ facTwo = sample(c("D", "E"), 100, replace = TRUE)
+ )
+ return(df)
+}
+
+test_that("Factors with more than two levels work", {
+ set.seed(1)
+ df <- get_fac_df()
+
+ options <- jaspTools::analysisOptions("ClassicProcess")
+ options$dependent <- "contNormal"
+ options$covariates <- list("contcor1")
+ options$factors <- list("facThree")
+ options$statisticalPathPlotsCovariances <- TRUE
+ options$statisticalPathPlotsResidualVariances <- TRUE
+ options$errorCalculationMethod <- "standard"
+ options$naAction <- "fiml"
+ options$emulation <- "lavaan"
+ options$estimator <- "default"
+ options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+ value = "50"), list(probePercentile = 84, value = "84"))
+ options$pathPlotsLegend <- TRUE
+ options$pathPlotsColorPalette <- "colorblind"
+ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facThree", processType = "moderators",
+ processVariable = "contcor1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+ localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
+ set.seed(1)
+ results <- jaspTools::runAnalysis("ClassicProcess", df, options)
+
+ table <- results[["results"]][["modelSummaryTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(738.631697493269, 780.314420469079, 6, "Model 1", 100, -353.315848746635,
+ 2))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_covariancesTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.18855287140525, -0.093047091209467, -0.140799981307359, "facThreeC",
+ "", 7.51558348888182e-09, "facThreeB", 0.0243641671349884,
+ -5.7789778130836, -0.0429566774419793, 0.137322520212358, 0.0471829213851896,
+ "contcor1", "", 0.304925061828328, "facThreeB", 0.0459904363234113,
+ 1.02592897909019, -0.111386692251663, 0.0439392202030715, -0.0337237360242957,
+ "contcor1", "", 0.394725492097922, "facThreeC", 0.0396246853717531,
+ -0.851078960196263, 0.166537554341246, 0.294262457180447, 0.230400005760847,
+ "facThreeB", "", 1.53743684450092e-12, "facThreeB",
+ 0.0325834821064772, 7.0710676350655, 0.124035773561631, 0.219164194184828,
+ 0.17159998387323, "facThreeC", "", 1.53743684450092e-12,
+ "facThreeC", 0.0242679001689719, 7.0710684763996, 0.656578232571939,
+ 1.1601372201591, 0.90835772636552, "contcor1", "",
+ 1.53743684450092e-12, "contcor1", 0.128461285911162, 7.07106207074478,
+ 0.562065668856282, 0.993138292339328, 0.777601980597805, "contNormal",
+ "", 1.53743684450092e-12, "contNormal", 0.109969526706432,
+ 7.07106781202798))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.830256392676731, 0.671610737591095, 16, -0.0793228275428182,
+ "B", "facThree", "contNormal", "", 0.835982155918959,
+ 0.383136410187729, -0.207035472050155, -0.525905203875692, 1.15334878334855,
+ 16, 0.313721789736431, "C", "facThree", "contNormal", "",
+ 0.463967628519699, 0.428388990938096, 0.732329253021736, -0.419840075271681,
+ 0.605570327467686, 50, 0.0928651260980023, "B", "facThree",
+ "contNormal", "", 0.722586733024018, 0.261589093174077,
+ 0.355003815224835, -0.343080242598669, 0.839989902178562, 50,
+ 0.248454829789947, "C", "facThree", "contNormal", "",
+ 0.410383843368507, 0.301809154175571, 0.823218336331221, -0.539700679220641,
+ 1.2482888689735, 84, 0.354294094876428, "B", "facThree", "contNormal",
+ "", 0.437310753173408, 0.456128164164641, 0.776742421782455,
+ -0.891019364021505, 1.18974240632265, 84, 0.149361521150572,
+ "C", "facThree", "contNormal", "", 0.778418345536092,
+ 0.530816327941977, 0.281380796498216))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_pathCoefficientsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.384277115427941, 0.649582479358737, 0.132652681965398, "facThreeB",
+ "", 0.61499311862582, "contNormal", 0.263744538915416,
+ 0.502958971248843, -0.36868442105099, 0.835431543005484, 0.233373560977247,
+ "facThreeC", "", 0.44741374451908, "contNormal", 0.307178084279708,
+ 0.759733760058037, -0.772565531217873, 0.487083275478801, -0.142741127869536,
+ "contcor1", "", 0.656898600865411, "contNormal", 0.321344886087863,
+ -0.444199158129772, -0.440651907510927, 0.890228809967378, 0.224788451228225,
+ "facThreeB:contcor1", "", 0.507917529817297, "contNormal",
+ 0.339516625809485, 0.662083780705226, -0.838061139155147, 0.667651322062499,
+ -0.0852049085463242, "facThreeC:contcor1", "", 0.824454027131575,
+ "contNormal", 0.384117379986192, -0.22181997739698))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.830256392676731, 0.671610737591095, 16, -0.0793228275428182,
+ "B", "Total", 0.835982155918959, 0.383136410187729, -0.207035472050155,
+ -0.525905203875692, 1.15334878334855, 16, 0.313721789736431,
+ "C", "Total", 0.463967628519699, 0.428388990938096, 0.732329253021736,
+ -0.419840075271681, 0.605570327467686, 50, 0.0928651260980023,
+ "B", "Total", 0.722586733024018, 0.261589093174077, 0.355003815224835,
+ -0.343080242598669, 0.839989902178562, 50, 0.248454829789947,
+ "C", "Total", 0.410383843368507, 0.301809154175571, 0.823218336331221,
+ -0.539700679220641, 1.2482888689735, 84, 0.354294094876428,
+ "B", "Total", 0.437310753173408, 0.456128164164641, 0.776742421782455,
+ -0.891019364021505, 1.18974240632265, 84, 0.149361521150572,
+ "C", "Total", 0.778418345536092, 0.530816327941977, 0.281380796498216
+ ))
+
+ plotName <- results[["results"]][["pathPlotContainer"]][["collection"]][["pathPlotContainer_Model 1"]][["collection"]][["pathPlotContainer_Model 1_conceptPathPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "conceptual-path-plot-facThree")
+
+ plotName <- results[["results"]][["pathPlotContainer"]][["collection"]][["pathPlotContainer_Model 1"]][["collection"]][["pathPlotContainer_Model 1_statPathPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "statistical-path-plot-facThree")
+})
+
+test_that("Interactions between three-level and two-level factors work", {
+ set.seed(1)
+ df <- get_fac_df()
+
+ options <- jaspTools::analysisOptions("ClassicProcess")
+ options$dependent <- "contNormal"
+ options$covariates <- list("contcor1")
+ options$factors <- list("facTwo", "facThree")
+ options$statisticalPathPlotsCovariances <- TRUE
+ options$statisticalPathPlotsResidualVariances <- TRUE
+ options$errorCalculationMethod <- "standard"
+ options$naAction <- "fiml"
+ options$emulation <- "lavaan"
+ options$estimator <- "default"
+ options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+ value = "50"), list(probePercentile = 84, value = "84"))
+ options$pathPlotsLegend <- TRUE
+ options$pathPlotsColorPalette <- "colorblind"
+ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facThree", processType = "moderators",
+ processVariable = "facTwo")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+ localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
+ set.seed(1)
+ results <- jaspTools::runAnalysis("ClassicProcess", df, options)
+
+ table <- results[["results"]][["modelSummaryTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(607.798723015161, 649.48144599097, 6, "Model 1", 100, -287.89936150758,
+ 2))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_covariancesTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.188552899318699, -0.0930470981392201, -0.140799998728959, "facThreeC",
+ "", 7.51560835787757e-09, "facThreeB", 0.0243641724880702,
+ -5.77897725842736, -0.0625879470174146, 0.0313879697933625,
+ -0.015599988612026, "facTwoE", "", 0.515235336014761,
+ "facThreeB", 0.0239738886918451, -0.650707476477626, -0.00972474511250287,
+ 0.0721247068049682, 0.0311999808462327, "facTwoE", "",
+ 0.135116244943659, "facThreeC", 0.0208803459051006, 1.49422720236695,
+ 0.166537561194698, 0.294262481084964, 0.230400021139831, "facThreeB",
+ "", 1.53743684450092e-12, "facThreeB", 0.0325834864563185,
+ 7.07106716307678, 0.124035784194595, 0.219164231272074, 0.171600007733335,
+ "facThreeC", "", 1.53743684450092e-12, "facThreeC",
+ 0.0242679069176374, 7.07106749320103, 0.179548301980595, 0.317251715854165,
+ 0.24840000891738, "facTwoE", "", 1.53743684450092e-12,
+ "facTwoE", 0.0351290674113803, 7.0710675580562, 0.564294089241247,
+ 0.99707578530309, 0.780684937272169, "contNormal", "",
+ 1.53743684450092e-12, "contNormal", 0.110405522620714, 7.0710678120163
+ ))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.79179509702597, 0.581685251376472, -0.105054922824749, "B",
+ 0, "facThree", "contNormal", "", 0.76430843174253,
+ 0.350384078288244, -0.299827901250483, -0.835536962301828, 0.956997866716982,
+ 0.0607304522075771, "C", 0, "facThree", "contNormal", "",
+ 0.894346977764828, 0.457287695885765, 0.132805786715827, -0.346979683280772,
+ 1.19016835503621, 0.421594335877721, "B", 1, "facThree", "contNormal",
+ "", 0.282320764613395, 0.39213680721733, 1.07512053986828,
+ -0.273316897248801, 1.39971560986316, 0.563199356307179, "C",
+ 1, "facThree", "contNormal", "", 0.186975149551964,
+ 0.426801849500457, 1.31958040239602))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_pathCoefficientsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.79179509702597, 0.581685251376472, -0.105054922824749, "facThreeB",
+ "", 0.76430843174253, "contNormal", 0.350384078288244,
+ -0.299827901250483, -0.835536962301828, 0.956997866716982, 0.0607304522075771,
+ "facThreeC", "", 0.894346977764828, "contNormal", 0.457287695885765,
+ 0.132805786715827, -1.5098265891821, 0.360680618984523, -0.574572985098788,
+ "facTwoE", "", 0.228549486740747, "contNormal", 0.477178974440588,
+ -1.20410373439521, -0.504038904791374, 1.55733742219631, 0.52664925870247,
+ "facThreeB:facTwoE", "", 0.31659480567209, "contNormal",
+ 0.525870970907517, 1.00147999763822, -0.723522417690523, 1.72846022588973,
+ 0.502468904099602, "facThreeC:facTwoE", "", 0.421809782363961,
+ "contNormal", 0.625517270450166, 0.803285421261016))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.79179509702597, 0.581685251376472, -0.105054922824749, "B",
+ 0, "Total", 0.76430843174253, 0.350384078288244, -0.299827901250483,
+ -0.835536962301828, 0.956997866716982, 0.0607304522075771, "C",
+ 0, "Total", 0.894346977764828, 0.457287695885765, 0.132805786715827,
+ -0.346979683280772, 1.19016835503621, 0.421594335877721, "B",
+ 1, "Total", 0.282320764613395, 0.39213680721733, 1.07512053986828,
+ -0.273316897248801, 1.39971560986316, 0.563199356307179, "C",
+ 1, "Total", 0.186975149551964, 0.426801849500457, 1.31958040239602
+ ))
+
+ plotName <- results[["results"]][["pathPlotContainer"]][["collection"]][["pathPlotContainer_Model 1"]][["collection"]][["pathPlotContainer_Model 1_conceptPathPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "conceptual-path-plot-facThree-int-facTwo")
+
+ plotName <- results[["results"]][["pathPlotContainer"]][["collection"]][["pathPlotContainer_Model 1"]][["collection"]][["pathPlotContainer_Model 1_statPathPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "statistical-path-plot-facThree-int-facTwo")
+})
+
+test_that("Interactions between two-level and three-level factors work", {
+ set.seed(1)
+ df <- get_fac_df()
+ options <- jaspTools::analysisOptions("ClassicProcess")
+ options$dependent <- "contNormal"
+ options$covariates <- list("contcor1")
+ options$factors <- list("facTwo", "facThree")
+ options$statisticalPathPlotsCovariances <- TRUE
+ options$statisticalPathPlotsResidualVariances <- TRUE
+ options$errorCalculationMethod <- "standard"
+ options$naAction <- "fiml"
+ options$emulation <- "lavaan"
+ options$estimator <- "default"
+ options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+ value = "50"), list(probePercentile = 84, value = "84"))
+ options$pathPlotsLegend <- TRUE
+ options$pathPlotsColorPalette <- "colorblind"
+ options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facTwo", processType = "moderators",
+ processVariable = "facThree")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+ localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
+ set.seed(1)
+ results <- jaspTools::runAnalysis("ClassicProcess", df, options)
+
+ table <- results[["results"]][["modelSummaryTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(607.798723015161, 649.48144599097, 6, "Model 1", 100, -287.89936150758,
+ 2))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_covariancesTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-0.0625879470174092, 0.0313879697933571, -0.015599988612026, "facThreeB",
+ "", 0.515235336014713, "facTwoE", 0.0239738886918424,
+ -0.650707476477701, -0.00972474511269001, 0.0721247068051553,
+ 0.0311999808462326, "facThreeC", "", 0.135116244945445,
+ "facTwoE", 0.020880345905196, 1.49422720236012, -0.188552899318718,
+ -0.0930470981392011, -0.140799998728959, "facThreeC", "",
+ 7.51560835787757e-09, "facThreeB", 0.0243641724880799, -5.77897725842506,
+ 0.17954830198084, 0.317251715853921, 0.24840000891738, "facTwoE",
+ "", 1.53743684450092e-12, "facTwoE", 0.0351290674112554,
+ 7.07106755808134, 0.16653756119465, 0.294262481085012, 0.230400021139831,
+ "facThreeB", "", 1.53743684450092e-12, "facThreeB",
+ 0.0325834864563429, 7.07106716307149, 0.124035784194594, 0.219164231272075,
+ 0.171600007733335, "facThreeC", "", 1.53743684450092e-12,
+ "facThreeC", 0.024267906917638, 7.07106749320088, 0.564294089243091,
+ 0.997075785301246, 0.780684937272169, "contNormal", "",
+ 1.53743684450092e-12, "contNormal", 0.110405522619773, 7.07106781207657
+ ))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-1.50982658901334, 0.360680618815769, -0.574572985098788, 0, 0,
+ "E", "facTwo", "contNormal", "", 0.228549486656783,
+ 0.477178974354487, -1.20410373461247, -0.481073569262345, 0.385226116469709,
+ -0.0479237263963183, 1, 0, "E", "facTwo", "contNormal", "",
+ 0.828324822977639, 0.220998878695046, -0.216850540958842, -1.50982658901334,
+ 0.360680618815769, -0.574572985098788, 0, 0, "E", "facTwo",
+ "contNormal", "", 0.228549486656783, 0.477178974354487,
+ -1.20410373461247, -1.50982658901334, 0.360680618815769, -0.574572985098788,
+ 0, 0, "E", "facTwo", "contNormal", "", 0.228549486656783,
+ 0.477178974354487, -1.20410373461247, -0.481073569262345, 0.385226116469709,
+ -0.0479237263963183, 1, 0, "E", "facTwo", "contNormal", "",
+ 0.828324822977639, 0.220998878695046, -0.216850540958842, -1.50982658901334,
+ 0.360680618815769, -0.574572985098788, 0, 0, "E", "facTwo",
+ "contNormal", "", 0.228549486656783, 0.477178974354487,
+ -1.20410373461247, -0.864792807812527, 0.720584645814155, -0.0721040809991859,
+ 0, 1, "E", "facTwo", "contNormal", "", 0.858502237173678,
+ 0.404440455572637, -0.178281079465939, -0.845713837967434, 1.754804193374,
+ 0.454545177703284, 1, 1, "E", "facTwo", "contNormal", "",
+ 0.493239705610856, 0.663409647282805, 0.685165160870077, -0.864792807812527,
+ 0.720584645814155, -0.0721040809991859, 0, 1, "E", "facTwo",
+ "contNormal", "", 0.858502237173678, 0.404440455572637,
+ -0.178281079465939))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_pathCoefficientsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-1.50982658901334, 0.360680618815769, -0.574572985098788, "facTwoE",
+ "", 0.228549486656783, "contNormal", 0.477178974354487,
+ -1.20410373461247, -0.791795097032169, 0.581685251382671, -0.105054922824749,
+ "facThreeB", "", 0.764308431744595, "contNormal", 0.350384078291407,
+ -0.299827901247776, -0.835536962619522, 0.956997867034676, 0.0607304522075774,
+ "facThreeC", "", 0.894346977802058, "contNormal", 0.457287696047857,
+ 0.132805786668753, -0.504038904576221, 1.55733742198116, 0.526649258702469,
+ "facTwoE:facThreeB", "", 0.316594805571069, "contNormal",
+ 0.525870970797743, 1.00147999784728, -0.723522417887957, 1.72846022608716,
+ 0.502468904099602, "facTwoE:facThreeC", "", 0.421809782438714,
+ "contNormal", 0.625517270550899, 0.803285421131654))
+
+ table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
+ jaspTools::expect_equal_tables(table,
+ list(-1.50982658901334, 0.360680618815769, -0.574572985098788, 0, 0,
+ "E", "Total", 0.228549486656783, 0.477178974354487, -1.20410373461247,
+ -0.481073569262345, 0.385226116469709, -0.0479237263963183,
+ 1, 0, "E", "Total", 0.828324822977639, 0.220998878695046, -0.216850540958842,
+ -1.50982658901334, 0.360680618815769, -0.574572985098788, 0,
+ 0, "E", "Total", 0.228549486656783, 0.477178974354487, -1.20410373461247,
+ -1.50982658901334, 0.360680618815769, -0.574572985098788, 0,
+ 0, "E", "Total", 0.228549486656783, 0.477178974354487, -1.20410373461247,
+ -0.481073569262345, 0.385226116469709, -0.0479237263963183,
+ 1, 0, "E", "Total", 0.828324822977639, 0.220998878695046, -0.216850540958842,
+ -1.50982658901334, 0.360680618815769, -0.574572985098788, 0,
+ 0, "E", "Total", 0.228549486656783, 0.477178974354487, -1.20410373461247,
+ -0.864792807812527, 0.720584645814155, -0.0721040809991859,
+ 0, 1, "E", "Total", 0.858502237173678, 0.404440455572637, -0.178281079465939,
+ -0.845713837967434, 1.754804193374, 0.454545177703284, 1, 1,
+ "E", "Total", 0.493239705610856, 0.663409647282805, 0.685165160870077,
+ -0.864792807812527, 0.720584645814155, -0.0721040809991859,
+ 0, 1, "E", "Total", 0.858502237173678, 0.404440455572637, -0.178281079465939
+ ))
+
+ plotName <- results[["results"]][["pathPlotContainer"]][["collection"]][["pathPlotContainer_Model 1"]][["collection"]][["pathPlotContainer_Model 1_conceptPathPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "conceptual-path-plot-facTwo-int-facThree")
+
+ plotName <- results[["results"]][["pathPlotContainer"]][["collection"]][["pathPlotContainer_Model 1"]][["collection"]][["pathPlotContainer_Model 1_statPathPlot"]][["data"]]
+ testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
+ jaspTools::expect_equal_plots(testPlot, "statistical-path-plot-facTwo-int-facThree")
+})
diff --git a/tests/testthat/test-classic-process-integration-hayes-models.R b/tests/testthat/test-classic-process-integration-hayes-models.R
index 7d3e6c0..da7fae1 100644
--- a/tests/testthat/test-classic-process-integration-hayes-models.R
+++ b/tests/testthat/test-classic-process-integration-hayes-models.R
@@ -2,7 +2,7 @@
test_that("Test that model number 1 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -13,19 +13,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -104,7 +104,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 1 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -115,19 +115,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -158,10 +158,10 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0389573762499846, 1.18963781752013, 0.614297596885057, 0, "facGenderm",
- "contNormal", "", 0.036378010371507, 0.293546322878014,
+ list(0.0389573762499846, 1.18963781752013, 0.614297596885057, 0, "m",
+ "facGender", "contNormal", "", 0.036378010371507, 0.293546322878014,
2.09267685884226, -0.258993824622392, 0.891686616803016, 0.316346396090312,
- 1, "facGenderm", "contNormal", "", 0.281180548821822,
+ 1, "m", "facGender", "contNormal", "", 0.281180548821822,
0.293546322917622, 1.07767112510923))
@@ -181,10 +181,11 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0389573762499846, 1.18963781752013, 0.614297596885057, 0, "Total",
- 0.036378010371507, 0.293546322878014, 2.09267685884226, -0.258993824622392,
- 0.891686616803016, 0.316346396090312, 1, "Total", 0.281180548821822,
- 0.293546322917622, 1.07767112510923))
+ list(0.0389573762499846, 1.18963781752013, 0.614297596885057, 0, "m",
+ "Total", 0.036378010371507, 0.293546322878014, 2.09267685884226,
+ -0.258993824622392, 0.891686616803016, 0.316346396090312, 1,
+ "m", "Total", 0.281180548821822, 0.293546322917622, 1.07767112510923
+ ))
@@ -200,7 +201,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 2 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -211,21 +212,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -341,7 +342,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 2 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -352,21 +353,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -405,20 +406,20 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.161065462166927, 1.33098043660259, 16, 0.584957487217831, 0,
- "facGenderm", "contNormal", "", 0.124339818079468,
+ "m", "facGender", "contNormal", "", 0.124339818079468,
0.380630947950723, 1.5368101053453, -0.358875044036943, 1.00789206259432,
- 16, 0.32450850927869, 1, "facGenderm", "contNormal", "",
+ 16, 0.32450850927869, 1, "m", "facGender", "contNormal", "",
0.352008831944638, 0.348671485142623, 0.930699879704677, 0.0267424851786442,
- 1.18684632303876, 50, 0.606794404108703, 0, "facGenderm", "contNormal",
- "", 0.0403326883329289, 0.295950294753085, 2.0503253920222,
- -0.238349615464404, 0.931040467803529, 50, 0.346345426169562,
- 1, "facGenderm", "contNormal", "", 0.245646338204931,
- 0.298319278438771, 1.16098908519132, -0.0593588649528981, 1.32414010991594,
- 84, 0.632390622481523, 0, "facGenderm", "contNormal", "",
- 0.0731682258788371, 0.352939897309773, 1.79177992429254, -0.399560650456646,
- 1.14344393954141, 84, 0.371941644542382, 1, "facGenderm", "contNormal",
- "", 0.34471012405264, 0.393630852956758, 0.944899622955218
- ))
+ 1.18684632303876, 50, 0.606794404108703, 0, "m", "facGender",
+ "contNormal", "", 0.0403326883329289, 0.295950294753085,
+ 2.0503253920222, -0.238349615464404, 0.931040467803529, 50,
+ 0.346345426169562, 1, "m", "facGender", "contNormal", "",
+ 0.245646338204931, 0.298319278438771, 1.16098908519132, -0.0593588649528981,
+ 1.32414010991594, 84, 0.632390622481523, 0, "m", "facGender",
+ "contNormal", "", 0.0731682258788371, 0.352939897309773,
+ 1.79177992429254, -0.399560650456646, 1.14344393954141, 84,
+ 0.371941644542382, 1, "m", "facGender", "contNormal", "",
+ 0.34471012405264, 0.393630852956758, 0.944899622955218))
@@ -442,17 +443,17 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.161065462166927, 1.33098043660259, 16, 0.584957487217831, 0,
- "Total", 0.124339818079468, 0.380630947950723, 1.5368101053453,
+ "m", "Total", 0.124339818079468, 0.380630947950723, 1.5368101053453,
-0.358875044036943, 1.00789206259432, 16, 0.32450850927869,
- 1, "Total", 0.352008831944638, 0.348671485142623, 0.930699879704677,
+ 1, "m", "Total", 0.352008831944638, 0.348671485142623, 0.930699879704677,
0.0267424851786442, 1.18684632303876, 50, 0.606794404108703,
- 0, "Total", 0.0403326883329289, 0.295950294753085, 2.0503253920222,
+ 0, "m", "Total", 0.0403326883329289, 0.295950294753085, 2.0503253920222,
-0.238349615464404, 0.931040467803529, 50, 0.346345426169562,
- 1, "Total", 0.245646338204931, 0.298319278438771, 1.16098908519132,
+ 1, "m", "Total", 0.245646338204931, 0.298319278438771, 1.16098908519132,
-0.0593588649528981, 1.32414010991594, 84, 0.632390622481523,
- 0, "Total", 0.0731682258788371, 0.352939897309773, 1.79177992429254,
+ 0, "m", "Total", 0.0731682258788371, 0.352939897309773, 1.79177992429254,
-0.399560650456646, 1.14344393954141, 84, 0.371941644542382,
- 1, "Total", 0.34471012405264, 0.393630852956758, 0.944899622955218
+ 1, "m", "Total", 0.34471012405264, 0.393630852956758, 0.944899622955218
))
@@ -469,7 +470,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 3 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -480,21 +481,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "contNormal",
- processIndependent = "contcor1", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "contNormal",
+ processIndependent = "contcor1", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -615,7 +616,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 3 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -626,21 +627,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "contNormal",
- processIndependent = "facExperim", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "contNormal",
+ processIndependent = "facExperim", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -679,20 +680,20 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.879096135794025, 0.893322475661732, 16, 0.00711316993385364,
- 0, "facGenderm", "contNormal", "", 0.987448457029138,
+ 0, "m", "facGender", "contNormal", "", 0.987448457029138,
0.452155913434218, 0.0157316751202647, -0.226236100911908, 1.45144461323237,
- 16, 0.61260425616023, 1, "facGenderm", "contNormal", "",
+ 16, 0.61260425616023, 1, "m", "facGender", "contNormal", "",
0.152327153088125, 0.427987638389687, 1.43135969642761, -0.0706048609407803,
- 1.07522417225395, 50, 0.502309655656585, 0, "facGenderm", "contNormal",
- "", 0.0857196943308809, 0.292308696035459, 1.71842186862498,
- -0.295309938992243, 0.864575094385034, 50, 0.284632577696396,
- 1, "facGenderm", "contNormal", "", 0.336080006943378,
- 0.295894476257294, 0.961939476858953, 0.299944751940104, 1.86556713860983,
- 84, 1.08275594527497, 0, "facGenderm", "contNormal", "",
- 0.00670905737302419, 0.399400805070695, 2.7109508331695, -1.0144280267332,
- 0.814826886209518, 84, -0.0998005702618417, 1, "facGenderm",
- "contNormal", "", 0.830653424048315, 0.466655236364456,
- -0.21386360311598))
+ 1.07522417225395, 50, 0.502309655656585, 0, "m", "facGender",
+ "contNormal", "", 0.0857196943308809, 0.292308696035459,
+ 1.71842186862498, -0.295309938992243, 0.864575094385034, 50,
+ 0.284632577696396, 1, "m", "facGender", "contNormal", "",
+ 0.336080006943378, 0.295894476257294, 0.961939476858953, 0.299944751940104,
+ 1.86556713860983, 84, 1.08275594527497, 0, "m", "facGender",
+ "contNormal", "", 0.00670905737302419, 0.399400805070695,
+ 2.7109508331695, -1.0144280267332, 0.814826886209518, 84, -0.0998005702618417,
+ 1, "m", "facGender", "contNormal", "", 0.830653424048315,
+ 0.466655236364456, -0.21386360311598))
@@ -721,17 +722,17 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.879096135794025, 0.893322475661732, 16, 0.00711316993385364,
- 0, "Total", 0.987448457029138, 0.452155913434218, 0.0157316751202647,
+ 0, "m", "Total", 0.987448457029138, 0.452155913434218, 0.0157316751202647,
-0.226236100911908, 1.45144461323237, 16, 0.61260425616023,
- 1, "Total", 0.152327153088125, 0.427987638389687, 1.43135969642761,
+ 1, "m", "Total", 0.152327153088125, 0.427987638389687, 1.43135969642761,
-0.0706048609407803, 1.07522417225395, 50, 0.502309655656585,
- 0, "Total", 0.0857196943308809, 0.292308696035459, 1.71842186862498,
+ 0, "m", "Total", 0.0857196943308809, 0.292308696035459, 1.71842186862498,
-0.295309938992243, 0.864575094385034, 50, 0.284632577696396,
- 1, "Total", 0.336080006943378, 0.295894476257294, 0.961939476858953,
+ 1, "m", "Total", 0.336080006943378, 0.295894476257294, 0.961939476858953,
0.299944751940104, 1.86556713860983, 84, 1.08275594527497, 0,
- "Total", 0.00670905737302419, 0.399400805070695, 2.7109508331695,
+ "m", "Total", 0.00670905737302419, 0.399400805070695, 2.7109508331695,
-1.0144280267332, 0.814826886209518, 84, -0.0998005702618417,
- 1, "Total", 0.830653424048315, 0.466655236364456, -0.21386360311598
+ 1, "m", "Total", 0.830653424048315, 0.466655236364456, -0.21386360311598
))
@@ -748,7 +749,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 4 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -759,19 +760,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -842,7 +843,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 4 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -853,19 +854,19 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -893,12 +894,12 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0622024991965639, 0.868598726146002, 0.465400612671283, "facGenderm",
- "contNormal", "", "", "", 0.0236768306591097, 0.205717103301435,
- 2.26233310309321, -0.0219205602251843, 0.0213787048213383, -0.000270927701922977,
- "facGenderm", "debCollin1", "contNormal", "", "",
- 0.980431952510507, 0.0110459338508416, -0.0245273695806476
- ))
+ list(0.0622024991965639, 0.868598726146002, 0.465400612671283, "m",
+ "facGender", "contNormal", "", "", "", 0.0236768306591097,
+ 0.205717103301435, 2.26233310309321, -0.0219205602251843, 0.0213787048213383,
+ -0.000270927701922977, "m", "facGender", "debCollin1", "contNormal",
+ "", "", 0.980431952510507, 0.0110459338508416,
+ -0.0245273695806476))
@@ -916,11 +917,13 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0625107998260226, 0.867748570112698, 0.46512968496936, "Total",
- 0.0235575795563017, 0.205421573212132, 2.26426892607348, -0.0219205602251843,
- 0.0213787048213383, -0.000270927701922977, "Total indirect",
- 0.980431952510507, 0.0110459338508416, -0.0245273695806476
- ))
+ list(0.0625107998260226, 0.867748570112698, 0.46512968496936, "m",
+ "Total", 0.0235575795563017, 0.205421573212132, 2.26426892607348,
+ 0.0625107998260226, 0.867748570112698, 0.46512968496936, "m",
+ "Total", 0.0235575795563017, 0.205421573212132, 2.26426892607348,
+ -0.0219205602251843, 0.0213787048213383, -0.000270927701922977,
+ "m", "Total indirect", 0.980431952510507, 0.0110459338508416,
+ -0.0245273695806476))
@@ -936,7 +939,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 5 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -947,21 +950,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1051,7 +1054,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 5 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1062,21 +1065,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1110,14 +1113,15 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0389876732996416, 1.18993239606349, 0.614460034681565, 0, "facGenderm",
- "contNormal", "", "", "", 0.0363715155500868, 0.293613742865265,
- 2.09274957188748, -0.261259762109523, 0.89279798255157, 0.315769110221023,
- 1, "facGenderm", "contNormal", "", "", "", 0.283470138708214,
- 0.294407895697103, 1.07255652730828, -0.0214503308222069, 0.0220182200677286,
- 0.000283944622760887, "", "facGenderm", "debCollin1", "contNormal",
- "", "", 0.979571843382763, 0.0110891198085296,
- 0.0256056952818275))
+ list(0.0389876732996416, 1.18993239606349, 0.614460034681565, 0, "m",
+ "facGender", "contNormal", "", "", "", 0.0363715155500868,
+ 0.293613742865265, 2.09274957188748, -0.261259762109523, 0.89279798255157,
+ 0.315769110221023, 1, "m", "facGender", "contNormal", "", "",
+ "", 0.283470138708214, 0.294407895697103, 1.07255652730828,
+ -0.0214503308222069, 0.0220182200677286, 0.000283944622760887,
+ "", "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.979571843382763, 0.0110891198085296, 0.0256056952818275
+ ))
@@ -1140,11 +1144,14 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.038393337805159, 1.19109462080349, 0.614743979304326, 0, "Total",
- 0.0365705663010119, 0.294061853200032, 2.0905261005961, -0.259723189210586,
- 0.891829298898155, 0.316053054843784, 1, "Total", 0.28199144682767,
- 0.293768787894074, 1.07585648260817, -0.0214503308222069, 0.0220182200677286,
- 0.000283944622760887, "Total indirect", 0.979571843382763, 0.0110891198085296,
+ list(0.038393337805159, 1.19109462080349, 0.614743979304326, 0, "m",
+ "Total", 0.0365705663010119, 0.294061853200032, 2.0905261005961,
+ -0.259723189210586, 0.891829298898155, 0.316053054843784, 1,
+ "m", "Total", 0.28199144682767, 0.293768787894074, 1.07585648260817,
+ 0.038393337805159, 1.19109462080349, 0.614743979304326, "",
+ "m", "Total", 0.0365705663010119, 0.294061853200032, 2.0905261005961,
+ -0.0214503308222069, 0.0220182200677286, 0.000283944622760887,
+ "", "m", "Total indirect", 0.979571843382763, 0.0110891198085296,
0.0256056952818275))
@@ -1161,7 +1168,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 7 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1172,21 +1179,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1259,11 +1266,11 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
"Total", 0.553609428213643, 0.0689480737953325, -0.592360175476169,
-0.175382476672515, 0.095909680846968, 84, -0.0397363979127734,
"Total", 0.565862745895811, 0.0692084547622816, -0.574155253852448,
- -0.0129246594659768, 0.0157306912130232, 16, 0.00140301587352322,
- "Total indirect", 0.847799779268132, 0.00731017276466042, 0.191926500055624,
- -0.0215673931237313, 0.0263996712180194, 50, 0.00241613904714404,
- "Total indirect", 0.843475500378468, 0.0122367208581659, 0.197449878537653,
- -0.0314505030469635, 0.0384941714999988, 84, 0.00352183422651761,
+ -0.0314505030469635, 0.0384941714999988, 0.00352183422651761,
+ "Total indirect", 0.84353402088629, 0.0178433570970378, 0.197375090761496,
+ -0.0314505030469635, 0.0384941714999988, 0.00352183422651761,
+ "Total indirect", 0.84353402088629, 0.0178433570970378, 0.197375090761496,
+ -0.0314505030469635, 0.0384941714999988, 0.00352183422651761,
"Total indirect", 0.84353402088629, 0.0178433570970378, 0.197375090761496
))
@@ -1281,7 +1288,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 7 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1292,21 +1299,21 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1339,14 +1346,15 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0622024992016066, 0.86859872614096, 0.465400612671283, "", "facGenderm",
- "contNormal", "", "", "", 0.0236768306573629, 0.205717103298863,
- 2.26233310312151, -0.0122966566756132, 0.0126066279449722, 0.000154985634679501,
- 0, "facGenderm", "debCollin1", "contNormal", "", "",
- 0.980536995391145, 0.00635299546752372, 0.0243956784593633,
- -0.0445413897110322, 0.0434397906359828, -0.000550799537524732,
- 1, "facGenderm", "debCollin1", "contNormal", "", "",
- 0.980421548403501, 0.022444591084581, -0.0245404131199842))
+ list(0.0622024992016066, 0.86859872614096, 0.465400612671283, "", "m",
+ "facGender", "contNormal", "", "", "", 0.0236768306573629,
+ 0.205717103298863, 2.26233310312151, -0.0122966566756132, 0.0126066279449722,
+ 0.000154985634679501, 0, "m", "facGender", "debCollin1", "contNormal",
+ "", "", 0.980536995391145, 0.00635299546752372,
+ 0.0243956784593633, -0.0445413897110322, 0.0434397906359828,
+ -0.000550799537524732, 1, "m", "facGender", "debCollin1", "contNormal",
+ "", "", 0.980421548403501, 0.022444591084581,
+ -0.0245404131199842))
@@ -1370,14 +1378,17 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0615025124506953, 0.86960868416123, 0.465555598305963, 0, "Total",
- 0.0239270977275898, 0.20615332171529, 2.25829782626022, 0.0616103170585399,
- 0.868089309208977, 0.464849813133758, 1, "Total", 0.0238570388065877,
- 0.205738217261093, 2.25942374402826, -0.0122966566756132, 0.0126066279449722,
- 0.000154985634679501, 0, "Total indirect", 0.980536995391145,
- 0.00635299546752372, 0.0243956784593633, -0.0445413897110322,
- 0.0434397906359828, -0.000550799537524732, 1, "Total indirect",
- 0.980421548403501, 0.022444591084581, -0.0245404131199842))
+ list(0.0615025124506953, 0.86960868416123, 0.465555598305963, "", "m",
+ "Total", 0.0239270977275898, 0.20615332171529, 2.25829782626022,
+ 0.0616103170585399, 0.868089309208977, 0.464849813133758, 0,
+ "m", "Total", 0.0238570388065877, 0.205738217261093, 2.25942374402826,
+ 0.0615025124506953, 0.86960868416123, 0.465555598305963, 1,
+ "m", "Total", 0.0239270977275898, 0.20615332171529, 2.25829782626022,
+ -0.0122966566756132, 0.0126066279449722, 0.000154985634679501,
+ 0, "m", "Total indirect", 0.980536995391145, 0.00635299546752372,
+ 0.0243956784593633, -0.0445413897110322, 0.0434397906359828,
+ -0.000550799537524732, 1, "m", "Total indirect", 0.980421548403501,
+ 0.022444591084581, -0.0245404131199842))
@@ -1393,7 +1404,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 8 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1404,23 +1415,23 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1531,7 +1542,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 8 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1542,23 +1553,23 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1592,17 +1603,18 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0389876734574709, 1.18993239590566, 0.614460034681565, 0, "facGenderm",
- "contNormal", "", "", "", 0.036371515498824, 0.293613742784738,
- 2.09274957246144, -0.261259761975917, 0.892797982417963, 0.315769110221023,
- 1, "facGenderm", "contNormal", "", "", "", 0.283470138596737,
- 0.294407895628935, 1.07255652755662, -0.0126694778620506, 0.0123445955233525,
- -0.00016244116934909, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.979691262161339, 0.00638125842686675,
- -0.0254559772513163, -0.0435841095532679, 0.0447386598161608,
- 0.000577275131446476, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.979560003906632, 0.0225317327425676,
- 0.0256205387327301))
+ list(0.0389876734574709, 1.18993239590566, 0.614460034681565, 0, "m",
+ "facGender", "contNormal", "", "", "", 0.036371515498824,
+ 0.293613742784738, 2.09274957246144, -0.261259761975917, 0.892797982417963,
+ 0.315769110221023, 1, "m", "facGender", "contNormal", "", "",
+ "", 0.283470138596737, 0.294407895628935, 1.07255652755662,
+ -0.0126694778620506, 0.0123445955233525, -0.00016244116934909,
+ 0, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.979691262161339, 0.00638125842686675, -0.0254559772513163,
+ -0.0435841095532679, 0.0447386598161608, 0.000577275131446476,
+ 1, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.979560003906632, 0.0225317327425676, 0.0256205387327301
+ ))
@@ -1630,17 +1642,18 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0389573728877487, 1.18963781413668, 0.614297593512216, 0, "Total",
- 0.0363780113944387, 0.293546322872603, 2.09267684739085, -0.2589938353015,
- 0.891686606006439, 0.31634638535247, 1, "Total", 0.281180565102892,
- 0.293546322887655, 1.07767108863953, 0.0389573728877487, 1.18963781413668,
- 0.614297593512216, 0, "Total", 0.0363780113944387, 0.293546322872603,
- 2.09267684739085, -0.2589938353015, 0.891686606006439, 0.31634638535247,
- 1, "Total", 0.281180565102892, 0.293546322887655, 1.07767108863953,
+ list(0.0389573728877487, 1.18963781413668, 0.614297593512216, 0, "m",
+ "Total", 0.0363780113944387, 0.293546322872603, 2.09267684739085,
+ -0.2589938353015, 0.891686606006439, 0.31634638535247, 1, "m",
+ "Total", 0.281180565102892, 0.293546322887655, 1.07767108863953,
+ 0.0389573728877487, 1.18963781413668, 0.614297593512216, 0,
+ "m", "Total", 0.0363780113944387, 0.293546322872603, 2.09267684739085,
+ -0.2589938353015, 0.891686606006439, 0.31634638535247, 1, "m",
+ "Total", 0.281180565102892, 0.293546322887655, 1.07767108863953,
-0.0126694778620506, 0.0123445955233525, -0.00016244116934909,
- 0, "Total indirect", 0.979691262161339, 0.00638125842686675,
+ 0, "m", "Total indirect", 0.979691262161339, 0.00638125842686675,
-0.0254559772513163, -0.0435841095532679, 0.0447386598161608,
- 0.000577275131446476, 1, "Total indirect", 0.979560003906632,
+ 0.000577275131446476, 1, "m", "Total indirect", 0.979560003906632,
0.0225317327425676, 0.0256205387327301))
@@ -1657,7 +1670,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 9 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1668,23 +1681,23 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1798,23 +1811,23 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
"Total", 0.555570583522043, 0.0690088327060871, -0.589433389655344,
-0.175369820469393, 0.0966134828379493, 84, 84, -0.0393781688157218,
"Total", 0.57035189990021, 0.0693847707031129, -0.567533313386811,
- -0.0112823578372222, 0.013697450136648, 16, 16, 0.00120754614971293,
- "Total indirect", 0.849706592315187, 0.00637251708983118, 0.189492806796838,
- -0.0217864646337114, 0.0265801048309022, 50, 16, 0.00239682009859541,
- "Total indirect", 0.845977608319149, 0.0123386373030635, 0.194253225840452,
- -0.033959347798064, 0.0413488707200262, 84, 16, 0.00369476146098112,
- "Total indirect", 0.847492362211712, 0.019211633252476, 0.192318966973041,
- -0.0125633341927989, 0.015146747875033, 16, 50, 0.00129170684111702,
- "Total indirect", 0.855011730868061, 0.00706902838174719, 0.182727635448785,
- -0.0221379396607771, 0.0270999012407761, 50, 50, 0.0024809807899995,
- "Total indirect", 0.843423688677146, 0.0125609045089438, 0.197516093545091,
- -0.0339443314234804, 0.0415021757282509, 84, 50, 0.0037789221523852,
- "Total indirect", 0.844344725040594, 0.0192469116133877, 0.19633914408152,
- -0.0155176014689822, 0.0182983136477349, 16, 84, 0.00139035608937636,
- "Total indirect", 0.87195986547754, 0.00862666747538545, 0.161169547028847,
- -0.023550280163801, 0.0287095402403187, 50, 84, 0.00257963003825885,
- "Total indirect", 0.846572070896425, 0.0133318318133237, 0.193494043007712,
- -0.0346050743640666, 0.0423602171653558, 84, 84, 0.00387757140064455,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
+ "Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125,
+ -0.0346050743640666, 0.0423602171653558, 0.00387757140064455,
"Total indirect", 0.843444867042652, 0.0196343637272202, 0.197489027631125
))
@@ -1832,7 +1845,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 9 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -1843,23 +1856,23 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -1900,25 +1913,25 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0.0622024991960345, 0.868598726146532, "", 0.465400612671283,
- "", "facGenderm", "contNormal", "", "", "", 0.0236768306592932,
+ "", "m", "facGender", "contNormal", "", "", "", 0.0236768306592932,
0.205717103301706, 2.26233310309024, -0.0234805716729502, 0.0240745476005247,
- 16, 0.000296987963787239, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980469365838342, 0.0121316308994919,
+ 16, 0.000296987963787239, 0, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980469365838342, 0.0121316308994919,
0.0244804648482734, -0.0327171718179227, 0.031908672568233,
- 16, -0.000404249624844824, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980437785068855, 0.0164864877354676,
+ 16, -0.000404249624844824, 1, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980437785068855, 0.0164864877354676,
-0.0245200573543118, -0.0138827148944902, 0.0142331283695509,
- 50, 0.000175206737530344, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980511668942837, 0.00717254079304909,
+ 50, 0.000175206737530344, 0, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980511668942837, 0.00717254079304909,
0.0244274299143948, -0.0425413075557195, 0.0414892458535161,
- 50, -0.000526030851101718, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980422891086795, 0.0214367595711089,
+ 50, -0.000526030851101718, 1, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980422891086795, 0.0214367595711089,
-0.0245387298092697, -0.00306290247311634, 0.00312782336911389,
- 84, 3.24604479987777e-05, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.983601636527509, 0.00157929581641854,
+ 84, 3.24604479987777e-05, 0, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.983601636527509, 0.00157929581641854,
0.0205537478547814, -0.0540879144054593, 0.0527503601241927,
- 84, -0.000668777140633285, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980423767086204, 0.0272551626898195,
+ 84, -0.000668777140633285, 1, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980423767086204, 0.0272551626898195,
-0.0245376315762404))
@@ -1947,31 +1960,33 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
- list(0.0605315476462935, 0.870863653623847, 16, 0.46569760063507, 0,
- "Total", 0.0242729391292758, 0.206721172523921, 2.25278134285534,
+ list(0.0605315476462935, 0.870863653623847, "", 0.46569760063507, "",
+ "m", "Total", 0.0242729391292758, 0.206721172523921, 2.25278134285534,
0.0622345831299339, 0.867758142962943, 16, 0.464996363046438,
- 1, "Total", 0.0236469844630725, 0.205494480048326, 2.2628168062572,
- 0.0613836654269441, 0.869767973390683, 50, 0.465575819408813,
- 0, "Total", 0.0239694305294997, 0.206224276144912, 2.25761888033811,
+ 0, "m", "Total", 0.0236469844630725, 0.205494480048326, 2.2628168062572,
+ 0.0613836654269441, 0.869767973390683, 16, 0.465575819408813,
+ 1, "m", "Total", 0.0239694305294997, 0.206224276144912, 2.25761888033811,
0.0617397111812278, 0.868009452459135, 50, 0.464874581820181,
- 1, "Total", 0.0238131494725367, 0.205684835955574, 2.26013055197025,
- 0.0620841183034912, 0.868782027935073, 84, 0.465433073119282,
- 0, "Total", 0.02371935861357, 0.205794064583511, 2.26164478582622,
+ 0, "m", "Total", 0.0238131494725367, 0.205684835955574, 2.26013055197025,
+ 0.0620841183034912, 0.868782027935073, 50, 0.465433073119282,
+ 1, "m", "Total", 0.02371935861357, 0.205794064583511, 2.26164478582622,
0.0608591197226557, 0.868604551338644, 84, 0.46473183553065,
- 1, "Total", 0.0241139573028737, 0.206061294489945, 2.25530872588654,
+ 0, "m", "Total", 0.0241139573028737, 0.206061294489945, 2.25530872588654,
+ 0.0605315476462935, 0.870863653623847, 84, 0.46569760063507,
+ 1, "m", "Total", 0.0242729391292758, 0.206721172523921, 2.25278134285534,
-0.0234805716729502, 0.0240745476005247, 16, 0.000296987963787239,
- 0, "Total indirect", 0.980469365838342, 0.0121316308994919,
+ 0, "m", "Total indirect", 0.980469365838342, 0.0121316308994919,
0.0244804648482734, -0.0327171718179227, 0.031908672568233,
- 16, -0.000404249624844824, 1, "Total indirect", 0.980437785068855,
+ 16, -0.000404249624844824, 1, "m", "Total indirect", 0.980437785068855,
0.0164864877354676, -0.0245200573543118, -0.0138827148944902,
- 0.0142331283695509, 50, 0.000175206737530344, 0, "Total indirect",
+ 0.0142331283695509, 50, 0.000175206737530344, 0, "m", "Total indirect",
0.980511668942837, 0.00717254079304909, 0.0244274299143948,
-0.0425413075557195, 0.0414892458535161, 50, -0.000526030851101718,
- 1, "Total indirect", 0.980422891086795, 0.0214367595711089,
+ 1, "m", "Total indirect", 0.980422891086795, 0.0214367595711089,
-0.0245387298092697, -0.00306290247311634, 0.00312782336911389,
- 84, 3.24604479987777e-05, 0, "Total indirect", 0.983601636527509,
+ 84, 3.24604479987777e-05, 0, "m", "Total indirect", 0.983601636527509,
0.00157929581641854, 0.0205537478547814, -0.0540879144054593,
- 0.0527503601241927, 84, -0.000668777140633285, 1, "Total indirect",
+ 0.0527503601241927, 84, -0.000668777140633285, 1, "m", "Total indirect",
0.980423767086204, 0.0272551626898195, -0.0245376315762404
))
@@ -1989,7 +2004,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 10 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -2000,27 +2015,27 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor2"), list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor2"), list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -2216,7 +2231,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 10 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -2227,27 +2242,27 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "contcor2"), list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "contcor2"), list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -2289,38 +2304,39 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.160966936882472, 1.33182551367605, 16, 0.58542928839679, 0,
- "facGenderm", "contNormal", "", "", "", 0.124224648229917,
+ "m", "facGender", "contNormal", "", "", "", 0.124224648229917,
0.380821398335245, 1.53728044420819, -0.360278235735231, 1.0080108561311,
- 16, 0.323866310197933, 1, "facGenderm", "contNormal", "", "",
- "", 0.353498436753044, 0.349059753816708, 0.927824839892589,
+ 16, 0.323866310197933, 1, "m", "facGender", "contNormal", "",
+ "", "", 0.353498436753044, 0.349059753816708, 0.927824839892589,
0.0268555790493255, 1.18728990326231, 50, 0.607072741155815,
- 0, "facGenderm", "contNormal", "", "", "", 0.0402979555318521,
+ 0, "m", "facGender", "contNormal", "", "", "", 0.0402979555318521,
0.296034604045365, 2.05068168673547, -0.240696017862408, 0.931715543776325,
- 50, 0.345509762956958, 1, "facGenderm", "contNormal", "", "",
- "", 0.248007295971046, 0.299090077901065, 1.15520302572942,
+ 50, 0.345509762956958, 1, "m", "facGender", "contNormal", "",
+ "", "", 0.248007295971046, 0.299090077901065, 1.15520302572942,
-0.0593069506129866, 1.32419133035509, 84, 0.632442189871049,
- 0, "facGenderm", "contNormal", "", "", "", 0.0731446713359649,
+ 0, "m", "facGender", "contNormal", "", "", "", 0.0731446713359649,
0.352939720291018, 1.79192693117557, -0.402473478079912, 1.1442319014243,
- 84, 0.370879211672192, 1, "facGenderm", "contNormal", "", "",
- "", 0.347245173937405, 0.394574949260401, 0.939946168319544,
+ 84, 0.370879211672192, 1, "m", "facGender", "contNormal", "",
+ "", "", 0.347245173937405, 0.394574949260401, 0.939946168319544,
-0.0244283163085191, 0.0234847144242383, 16, -0.000471800942140402,
- 0, "facGenderm", "debCollin1", "contNormal", "", "",
- 0.969209589795566, 0.0122229365209487, -0.0385996394018566,
+ 0, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.969209589795566, 0.0122229365209487, -0.0385996394018566,
-0.0318355292516048, 0.033119927916608, 16, 0.000642199332501614,
- 1, "facGenderm", "debCollin1", "contNormal", "", "",
- 0.969085398826703, 0.0165705741739576, 0.0387554061651586, -0.0144875372254733,
- 0.0139308636248141, 50, -0.000278336800329581, 0, "facGenderm",
- "debCollin1", "contNormal", "", "", 0.969374551226098,
- 0.00724972526904785, -0.0383927376555797, -0.0413456780600054,
- 0.0430170050086302, 50, 0.000835663474312435, 1, "facGenderm",
- "debCollin1", "contNormal", "", "", 0.969026515646823,
- 0.0215214880819438, 0.0388292608359895, -0.00379203726602771,
- 0.00368890300389759, 84, -5.15671310650621e-05, 0, "facGenderm",
- "debCollin1", "contNormal", "", "", 0.978443309502044,
- 0.00190843819808272, -0.0270205926064927, -0.0525714502863859,
- 0.0546963165735398, 84, 0.00106243314357695, 1, "facGenderm",
- "debCollin1", "contNormal", "", "", 0.969029984491913,
- 0.0273647290730952, 0.0388249100051032))
+ 1, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.969085398826703, 0.0165705741739576, 0.0387554061651586,
+ -0.0144875372254733, 0.0139308636248141, 50, -0.000278336800329581,
+ 0, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.969374551226098, 0.00724972526904785, -0.0383927376555797,
+ -0.0413456780600054, 0.0430170050086302, 50, 0.000835663474312435,
+ 1, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.969026515646823, 0.0215214880819438, 0.0388292608359895,
+ -0.00379203726602771, 0.00368890300389759, 84, -5.15671310650621e-05,
+ 0, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.978443309502044, 0.00190843819808272, -0.0270205926064927,
+ -0.0525714502863859, 0.0546963165735398, 84, 0.00106243314357695,
+ 1, "m", "facGender", "debCollin1", "contNormal", "",
+ "", 0.969029984491913, 0.0273647290730952, 0.0388249100051032
+ ))
@@ -2358,42 +2374,42 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_totalEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(-0.161065461858297, 1.3309804367676, 16, 0.58495748745465, 0,
- "Total", 0.124339817890827, 0.380630947914085, 1.5368101061154,
+ "m", "Total", 0.124339817890827, 0.380630947914085, 1.5368101061154,
-0.358875043779641, 1.00789206284051, 16, 0.324508509530435,
- 1, "Total", 0.352008831567136, 0.348671485139787, 0.930699880434257,
+ 1, "m", "Total", 0.352008831567136, 0.348671485139787, 0.930699880434257,
0.026742485486911, 1.18684632322406, 50, 0.606794404355486,
- 0, "Total", 0.0403326882304174, 0.295950294721715, 2.05032539307339,
+ 0, "m", "Total", 0.0403326882304174, 0.295950294721715, 2.05032539307339,
-0.238349615156111, 0.931040468018653, 50, 0.346345426431271,
- 1, "Total", 0.245646337810546, 0.298319278415003, 1.16098908616109,
+ 1, "m", "Total", 0.245646337810546, 0.298319278415003, 1.16098908616109,
-0.0593588646633562, 1.32414011014332, 84, 0.632390622739984,
- 0, "Total", 0.0731682257485846, 0.352939897293916, 1.79177992510536,
+ 0, "m", "Total", 0.0731682257485846, 0.352939897293916, 1.79177992510536,
-0.399560650103491, 1.14344393973503, 84, 0.371941644815769,
- 1, "Total", 0.344710123648147, 0.39363085291606, 0.944899623747441,
+ 1, "m", "Total", 0.344710123648147, 0.39363085291606, 0.944899623747441,
-0.161065461858297, 1.3309804367676, 16, 0.58495748745465, 0,
- "Total", 0.124339817890827, 0.380630947914085, 1.5368101061154,
+ "m", "Total", 0.124339817890827, 0.380630947914085, 1.5368101061154,
-0.358875043779641, 1.00789206284051, 16, 0.324508509530435,
- 1, "Total", 0.352008831567136, 0.348671485139787, 0.930699880434257,
+ 1, "m", "Total", 0.352008831567136, 0.348671485139787, 0.930699880434257,
0.026742485486911, 1.18684632322406, 50, 0.606794404355486,
- 0, "Total", 0.0403326882304174, 0.295950294721715, 2.05032539307339,
+ 0, "m", "Total", 0.0403326882304174, 0.295950294721715, 2.05032539307339,
-0.238349615156111, 0.931040468018653, 50, 0.346345426431271,
- 1, "Total", 0.245646337810546, 0.298319278415003, 1.16098908616109,
+ 1, "m", "Total", 0.245646337810546, 0.298319278415003, 1.16098908616109,
-0.0593588646633562, 1.32414011014332, 84, 0.632390622739984,
- 0, "Total", 0.0731682257485846, 0.352939897293916, 1.79177992510536,
+ 0, "m", "Total", 0.0731682257485846, 0.352939897293916, 1.79177992510536,
-0.399560650103491, 1.14344393973503, 84, 0.371941644815769,
- 1, "Total", 0.344710123648147, 0.39363085291606, 0.944899623747441,
+ 1, "m", "Total", 0.344710123648147, 0.39363085291606, 0.944899623747441,
-0.0244283163085191, 0.0234847144242383, 16, -0.000471800942140402,
- 0, "Total indirect", 0.969209589795566, 0.0122229365209487,
+ 0, "m", "Total indirect", 0.969209589795566, 0.0122229365209487,
-0.0385996394018566, -0.0318355292516048, 0.033119927916608,
- 16, 0.000642199332501614, 1, "Total indirect", 0.969085398826703,
+ 16, 0.000642199332501614, 1, "m", "Total indirect", 0.969085398826703,
0.0165705741739576, 0.0387554061651586, -0.0144875372254733,
- 0.0139308636248141, 50, -0.000278336800329581, 0, "Total indirect",
+ 0.0139308636248141, 50, -0.000278336800329581, 0, "m", "Total indirect",
0.969374551226098, 0.00724972526904785, -0.0383927376555797,
-0.0413456780600054, 0.0430170050086302, 50, 0.000835663474312435,
- 1, "Total indirect", 0.969026515646823, 0.0215214880819438,
+ 1, "m", "Total indirect", 0.969026515646823, 0.0215214880819438,
0.0388292608359895, -0.00379203726602771, 0.00368890300389759,
- 84, -5.15671310650621e-05, 0, "Total indirect", 0.978443309502044,
+ 84, -5.15671310650621e-05, 0, "m", "Total indirect", 0.978443309502044,
0.00190843819808272, -0.0270205926064927, -0.0525714502863859,
- 0.0546963165735398, 84, 0.00106243314357695, 1, "Total indirect",
+ 0.0546963165735398, 84, 0.00106243314357695, 1, "m", "Total indirect",
0.969029984491913, 0.0273647290730952, 0.0388249100051032))
@@ -2410,7 +2426,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 11 - continuous works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -2421,23 +2437,23 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "contGamma", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "contGamma", processType = "moderators",
- processVariable = "contcor1"), list(processDependent = "debCollin1",
- processIndependent = "contcor1", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "contGamma", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "contGamma", processType = "moderators",
+ processVariable = "contcor1"), list(processDependent = "debCollin1",
+ processIndependent = "contcor1", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -2556,23 +2572,23 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
"Total", 0.541026398758971, 0.0695098371365996, -0.611261614564372,
-0.175370090297307, 0.0962926193307853, 84, 84, -0.0395387354832607,
"Total", 0.568325096064287, 0.0693029850984337, -0.570519948413511,
- -0.0182490048294261, 0.022270434192922, 16, 16, 0.00201071468174793,
- "Total indirect", 0.845768438730284, 0.01033678152812, 0.194520381056523,
- -0.0189871780752168, 0.0231274055423588, 50, 16, 0.00207011373357102,
- "Total indirect", 0.847208495009883, 0.0107437136472328, 0.192681395050417,
- -0.0212171785979163, 0.0254870590963387, 84, 16, 0.00213494024921119,
- "Total indirect", 0.857790538899785, 0.0119145652835083, 0.17918742299111,
- -0.00635092664172057, 0.00674081319211249, 16, 50, 0.00019494327519596,
- "Total indirect", 0.953453987043079, 0.00333979091888908, 0.0583699039641691,
- -0.0135227618404186, 0.0164655116432874, 50, 50, 0.0014713749014344,
- "Total indirect", 0.847482702061777, 0.00765021034066176, 0.192331300175352,
- -0.0260583020096531, 0.0317871775920513, 84, 50, 0.00286443779119912,
- "Total indirect", 0.846089700680365, 0.0147567710575251, 0.194110065137754,
- -0.0250044388260874, 0.0211375997893015, 16, 84, -0.00193341951839295,
- "Total indirect", 0.869533737246054, 0.0117711445157542, -0.164250767272911,
- -0.009955133764027, 0.0114942559419666, 50, 84, 0.000769561088969798,
- "Total indirect", 0.888155014681053, 0.00547188363540954, 0.140639154676066,
- -0.033219418610941, 0.0406584603748081, 84, 84, 0.00371952088193355,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
+ "Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409,
+ -0.033219418610941, 0.0406584603748081, 0.00371952088193355,
"Total indirect", 0.843548840135208, 0.0188467440137902, 0.197356152299409
))
@@ -2590,7 +2606,7 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
})
test_that("Test that model number 11 - factor works", {
-
+
options <- jaspTools::analysisOptions("ClassicProcess")
options$dependent <- "contNormal"
options$covariates <- list("contGamma", "contcor1", "contcor2", "debCollin1")
@@ -2601,23 +2617,23 @@ options$errorCalculationMethod <- "standard"
options$naAction <- "fiml"
options$emulation <- "lavaan"
options$estimator <- "default"
-options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
+options$moderationProbes <- list(list(probePercentile = 16, value = "16"), list(probePercentile = 50,
value = "50"), list(probePercentile = 84, value = "84"))
options$pathPlotsLegend <- TRUE
options$pathPlotsColorPalette <- "colorblind"
-options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
- inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
- modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
- modelNumberMediators = list(), modelNumberModeratorW = "",
- modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
- processRelationships = list(list(processDependent = "contNormal",
- processIndependent = "facGender", processType = "mediators",
- processVariable = "debCollin1"), list(processDependent = "debCollin1",
- processIndependent = "facGender", processType = "moderators",
- processVariable = "facExperim"), list(processDependent = "debCollin1",
- processIndependent = "facExperim", processType = "moderators",
- processVariable = "contcor2")), residualCovariances = TRUE,
- statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
+options$processModels <- list(list(conceptualPathPlot = TRUE, independentCovariances = TRUE,
+ inputType = "inputVariables", mediationEffects = TRUE, mediatorCovariances = TRUE,
+ modelNumber = 1, modelNumberCovariates = list(), modelNumberIndependent = "",
+ modelNumberMediators = list(), modelNumberModeratorW = "",
+ modelNumberModeratorZ = "", name = "Model 1", pathCoefficients = TRUE,
+ processRelationships = list(list(processDependent = "contNormal",
+ processIndependent = "facGender", processType = "mediators",
+ processVariable = "debCollin1"), list(processDependent = "debCollin1",
+ processIndependent = "facGender", processType = "moderators",
+ processVariable = "facExperim"), list(processDependent = "debCollin1",
+ processIndependent = "facExperim", processType = "moderators",
+ processVariable = "contcor2")), residualCovariances = TRUE,
+ statisticalPathPlot = TRUE, totalEffects = TRUE, localTests = FALSE,
localTestType = "cis", localTestBootstrap = FALSE, localTestBootstrapSamples = 1000))
set.seed(1)
results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
@@ -2658,25 +2674,25 @@ results <- jaspTools::runAnalysis("ClassicProcess", "debug", options)
table <- results[["results"]][["parEstContainer"]][["collection"]][["parEstContainer_Model 1"]][["collection"]][["parEstContainer_Model 1_mediationEffectsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0.0622024992020542, 0.868598726140512, "", 0.465400612671283,
- "", "facGenderm", "contNormal", "", "", "", 0.0236768306572079,
+ "", "m", "facGender", "contNormal", "", "", "", 0.0236768306572079,
0.205717103298634, 2.26233310312402, -0.00502186744432948, 0.00513639658203032,
- 16, 5.72645688504206e-05, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.982370122140312, 0.0025914415026212,
+ 16, 5.72645688504206e-05, 0, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.982370122140312, 0.0025914415026212,
0.0220975734132909, -0.0157840291533143, 0.016181006251643,
- 16, 0.000198488549164307, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980580612317733, 0.00815449560734112,
+ 16, 0.000198488549164307, 1, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980580612317733, 0.00815449560734112,
0.0243409965155438, -0.011149058111866, 0.0114296246961494,
- 50, 0.000140283292141703, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980569563261315, 0.00575997390414138,
+ 50, 0.000140283292141703, 0, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980569563261315, 0.00575997390414138,
0.0243548485594423, -0.0349764678843367, 0.0341117434797597,
- 50, -0.000432362202288511, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980428759128093, 0.0176248675764084,
+ 50, -0.000432362202288511, 1, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980428759128093, 0.0176248675764084,
-0.0245313730962294, -0.0188291244993071, 0.0193043124562885,
- 84, 0.000237593978490679, 0, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980514818600596, 0.00972809634676639,
+ 84, 0.000237593978490679, 0, "m", "facGender", "debCollin1",
+ "contNormal", "", "", 0.980514818600596, 0.00972809634676639,
0.0244234812260731, -0.0947410135891975, 0.0923973813630137,
- 84, -0.00117181611309188, 1, "facGenderm", "debCollin1", "contNormal",
- "", "", 0.980417366068978, 0.0477402637059494,
+ 84, -0.00117181611309188, 1, "m", "facGender", "debCollin1",
+ "contNormal", "", "