ssadSim: Simulate permuted SSADs

View source: R/ssadSim.R

ssadSimR Documentation

Simulate permuted SSADs

Description

Simulate many SSADs and permute them to understand the effect of permutation on the shape of the SSAD

Usage

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

Arguments

nsite

number of sites to simulate

nspp

number of species to simulate

mcCores

number of cores to use in parallel::mclapply

sadfun

function to generate random SAD sample

ssadfun

function to generate random SSAD sample

nsim

number of simulations to run

Details

Note, sadfun must be a function that takes a single argument n (number of species), e.g., function(n) pika::rfish(n, b = 0.1). Similarely, ssadfun must take both n (the number of sites) and also mu the mean abundance, e.g. function(n) rnbinom(n, size = 0.1, mu = mu).

Value

a data.frame with columns giving the z-score of the two negative binomial parameters, and the difference in AIC values of the negative binomial versus the Poisson

Author(s)

Andy Rominger <ajrominger@gmail.com>


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