# Analysis: Mantel, Partial Mantel Tests, and Multiple Regressions... In kyarlagadda/499-project: Network Analysis in R

## Description

This function runs the Mantel test from the `vegan` package for each pair of variables. In the case of 3 matrices, every combination of pairwise mantel tests is run, as well as the partial mantel test. In addition, this function utilizes MRQAP DSP from the `asnipe` package. In the case of two matrices, it runs the regression once; with two matrices, it runs the regression three times, with every combination of pairwise tests, treating the second matrix as dependent every time. To correctly order the matrices for this purpose, please read the `x_list` argument entry.

## Usage

 ```1 2``` ```Analysis(x_list, permutations = 5000, intercept = TRUE, directed = "undirected", diagonal = FALSE, test.statistic = "beta", tol = 1e-07, randomisations = 5000) ```

## Arguments

 `x_list` A list of 2 or 3 matrices, ideally formatted by the `Verify` function. For the statistical tests to be applied correctly, the first matrix should represent the independent variable, and the remaining matrices the dependent variables. In the case of three matrices, the function will also run the regression treating the third variable as independent and the second variable as dependent. `permutations` The number of times each matrix is permutated for the Mantel test. Default value is `5000`. `intercept` Boolean for whether or not MRQAP DSP calculates the intercept in it's regression. Default is `TRUE`. `directed` Whether or not the networks provided to the MRQAP DSP are `"directed"` or `"undirected"`. Default is `"undirected"`. `diagonal` Boolean for whether or not MRQAP DSP includes the repeated values across the diagonal. Default is `FALSE`. `test.statistic` Which test statistic is calculated: `"t-value"` or `"beta"`. Default is `"beta"`. `tol` Tolerance value for the matrix decomposition. Default is `1e-07`. `randomisations` The number of times the matrices are randomized when determining the p-value. Default is `5000`

## Details

This function relies on the `vegan` package for the mantel and partial mantel test. The permutations argument is passed to these functions. The `asnipe` package is necessary for the application of the MRQAP DSP test. The remaining arguments are passed to this function as parameters.

## Value

If the list provided contains two matrices, the function will return a list of length 2, with the results of the mantel test and MRQAP DSP regression. If the list contains 3 matrices, the function will return a list of length 7, with each permutation of two variables (keeping the dependent variable constant) run through the mantel test and MRQAP regression, as well as the partial mantel test result from all 3 variables.

## References

Dekker, D., Krackhard, D., Snijders, T.A.B (2007) Sensitivity of MRQAP tests to collinearity and autocorellation conditions. Psychometrika 72(4): 563-581.

Legendre, P. and Legendre, L. (2012) Numerical Ecology. 3rd English Edition. Elsevier.

`Verify`

`Output.table`

`vegan` package in R

`asnipe` package in R

## Examples

 ``` 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``` ```a <- matrix(c(0,0.0106,0.384,0.0106,0,0.002,0.384,0.002,0), nrow=3, ncol=3, byrow = TRUE) colnames(a) <- c("Sample1","Sample2","Sample3") b <- matrix(c(0,0.014,0.0352,0.014,0,0.0235,0.0352,0.0235,0), nrow=3, ncol=3, byrow = TRUE) colnames(b) <- c("Sample1","Sample2","Sample3") example.list <- list(a,b) Example.analysis <- Analysis(example.list,permutations=5) Example.analysis a <- matrix(c(0,0.0106,0.384,0.0106,0,0.002,0.384,0.002,0), nrow=3, ncol=3, byrow = TRUE) colnames(a) <- c("Sample1","Sample2","Sample3") rownames(a) <- c("Sample1","Sample2","Sample3") b <- matrix(c(0,0.014,0.0352,0.014,0,0.0235,0.0352,0.0235,0), nrow=3, ncol=3, byrow = TRUE) colnames(b) <- c("Sample1","Sample2","Sample3") rownames(b) <- c("Sample1","Sample2","Sample3") c <- matrix(c(0,0.04,0.02,0.04,0,0.01,0.02,0.01,0), nrow=3, ncol=3, byrow = TRUE) colnames(c) <- c("Sample1","Sample2","Sample3") rownames(c) <- c("Sample1","Sample2","Sample3") example.list <- list(a,b,c) Example.analysis <- Analysis(example.list,permutations=5) Example.analysis ```

kyarlagadda/499-project documentation built on May 13, 2019, 6:15 p.m.