| Title: | Generalized Correlation and Related Measures |
| Version: | 0.1.0 |
| Depends: | R (≥ 4.0.0) |
| Description: | Generalized correlation and related measures for assessing nonlinear relationships between variables, including mixed-type data. For methodological background, see https://r-suzuki.github.io/gcor/method.html. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| URL: | https://github.com/r-suzuki/gcor-r |
| BugReports: | https://github.com/r-suzuki/gcor-r/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-03-17 07:43:15 UTC; ryota |
| Author: | Ryota Suzuki [aut, cre] |
| Maintainer: | Ryota Suzuki <suzuki@ef-prime.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-20 11:40:02 UTC |
Estimate generalized correlation and related measures
Description
Estimate generalized correlation and related measures, which includes:
Generalized correlation measure (
gcor)Directed generalized correlation measure (
dgcor)Dissimilarity between variables (
gdis)
Usage
gcor(
x,
y = NULL,
data = NULL,
dropNA = "none",
k = NULL,
max_levels = 100,
simplify = TRUE
)
dgcor(
x,
y = NULL,
data = NULL,
dropNA = "none",
k = NULL,
max_levels = 100,
simplify = TRUE
)
gdis(x, dropNA = "none", k = NULL, max_levels = 100, ...)
Arguments
x |
a vector, matrix, data frame or formula. If formula, |
y |
|
data |
|
dropNA |
a character specifying how to handle missing values. It should be one of the following:
|
k |
|
max_levels |
an integer specifying the maximum number of levels allowed when converting non-numeric variables to factors. |
simplify |
a logical. If |
... |
additional arguments ( |
Value
For gcor and dgcor, a numeric matrix is returned (or a vector if simplify = TRUE).
For gdis, an object of class "dist" is returned.
References
Suzuki, R. (2026). Method Overview of gcor. https://r-suzuki.github.io/gcor/method.html
Examples
# Generalized correlation measure
gcor(iris)
# Dependency of Species on other variables
dgc <- dgcor(Species ~ ., data = iris)
dotchart(sort(dgc), main = "Dependency of Species")
# Clustering
gd <- gdis(iris)
hc <- hclust(gd, method = "ward.D2")
plot(hc)
# Multidimensional scaling
mds <- cmdscale(gd, k = 2)
plot(mds, type = "n", xlab = "", ylab = "", asp = 1, axes = FALSE,
main = "cmdscale with gdis(iris)")
text(mds[,1], mds[,2], rownames(mds))