set_sel_priors: Create Selection Matrix from Prior

View source: R/ABC_functions.R

set_sel_priorsR Documentation

Create Selection Matrix from Prior

Description

Creates a random selection matrix according to either a Uniform, Normal, or Gamma prior distribution

Usage

set_sel_priors(n.spec, n.sites, distr, input1, input2)

Arguments

n.spec

Numeric, the number of species in the metacommunity

n.sites

Numeric, the number of communities in the metacommunity

distr

Either a 1, 2, or 3, corresponding to Uniform, Normal, and Gamma prior distributions respectively.

input1, input2

Numeric, parameters for prior distributions. See details.

Details

Creates a random selection coeffient matrix according to a prior distribution. Selection coefficients are randomly selected for species in each community according to the prior. If distr = 1, then input 1 is the minimum and input 2 is the maximum. If distr = 2, then input 1 is the mean and input 2 is the standard deviation. if distr = 3, then input 1 is the shape parameter, and input 2 is the scale parameter.

Value

A selection matrix where columns are species, rows are communities and cell ij is the selection coefficient for species j in community i.

Examples


# For Uniform distribution
set_sel_priors(5, 5, distr = 1, input1 = .1, input2 = 1)

# For Normal distribution
set_sel_priors(5, 5, distr = 2, input1 = .5, input2 = .2)

# For Gamma Distribution
set_sel_priors(5, 5, distr = 3, input1 = 2, input2 = .2)


trevorjwilli/CommSimABCR documentation built on Feb. 4, 2025, 1:22 a.m.