Description Usage Arguments Value Examples
View source: R/SimulatedWorld.R
Function to simulate species distribution and abundance with a linearly increasing temperature. The argument temp_diff
specifies the range of temperature for the beginning and ending years (year 1 and year 100).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | SimulateWorld(
temp_diff = c(1, 3, 5, 7),
temp_spatial = c("simple", "matern"),
PA_shape = c("logistic", "logistic_prev", "linear"),
abund_enviro = c("lnorm_low", "lnorm_high", "poisson"),
covariates = c("temp"),
grid.size = 20,
n.year = 100,
start.year = 2000,
response.curve = list(temp = c(fun = "dnorm", mean = 4, sd = 1)),
convertToPA.options = list(linear = list(a = NULL, b = NULL, species.prevalence =
0.8), logistic_prev = list(beta = "random", alpha = -0.3, species.prevalence = 0.5),
logistic = list(beta = 0.5, alpha = -0.05, species.prevalence = NULL)),
verbose = FALSE
)
|
temp_diff |
specifies min and max temps at year 1 and year 100 (e.g. temp_diff=c(1,3,5,7) means year 1 varies from 1-3C and year 100 from 5-7C) |
temp_spatial |
specifies whether we have "simple" linear temp distbn (SB) or added "matern" variation (EW) |
PA_shape |
specifies how enviro suitability determines species presence-absence. takes values of "logistic" (SB original), "logistic_prev" (JS, reduces knife-edge), "linear" (JS, reduces knife edge, encourages more absences, currently throws errors) |
abund_enviro |
specifies abundance if present, can be "lnorm_low" (SB original), "lnorm_high" (EW), or "poisson" (JS, increases abundance range) |
covariates |
Currently only "temp" is allowed in this function |
grid.size |
Default is a 20x20 grid |
n.year |
Number of years to simulate. Default is 100. |
start.year |
For showing results choose the start year. |
response.curve |
The response curve passed to 'virtualspecies::formatFunctions'. All covariates in 'covariates' argument must have a response curve specified. |
convertToPA.options |
Values to pass to 'virtualspecies::convertToPA()' call. Defaults are linear=list(a=NULL, b=NULL, species.prevalence=0.8), logistic_prev=list(beta = "random", alpha = -0.3, species.prevalence = 0.5), logistic=list(beta=0.5, alpha=-0.05,species.prevalence=NULL)). To change, pass in a list with all the values for your PA_shape, e.g. list(a=1, b=0, species.prevalence=NULL) could be passed in if PA_shape is linear. |
verbose |
FALSE means print minimal progress, TRUE means print verbose progress output |
Returns an object of class OM
, which is a list with "grid" and "meta". "meta" has all the information about the simulation including all the parameters passed into the function.
1 2 3 4 5 6 | # use defaults
data <- SimulateWorld(start.year=2000, n.year=20)$grid
# plot time-series of total catch in observed years
plot(aggregate(abundance~year,data[data$year<=2010,], FUN="sum"),type="l",ylab="Abundance")
# plot time-series of total catch in forecast years
plot(aggregate(abundance~year,data[data$year>2010,], FUN="sum"),type="l", ylab="Abundance")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.