simPlusMinus: Explore the effect of using the independent swap algorithm on...

View source: R/simPlusMinus.R

indSwapTestR Documentation

Explore the effect of using the independent swap algorithm on inference of connection between abundance and positive or negative association networks

Description

This is largely a copy of the function simPlusMinus but using the independent swap algorithm from {picante}

Simulate spatial replicates of abundance data and apply the same analytical pipeline to those data that would be applied to real data

Usage

indSwapTest(sadStats, mcCores, ssadType = "nbinom", kfun, nsim)

simPlusMinus(sadStats, mcCores, ssadType = "nbinom", kfun, nsim)

simpleSim(nsite, nspp, mcCores, sadfun, ssadfun, nsim)

Arguments

sadStats

a data.frame with columns mod, par1, par2

mcCores

number of cores to use in parallel::mclapply

ssadType

string specifying SSAD shape (e.g. 'nbinom')

kfun

function to relate k parameter of the SSAD to abundance

nsim

number of simulations to run

nsite

number of sites to simulate

nspp

number of species to simulate

sadfun

function to generate random SAD sample

ssadfun

function to generate random SSAD sample

Details

simPlusMinus draws random SAD and SSAD shapes from the raw data and uses these to simulate more data and calculate network statistics on those simulated data. simpleSim assumes one SAD and one SSAD and simulates data from those, again calculated network statistics.

Note: any value passed to ssadType other than 'nbinom' results in a Poisson SSAD (i.e., there are only two options, negative binomial specified by 'nbinom' or Poisson specified by anything else)

Value

a data.frame with <= nsim rows (some simulations may be thrown out if they do not meet data filtering requirements), and columns corresponding to summary statistics about the positive and negative network characteristics

a data.frame with <= nsim rows (some simulations may be thrown out if they do not meet data filtering requirements), and columns corresponding to summary statistics about the positive and negative network characteristics

Author(s)

Andy Rominger <ajrominger@gmail.com>

Andy Rominger <ajrominger@gmail.com>


ajrominger/ssadAssociation documentation built on Sept. 29, 2023, 4:43 a.m.