Description Usage Arguments Details Value Examples
View source: R/SimulatedWorld_ROMS.R
Function uses covariate data from ROMS to generate species distribution and abundance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | SimulateWorld_ROMS(
PA_shape = c("logistic", "logistic_prev", "linear"),
abund_enviro = c("lnorm_low", "lnorm_high", "poisson"),
covariates = c("sst"),
response.curve = list(sst = c(fun = "dnorm", mean = 15, sd = 4), chla = c(fun =
"dnorm", mean = 1.6, sd = 9)),
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)),
dir = file.path(here::here(), "Rasters_2d_monthly"),
roms.years = 1980:2100,
n.samples = 400,
maxN = 50,
verbose = FALSE
)
|
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, also specifies prevalence and fits 'b') |
abund_enviro |
specifies abundance if present, can be "lnorm_low" (SB original), "lnorm_high" (EW), or "poisson" (JS, increases abundance range) |
covariates |
A vector with "sst" and/or "chla". One or both can be listed. |
response.curve |
The response curve to use in |
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. |
dir |
(optional) The path to the directory where the folder 'gfdl' is. |
roms.years |
The years for the ROMS data. The data files use the year and month. Default is 1980:2100. |
n.samples |
The number of samples to take from the ROMS layers each year. Default is 400. |
maxN |
max mean abundance at highest suitability |
verbose |
FALSE means print minimal progress, TRUE means print verbose progress output |
The ROMS data are assumed to be in the working directory in a folder called 'Rasters_2d_monthly/gfdl/'. SST data are in a subfolder called 'sst_monthly'. If the ROMS data folder is different, you can pass that in via the 'dir' argument. However the ROMS data folder must have subfolders 'gfdl/sst_monthly' so that 'paste0(dir,"/gfdl/sst_monthly")' will find the SST ROMS data. Download ROMS data from here: https://www.dropbox.com/sh/aaezimxwq3glwdy/AABHmZbmfjVJM7R4jcHCi4c9a?dl=0 Caution: this function uses the downscaled GCMs to simulate species distrubtion. It has slight differences to the other SimulateWorld_function that 'randomly' generates environmental data. Remember: 1980-2010 are not observed data (by design)
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 7 8 9 10 | ## Not run:
test <- SimulateWorld_ROMS(PA_shape="logistic", abund_enviro="lnorm_low")
head(test)
tail(test)
plot(aggregate(suitability~year, data=test, FUN=mean),type='b')
plot(aggregate(pres~year, data=test, FUN=sum),type='b')
plot(aggregate(abundance~year, data=test, FUN=sum),type='b')
plot(aggregate(sst~year, data=test, FUN=mean),type='b')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.