Description Usage Arguments Author(s) References See Also Examples
dispersal parameters' matrix
1 |
island |
patch number in the simulation |
rate |
basal dispersal rate across the patches |
scale |
controlling the parameter's low value=parameter original value/scale; while parameter's high value=parameter original value*scale. |
type |
a model configuration vector describing the spatial patterns of each of the parameters, for example, a vector like this, c("decrease","decrease","decrease","increase","increase","increase","mosaiclow") can be used as the input. There are 5 simple spatial types currently for the package: "decrease",the parameter will have one-time decreasing transition from source patch to other sink patches in the middle of the patches "increase",the parameter will have one-time increasing transition from source patch to other sink patches in the middle of the patches "constant",the parameter will keep in a constant value across the patches during the simulation "mosaiclow",the parameter will switch from a low value to a high value one-by-one from the source patch to sink patches, so source patch the parameter for the species there will be assigned a low value "mosaichigh",the parameter will switch from a high value to a low value one-by-one from the source patch to sink patches,so source patch the parameter for the species there will be assigned a high value |
Youhua Chen <yhchen@zoology.ubc.ca>
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.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ##---- 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 (island, rate = 0.5, scale = 2, type = "decrease")
{
dismat <- matrix(0, ncol = island, nrow = island)
if (type == "decrease") {
for (i in 1:as.integer((island - 1)/2)) {
dismat[i, i + 1] = rate
}
for (i in (as.integer((island - 1)/2) + 1):(island -
1)) {
dismat[i, i + 1] = rate/scale
}
diag(dismat) <- 1 - rowSums(dismat)
}
if (type == "increase") {
for (i in 1:as.integer((island - 1)/2)) {
dismat[i, i + 1] = rate/scale
}
for (i in (as.integer((island - 1)/2) + 1):(island -
1)) {
dismat[i, i + 1] = rate
}
diag(dismat) <- 1 - rowSums(dismat)
}
if (type == "constant") {
for (i in 1:(island - 1)) {
dismat[i, i + 1] = rate
}
diag(dismat) <- 1 - rowSums(dismat)
}
if (type == "mosaiclow") {
for (i in 1:(island - 1)) {
if (i%%2 == 0) {
dismat[i, i + 1] = rate
}
else {
dismat[i, i + 1] = rate/scale
}
}
diag(dismat) <- 1 - rowSums(dismat)
}
if (type == "mosaichigh") {
for (i in 1:(island - 1)) {
if (i%%2 == 0) {
dismat[i, i + 1] = rate/scale
}
else {
dismat[i, i + 1] = rate
}
}
diag(dismat) <- 1 - rowSums(dismat)
}
return(dismat)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.