Skip to content

Commit 23f709a

Browse files
authored
Merge pull request #1568 from exploratory-io/fix/issue-37294-pca-polychoric
feat(pca): support Polychoric correlation in do_prcomp (#37294)
2 parents 042127a + 2e494a2 commit 23f709a

4 files changed

Lines changed: 408 additions & 26 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: exploratory
22
Type: Package
33
Title: R package for Exploratory
4-
Version: 16.0.22
4+
Version: 16.0.23
55
Date: 2026-07-28
66
Authors@R: c(person("Hideaki", "Hayashi", email = "hideaki@exploratory.io", role = c("aut", "cre")), person("Hide", "Kojima", email = "hide@exploratory.io", role = c("aut")), person("Kan", "Nishida", email = "kan@exploratory.io", role = c("aut")), person("Kei", "Saito", email = "kei@exploratory.io", role = c("aut")), person("Yosuke", "Yasuda", email = "double.y.919.quick@gmail.com", role = c("aut")))
77
URL: https://github.com/exploratory-io/exploratory_func

R/factanal_correlation.R

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# =============================================================================
2-
# Correlation type selection / construction for Factor Analysis (issue #26623)
2+
# Correlation type selection / construction, shared by Factor Analysis (issue #26623) and
3+
# PCA (issue #37294). Keep the user-facing strings analysis-neutral -- both render them.
34
#
45
# Automatic selection rules (spec):
56
#
@@ -323,7 +324,7 @@ select_factor_correlation_type <- function(data, variables = names(data),
323324
if (any(detected_types == "nominal")) {
324325
nominal_variables <- variable_summary$variable[detected_types == "nominal"]
325326
warning_message <- sprintf(
326-
"Nominal categorical variables cannot be used directly in this factor analysis: %s",
327+
"Nominal categorical variables cannot be used directly in this analysis: %s",
327328
paste(nominal_variables, collapse = ", "))
328329
return(build_result("unsupported", "Unsupported", NA_character_, character(),
329330
warning_message, c(all_warnings, warning_message)))
@@ -631,7 +632,7 @@ unavailable_polychoric_diagnostics <- function() {
631632
"Categorical variables that have a category holding a very small share of the responses. Correlations estimated from categories may become unstable when categories are sparse.",
632633
"Variable pairs that have a category combination with no observations.",
633634
"Variable pairs whose correlation could not be estimated.",
634-
"Whether the estimated correlation matrix was positive definite, which factor analysis assumes, before any smoothing.",
635+
"Whether the estimated correlation matrix was positive definite, which the analysis assumes, before any smoothing.",
635636
"Whether the correlation matrix had to be smoothed to become positive definite."
636637
),
637638
status = rep("na", 6)
@@ -785,7 +786,7 @@ compute_polychoric_diagnostics <- function(data, cor_result, selection,
785786
"Categorical variables that have a category holding a very small share of the responses. Correlations estimated from categories may become unstable when categories are sparse.",
786787
"Variable pairs that have a category combination with no observations.",
787788
"Variable pairs whose correlation could not be estimated.",
788-
"Whether the estimated correlation matrix was positive definite, which factor analysis assumes, before any smoothing.",
789+
"Whether the estimated correlation matrix was positive definite, which the analysis assumes, before any smoothing.",
789790
"Whether the correlation matrix had to be smoothed to become positive definite."
790791
),
791792
status = c(category_status, sparse_status, empty_status, failure_status, definite_status, smoothed_status)

0 commit comments

Comments
 (0)