Description Usage Arguments Author(s) References See Also Examples
all combinations of parameter setting can be input as in the argument item "prange"
1 |
scale |
controlling the parameter's low value=parameter original value/scale; while parameter's high value=parameter original value*scale. Specifically used in the spatial types. |
dispersalscale |
the scale value for reducing the dispersal rates between the neighbouring patches, allowing the simulation slow down or speed up. |
allee |
allee effect for the species, the minimum viable population in a local patch, default=1, indicating that if the population size in a patch for a species is less than 1, then the species was removed from that patch |
T |
simulation time/steps |
prange |
the matrix listing out all combinations of parameter setting |
initp |
initial population size for a species that will be released at the source patch at each time step |
spnum |
number of species |
island |
number of patches |
sourcetype |
model configuration for the source supply methods, currently there are three types of source species supplying modes: "constant": constant population size of each species will be released at the source patch for each simulation step "flexible": random population size of each species will be released (all species should typically be assigned different values) based on a normal distribution with mean=initp, Variance=initp/2, at the source patch for each simulation step "cochange": random population size (but all species will be assigned a same value) at the source patch for each simulation step |
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 |
path |
local disk file name or folder to save the simulated outputs |
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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | ##---- 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 (scale = 2, dispersalscale = 51, allee = 1, T = 1000,
prange, initp,spnum = 2, island=10,sourcetype = "constant", type,
path = NULL)
{
parnum = spnum * 3
outcome <- list()
if (!is.list(prange)) {
length(outcome) <- length(prange)^parnum
}
else {
parlen <- vector()
length(parlen) <- length(prange)
for (i in 1:length(prange)) {
parlen[i] <- length(prange[[i]])
}
length(outcome) <- prod(parlen)
}
resource <- matrix(0, ncol = island, nrow = spnum)
grow <- resource
comp <- resource
for (i in 1:spnum) {
resource[i, ] <- parsetting(island, initp, scale, type[i])
}
outcomefile = filename.check(path)
if (!is.list(prange)) {
parcomb <- comblist(prange, parnum)
}
if (is.list(prange)) {
parcomb <- comblist2(prange)
}
comnum <- dim(parcomb)[1]
colnames(parcomb) <- c(paste("r", c(1:spnum), sep = ""),
paste("dis", c(1:spnum), sep = ""), paste("com", c(1:spnum),
sep = ""))
dismat <- list()
length(dismat) <- spnum
for (each in 1:comnum) {
typenum <- spnum
for (i in 1:spnum) {
grow[i, ] <- parsetting(island, rate = parcomb[each,
i], scale, type[typenum + i])
}
typenum <- spnum + typenum
for (i in 1:spnum) {
dismat[[i]] <- dispvar(island, rate = parcomb[each,
i + spnum]/dispersalscale, scale, type[typenum +
i])
}
typenum <- spnum + typenum
for (i in 1:spnum) {
comp[i, ] <- parsetting(island, rate = parcomb[each,
i + spnum * 2], scale, type[typenum + i])
}
spvector <- rbind(spabundance(island, 1000), spabundance(island,
1000))
for (j in 1:T) {
spvector <- flex.competition(spvector, resource,
grow, comp, allee)
spvector <- flex.dispersal(spvector, dismat, allee,
type = sourcetype)
}
outcome[[each]] <- spvector
write.table(outcome[[each]], file = outcomefile, sep = "\t",
append = TRUE)
outcome[[each]] <- list(abund = outcome[[each]], pars = parcomb[each,
])
}
return(outcome)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.