mp_mantel {MicrobiotaProcess} | R Documentation

## Mantel and Partial Mantel Tests for MPSE or tbl_mpse Object

### Description

Mantel and Partial Mantel Tests for MPSE or tbl_mpse Object

### Usage

    mp_mantel(
      .data,
      .abundance,
      .y.env,
      .z.env = NULL,
      distmethod = "bray",
      distmethod.y = "euclidean",
      distmethod.z = "euclidean",
      method = "pearson",
      permutations = 999,
      action = "get",
      seed = 123,
      scale.y = FALSE,
      scale.z = FALSE,
      ...
    )

    ## S4 method for signature 'MPSE'
    mp_mantel(
      .data,
      .abundance,
      .y.env,
      .z.env = NULL,
      distmethod = "bray",
      distmethod.y = "euclidean",
      distmethod.z = "euclidean",
      method = "pearson",
      permutations = 999,
      action = "get",
      seed = 123,
      scale.y = FALSE,
      scale.z = FALSE,
      ...
    )

    ## S4 method for signature 'tbl_mpse'
    mp_mantel(
      .data,
      .abundance,
      .y.env,
      .z.env = NULL,
      distmethod = "bray",
      distmethod.y = "euclidean",
      distmethod.z = "euclidean",
      method = "pearson",
      permutations = 999,
      action = "get",
      seed = 123,
      scale.y = FALSE,
      scale.z = FALSE,
      ...
    )

    ## S4 method for signature 'grouped_df_mpse'
    mp_mantel(
      .data,
      .abundance,
      .y.env,
      .z.env = NULL,
      distmethod = "bray",
      distmethod.y = "euclidean",
      distmethod.z = "euclidean",
      method = "pearson",
      permutations = 999,
      action = "get",
      seed = 123,
      scale.y = FALSE,
      scale.z = FALSE,
      ...
    )

### Arguments

`.data` | MPSE or tbl_mpse object
`.abundance` | the name of otu abundance to be calculated
`.y.env` | the column names of continuous environment factors to perform Mantel statistic, it is required.
`.z.env` | the column names of continuous environment factors to perform Partial Mantel statistic based on this, default is NULL.
`distmethod` | character the method to calculate distance based on .abundance.
`distmethod.y` | character the method to calculate distance based on .y.env.
`distmethod.z` | character the method of calculated distance based on .z.env
`method` | character Correlation method, options is "pearson", "spearman" or "kendall"
`permutations` | the number of permutations required, default is 999.
`action` | character, "add" joins the mantel result to the internal attributes of the object, "only" and "get" return 'mantel' or 'mantel.partial' (if .z.env is provided) object.
`seed` | a random seed to make the analysis reproducible, default is 123.
`scale.y` | logical whether scale the environment matrix (.y.env) before the distance is calculated, default is FALSE
`scale.z` | logical whether scale the environment matrix (.z.env) before the distance is calculated, default is FALSE
`...` | additional parameters, see also `mantel`.

### Value

update object or tibble according the 'action'

### See Also

`mantel`

### Examples

    library(vegan)
    data(varespec, varechem)
    mpse <- MPSE(assays=list(Abundance=t(varespec)), colData=varechem)
    mpse %>% mp_mantel(.abundance=Abundance,
                       .y.env=colnames(varechem),
                       distmethod.y="euclidean",
                       scale.y = TRUE
                       )

[Package MicrobiotaProcess version 1.4.4 Index]