Skip to content

Commit

Permalink
Fix model summary footnotes
Browse files Browse the repository at this point in the history
  • Loading branch information
maltelueken committed Nov 8, 2023
1 parent 27a624a commit 1f545af
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions R/classicProcess.R
Original file line number Diff line number Diff line change
Expand Up @@ -1300,12 +1300,6 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
# Remove invalid models
procResults <- .procFilterFittedModels(procResults)

converged <- sapply(procResults, function(mod) mod@Fit@converged)

if (!all(converged)) {
summaryTable$addFootnote(message = gettext("At least one model did not converge."))
}

modelNames <- sapply(options[["processModels"]], function(mod) mod[["name"]])

modelNumbers <- lapply(options[["processModels"]], function(mod) {
Expand All @@ -1319,6 +1313,12 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
summaryTable[["Model"]] <- modelNames[!modelNumberIsInvalid]
summaryTable[["modelNumber"]] <- modelNumbers[!modelNumberIsInvalid]

converged <- sapply(procResults, function(mod) mod@Fit@converged)

if (any(!converged)) {
summaryTable$addFootnote(message = gettextf("The following models did not converge: %s.", modelNames[!modelNumberIsInvalid & !converged]))
}

if (length(procResults) == 0) return()

aic <- sapply(procResults, AIC)
Expand All @@ -1339,7 +1339,7 @@ ClassicProcess <- function(jaspResults, dataset = NULL, options) {
}

if (any(df == 0)) {
summaryTable$addFootnote(message = gettext("At least one model is saturated (df = 0)."))
summaryTable$addFootnote(message = gettextf("The following models are saturated (df = 0): %s.", modelNames[!modelNumberIsInvalid & df == 0]))
}

if (options$estimator %in% c("dwls", "gls", "wls", "uls")) {
Expand Down

0 comments on commit 1f545af

Please sign in to comment.