sta.mcomparison: posterior different parameter rate comparison for a single...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/coexist.R

Description

Analyze and compare the number of patches that allowed different coexistence cases (for example 2 species coexistence, 3 species coexistence and so on) for the sampling points of the focused parameter (while partialling out the influence of other parameters by taking average).

Usage

1
sta.mcomparison(coexistence, coenum, island, spnum, parameters)

Arguments

coexistence

The output from sta.mcoexistence() function,which is a matrix, of columns from left to right are the countings of patch numbers that only allowed the survival of a single species (each of the total species number), then followed by the countings of patches that allowed the coexistence of 2 species, 3 species,... until the column that all the species can coexist. After these columns, the others are values for each parameter combination.

coenum

coexisting species number in a patch you want to explore. Should be >=2 and <=total species number

island

number of patches in the model

spnum

number of species in the model

parameters

a vector for showing sampling points for a parameter, for example c(.2,.5,.9), indicating three sampling points in a single parameter

Value

will return a list, each list member is a matrix for one parameter.

Author(s)

Youhua Chen <yhchen@zoology.ubc.ca>

References

Chen YH (2012) coexist: an R package for performing species coexistence modeling and analysis under asymmetric dispersal and fluctuating source-sink dynamics. http://code.google.com/p/coexist.

See Also

sta.comparison, batch.monepar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (coexistence, coenum, island, spnum, parameters = parspace) 
{
    comparisonlist <- list()
    length(comparisonlist) <- dim(coexistence)[2] - 2 * spnum
    conum <- matrix(0, ncol = length(parameters) + 1, nrow = island)
    colnames(conum) <- c("coe.num", paste("=", parameters, sep = ""))
    for (pars in 1:length(comparisonlist)) {
        for (i in 1:(island - 1)) {
            conum[i, 1] = island - i
            for (j in 1:length(parameters)) {
                conum[i, j + 1] <- length(which(coexistence[, 
                  spnum + coenum] == island - i & coexistence[, 
                  pars + 2 * spnum] == parameters[j]))
            }
        }
        for (j in 1:length(parameters)) {
            conum[island, j + 1] = length(which(coexistence[, 
                spnum + coenum] == parameters[j]))
        }
        comparisonlist[[pars]] <- conum
    }
    names(comparisonlist) <- colnames(coexistence[, (2 * spnum + 
        1):dim(coexistence)[2]])
    return(comparisonlist)
  }

coexist documentation built on May 2, 2019, 1:43 p.m.