项目作者: phytomosaic

项目描述 :
Measures of agreement for bootstrapped and reciprocal NMDS
高级语言: R
项目地址: git://github.com/phytomosaic/fitNMDS.git
创建时间: 2018-02-23T20:22:11Z
项目社区:https://github.com/phytomosaic/fitNMDS

开源协议:

下载


fitNMDS

Fitting resampled and reciprocal NMDS models.

Motivation

Combining two different datasets into one nonmetric multidimensional scaling (NMDS) model can be risky if they each cover different attribute spaces (e.g., different species pools in ecology). Therefore, comparing two datasets requires estimating internal sampling variability (using resampled NMDS) relative to external exchangeability (using reciprocal NMDS).

Installation

Install the package from github as follows:

  1. install.packages('devtools')
  2. devtools::install_github('phytomosaic/fitNMDS')
  3. require(fitNMDS)

Usage

Prepare two candidate datasets (here we just modify one)

  1. set.seed(231)
  2. data(smoky)
  3. spe1 <- smoky$spe
  4. env1 <- env2 <- smoky$env
  5. spe2 <- spe1 + abs(rnorm(prod(dim(spe1)), 0, 2)) # add noise
  6. tw <- twin(spe1, spe2, env1, env2)

Resampled NMDS of one dataset

  1. x <- spe1
  2. res <- resamp_nmds(x, k=2)
  3. summary(res)
  4. plot(res, col='#00000050')

Reciprocal NMDS of both datasets

  1. res <- recip_nmds(tw)
  2. summary(res)
  3. plot(res, noaxes=FALSE)

Correct unequal sample sizes prior to reciprocal NMDS

  1. # two candidate datasets, full and partial
  2. spe2 <- spe1[1:11,]
  3. env2 <- env1[1:11,]
  4. # subset the full matrix, based on compositional nearest neighbors...
  5. (i <- nearestspecies(spe1, spe2, ties=FALSE))
  6. spe1 <- spe1[i,,]
  7. env1 <- env1[i,,]
  8. # ...then proceed to reciprocal NMDS
  9. tw <- twin(spe1, spe2, env1, env2)
  10. res <- recip_nmds(tw)
  11. summary(res)
  12. plot(res) # expect near-perfect match