Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion R/exploratoryfactoranalysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ exploratoryFactorAnalysisInternal <- function(jaspResults, dataset, options, ...
# output functions
.efaKMOtest( modelContainer, dataset, options, ready)
.efaBartlett( modelContainer, dataset, options, ready)
.efaCorrelationDeterminant(modelContainer, dataset, options, ready)
.efaMardia( modelContainer, dataset, options, ready)
.efaAntiImageCorrelation( modelContainer, dataset, options, ready)
.efaGoodnessOfFitTable( modelContainer, dataset, options, ready)
Expand Down Expand Up @@ -291,6 +292,35 @@ exploratoryFactorAnalysisInternal <- function(jaspResults, dataset, options, ...
bartlettTable[["pval"]] <- bar[["p.value"]]
}

.efaCorrelationDeterminant <- function(modelContainer, dataset, options, ready) {
if (!isTRUE(options[["correlationMatrixDeterminant"]]) || !is.null(modelContainer[["determinantTable"]])) return()

determinantTable <- createJaspTable(gettext("Correlation Matrix Determinant"))
determinantTable$dependOn("correlationMatrixDeterminant")
determinantTable$addColumnInfo(name = "determinant", title = gettext("Determinant"), type = "number", format = "sf:4")
determinantTable$position <- 0.25
modelContainer[["determinantTable"]] <- determinantTable

if (!ready) return()

if (any(options$variables.types %in% c("ordinal", "nominal")) && options[["baseDecompositionOn"]] == "polyTetrachoricCorrelationMatrix") {
varTypes <- options$variables.types
vars <- options$variables
scales <- vars[varTypes == "scale"]
ordinals <- vars[varTypes == "ordinal"]
nominals <- vars[varTypes == "nominal"]
polyTetraCor <- psych::mixedCor(dataset, c = scales, p = ordinals, d = nominals)
corMatrix <- polyTetraCor$rho
} else {
if (options[["dataType"]] == "raw")
corMatrix <- stats::cor(dataset, use = "pairwise.complete.obs")
else
corMatrix <- stats::cov2cor(as.matrix(dataset))
}

determinantTable[["determinant"]] <- det(corMatrix)
}


.efaMardia <- function(modelContainer, dataset, options, ready) {

Expand Down Expand Up @@ -969,4 +999,3 @@ exploratoryFactorAnalysisInternal <- function(jaspResults, dataset, options, ...

}


8 changes: 7 additions & 1 deletion inst/qml/common/PcaEfaOutputOptions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ Section
label: qsTr("Bartlett's test")
info: qsTr("Determines if the data correlation matrix is the identity matrix, meaning, if the variables are related or not. A significant result means the correlation matrix is unlike the identity matrix.")
}
CheckBox {
visible: !pca
name: "correlationMatrixDeterminant"
label: qsTr("Correlation matrix determinant")
info: qsTr("Displays the determinant of the correlation matrix used for assessing multicollinearity before extraction.")
}
CheckBox {
name: "mardiaTest";
label: qsTr("Mardia's test")
Expand Down Expand Up @@ -172,4 +178,4 @@ Section
}
}

}
}
Loading