| ggcorrmat | R Documentation |
Correlation matrix containing results from pairwise correlation tests.
If you want a data frame of (grouped) correlation matrix, use
correlation::correlation() instead. It can also do grouped analysis when
used with output from dplyr::group_by().
ggcorrmat(
data,
cor.vars = NULL,
cor.vars.names = NULL,
matrix.type = "upper",
type = "parametric",
tr = 0.2,
partial = FALSE,
digits = 2L,
sig.level = 0.05,
conf.level = 0.95,
bf.prior = 0.707,
p.adjust.method = "holm",
colors = c("#EA4335", "white", "#4285F4"),
pch = "cross",
ggcorrplot.args = list(method = "square", outline.color = "black", pch.cex = 14),
ggtheme = ggstatsplot::theme_ggstatsplot(),
ggplot.component = NULL,
title = NULL,
subtitle = NULL,
caption = NULL,
...
)
data |
A data frame from which variables specified are to be taken. |
cor.vars |
Variables for which the correlation matrix is to be computed
and visualized, specified using |
cor.vars.names |
Optional list of names to be used for |
matrix.type |
Character, |
type |
A character specifying the type of statistical approach:
You can specify just the initial letter (e.g. |
tr |
Trim level for the mean when carrying out |
partial |
Can be |
digits |
Number of digits for rounding or significant figures. May also
be |
sig.level |
Significance level (Default: |
conf.level |
Scalar between |
bf.prior |
A number between |
p.adjust.method |
Adjustment method for p-values for multiple
comparisons. Possible methods are: |
colors |
A character vector of exactly three colors for the gradient:
low (negative correlations), mid (zero), and high (positive correlations).
Must be a diverging palette so that the sign of the correlation is
visually obvious.
Default: |
pch |
Decides the point shape to be used for insignificant correlation
coefficients. Default: |
ggcorrplot.args |
A list of additional (mostly aesthetic) arguments that
will be passed to |
ggtheme |
A |
ggplot.component |
A |
title |
The text for the plot title. |
subtitle |
The text for the plot subtitle. |
caption |
The text for the plot caption. If the insignificance marker
caption is shown (see |
... |
Currently ignored. |
Missing values are handled using pairwise deletion (each correlation uses all complete pairs of observations), in which case the legend shows the minimum, mode, and maximum sample size across pairs. Partial correlations use only complete cases.
For details, see: https://www.indrapatil.com/ggstatsplot/articles/web_only/ggcorrmat.html
A ggplot object, which can be further modified with {ggplot2}
functions. Note that extract_stats() does not return statistical
details for this plot; use correlation::correlation() instead.
| graphical element | geom used | argument for further modification |
| correlation matrix | ggcorrplot::ggcorrplot() | ggcorrplot.args |
The table below provides summary about:
statistical test carried out for inferential statistics
type of effect size estimate and a measure of uncertainty for this estimate
functions used internally to compute these details
Hypothesis testing and effect size estimation
| Type | Test | CI available? | Function used |
| Parametric | Pearson's correlation coefficient | Yes | correlation::correlation() |
| Non-parametric | Spearman's rank correlation coefficient | Yes | correlation::correlation() |
| Robust | Winsorized Pearson's correlation coefficient | Yes | correlation::correlation() |
| Bayesian | Bayesian Pearson's correlation coefficient | Yes | correlation::correlation() |
grouped_ggcorrmat ggscatterstats
grouped_ggscatterstats
set.seed(123)
ggcorrmat(iris)
# with data containing NAs (uses pairwise complete observations)
ggcorrmat(airquality)
# selecting specific variables
ggcorrmat(iris, cor.vars = c(Sepal.Length, Petal.Length, Petal.Width))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.