Description Usage Arguments Value Note Author(s)

View source: R/check_spatialcorr_nested.R

This function tests for positive spatial autocorrelation of the (uni- or multivariate) residuals, using either Moran's I or Mantel's test. This function essentially performs the task of `check_spatialcorr`

but within each island.

1 2 | ```
check_spatialcorr_nested(specdata, vars, plotit = T, test = "moran",
method = "bonferroni", model = "gls")
``` |

`specdata` |
A data frame containing at least columns for the dependent variables, as well as a column "island" and a column "habitat". |

`vars` |
A character or integer vector. The names, or indices, of the dependent variables in |

`plotit` |
Logical. Whether to plot residuals versus latitude and longitude. |

`test` |
A character, what test to perform. |

`method` |
A character, the method used for P-value correction. See |

`model` |
A character string, either |

A list of outputs, one per island. Either the output of the `mantel.test`

function from ape, or a table summarizing the (multiple) Moran's I test(s). If `plotit = T`

, also returns a scatter plot of the residuals versus latitude and longitude.

Beware that Mantel's test is a permutation test (999 permutations), and will take longer tha Moran's I test to run. Also, note that latitudes and longitudes are used to calculate geographical distances at the surface of the Earth using the Haversine distance function implemented in the package `geosphere`

.

Raphael Scherrer

rscherrer/sagreicolor documentation built on May 26, 2019, 12:32 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.