mop: Identify similar points in two sets using mobility-oriented...

View source: R/mop.r

mopR Documentation

Identify similar points in two sets using mobility-oriented parity (MOP)

Description

This function takes two data frames or matrices that represent the environment of sites measured in univariate or multivariate space and returns the x-th percentile of sites in each set that are closest to each other in Euclidean space. Note that in many cases it is advisable to first transform the raw environmental values using, for example, PCA. MOP was first presented formally in Owens, H.L., Campbell, L.P., Dornak, L.L., Saupe, E.E., Barve, N., SoberĂ³n, Ingenloff, K., Lira-Noriega, A., Hensz, C., Myers, C.E., and Peterson, A.T. 2013. Constraints on interpretation of ecological niche models by limited environmental ranges on calibration area. Ecological Modeling 263:10-18.

Usage

mop(set1, set2, p, index = FALSE, cores = 1, na.rm = FALSE)

Arguments

set1

Data frame or matrix one or more columns wide.

set2

Data frame or matrix one or more columns wide.

p

Numeric value(s) in the range [0, 1]. The p-th percentile of sites in set1 and set2 that are closest to one another are returned. Note that if p = 1 then all sites in set1 and set2 are returned.

index

Logical, if TRUE then return the indices of the rows in set1 and set2 that correspond to each value of p. If FALSE then return data frames or matrices (depending on the class of set1 and set2).

cores

Integer >= 0, number of cores to use (can speed large computations).

na.rm

Logical, if TRUE then any rows in set1 or set2 with at least one NA are removed first.

Value

List with three elements. The first two elements correspond to set1 and set2. Each of these elements is a list the same length of p, with each data frame/matrix corresponding to a value of p. The third element is a matrix of statistics reporting the statistics pertaining to the environmental distances between each subset of set1 and set2.

See Also

mess

Examples

set1 <- data.frame(x1=1:20, x2=round(100 * rnorm(20)))
set2 <- data.frame(x1=sample(1:30, 30), x2=sort(round(100 * rnorm(30))))
# return data frames that are subsets of set1 and set2
out <- mop(set1, set2, p=c(0.1, 0.5))
out
# return indices of subsets of set1 and set2
out <- mop(set1, set2, p=c(0.1, 0.5), index=TRUE)
out

adamlilith/enmSdm documentation built on Jan. 6, 2023, 11 a.m.