# pairs_mantel: Mantel test for a set of correlation matrices In metan: Multi Environment Trials Analysis

## Description

This function generate a pairwise matrix of plots to compare the similarity of two or more correlation matrices. In the upper diagonal are presented the plots and in the lower diagonal the result of Mantel test based on permutations.

## Usage

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 pairs_mantel( ..., type = 1, nrepet = 1000, names = NULL, prob = 0.05, diag = FALSE, export = FALSE, main = "auto", file.type = "pdf", file.name = NULL, width = 8, height = 7, resolution = 300, size.point = 0.5, shape.point = 19, alpha.point = 1, fill.point = NULL, col.point = "black", minsize = 2, maxsize = 3, signcol = "green", alpha = 0.15, diagcol = "gray", col.up.panel = "gray", col.lw.panel = "gray", col.dia.panel = "gray", pan.spacing = 0.15, digits = 2 ) 

## Arguments

 ... The input matrices. May be an output generated by the function lpcor or a coerced list generated by the function as.lpcor type The type of correlation if an obect generated by the function lpcor is used. 1 = Linear correlation matrices, or 2 = partial correlation matrices. nrepet The number of permutations. Default is 1000 names An optional vector of names of the same length of ... . prob The error probability for Mantel test. diag Logical argument. If TRUE, the Kernel density is shown in the diagonal of plot. export Logical argument. If TRUE, then the plot is exported to the current directory. main The title of the plot, set to 'auto'. file.type The format of the file if export = TRUE. Set to 'pdf'. Other possible values are *.tiff using file.type = 'tiff'. file.name The name of the plot when exported. Set to NULL, i.e., automatically. width The width of the plot, set to 8. height The height of the plot, set to 7. resolution The resolution of the plot if file.type = 'tiff' is used. Set to 300 (300 dpi). size.point The size of the points in the plot. Set to 0.5. shape.point The shape of the point, set to  19. alpha.point The value for transparency of the points: 1 = full color. fill.point The color to fill the points. Valid argument if points are between 21 and 25. col.point The color for the edge of the point, set to black. minsize The size of the letter that will represent the smallest correlation coefficient. maxsize The size of the letter that will represent the largest correlation coefficient. signcol The colour that indicate significant correlations (based on the prob value.), set to 'green'. alpha The value for transparency of the color informed in signcol, when 1 = full color. Set to 0.15. diagcol The color in the kernel distribution. Set to 'gray'. col.up.panel, col.lw.panel, col.dia.panel The color for the opper, lower and diagonal pannels. Set to 'gray', 'gray', and 'gray', respectively. pan.spacing The space between the pannels. Set to 0.15. digits The number of digits to show in the plot.

## Value

An object of class gg, ggmatrix.

## Author(s)

Tiago Olivoto tiagoolivoto@gmail.com

mantel_test()
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 library(metan) # iris dataset lpc <- iris %>% group_by(Species) %>% lpcor() %>% pairs_mantel(names = c('setosa', 'versicolor', 'virginica')) # mtcars dataset mt_num <- select_numeric_cols(mtcars) lpdata <- as.lpcor(cor(mt_num[1:5]), cor(mt_num[1:5]), cor(mt_num[2:6]), cor(mt_num[4:8])) %>% pairs_mantel()