numstates_from_numareas {cladoRcpp} R Documentation

## Calculate the number of states, given a certain number of areas

### Description

This function calculates the number of discrete states that are needed to represent the possible combinations of presence and absence in a set of discrete areas. The number of states is a function of the number of areas, and the maximum allowed range size (in number of areas) of a species.

### Usage

numstates_from_numareas(numareas = 3, maxareas = numareas,
include_null_range = FALSE)


### Arguments

 numareas The number of areas in the analysis. maxareas The maximum number of areas that any single species/lineage can occupy. include_null_range If FALSE (default), the null range is not included in the count. If TRUE, the null range is included, adding +1 to the count of the states.

### Details

For example, with 3 areas (A, B, C), there are 8 possible states, if a null range is allowed (null, A, B, C, AB, BC, AC, ABC). If the maximum range size is 2 areas, then there are only 7 possible states.

The formula for the number of geographic states, based on the number of areas (N), is the sum of N choose k, from k=1 to m (maximum range size)

s = \sum_{k=1}^{m}{N\choose k}

This equation assumes that the null range (a species lives in no areas, i.e. is extinct) is not allowed. In the LAGRANGE program of ReeSmith2008), the null range is included in the transition matrix, and thus this is one more state. This situation is represented in numstates_from_numareas by setting include_null_range=TRUE.

Users might manually remove states from the states list, if prior information indicates that some configurations of presence/absence in areas are impossible as geographic ranges for species. If so, they should manually subtract from the number of states.

### Value

nstates Number of states

### Author(s)

Nicholas Matzke matzke@berkeley.edu

### See Also

convolve #bibliography /Dropbox/_njm/__packages/cladoRcpp_setup/cladoRcpp_refs.bib @cite Matzke_2013 @cite Matzke_2014 @cite ReeSmith2008

### Examples

numstates_from_numareas(numareas=3, maxareas=3,
include_null_range=FALSE)
numstates_from_numareas(numareas=3, maxareas=3,
include_null_range=TRUE)
numstates_from_numareas(numareas=3, maxareas=2,
include_null_range=TRUE)
numstates_from_numareas(numareas=3, maxareas=1,
include_null_range=TRUE)
numstates_from_numareas(numareas=7, maxareas=7,
include_null_range=TRUE)
numstates_from_numareas(numareas=7, maxareas=2,
include_null_range=TRUE)
numstates_from_numareas(numareas=8, maxareas=8,
include_null_range=TRUE)
numstates_from_numareas(numareas=8, maxareas=2,
include_null_range=TRUE)
numstates_from_numareas(numareas=20, maxareas=20,
include_null_range=TRUE)
numstates_from_numareas(numareas=20, maxareas=2,
include_null_range=TRUE)
numstates_from_numareas(numareas=20, maxareas=3,
include_null_range=TRUE)


[Package cladoRcpp version 0.15.1 Index]