rcurve {sdm} | R Documentation |
Generate and plot response curves
Description
Calculate the response of species to the range of values in each predictor variable based on the fitted models in a sdmModels object.
Usage
rcurve(x,n,id,mean,fun,confidence,gg,...)
getResponseCurve(x,id,...)
Arguments
x |
A |
id |
specifies the modelIDs corresponding to the models in the sdmModels object for which the response curves should be generated |
n |
A vector with the name of variables for which the response curve should be generated |
mean |
logical, specifies whether a mean should be calculated over responses to a variable when multiple models are specified in ids |
fun |
character or function, (default="mean") specifies what function should be used to calculate the value of the variables over the presence locations (except the variable of interest) |
confidence |
logical, specifies whether a confidence interval should be added to the curve when the mean response curve is calculated based on multiple models |
gg |
logical, specifies whether the plot should be generated using the ggplot2 package (if the package is installed) |
... |
additional arguments passed to plot function |
Details
getResponseCurve
calculates the responses for the models that are specified in id
argument, and put the results in a .responseCurve
object. This object can be used as an input in the plot
function, or rcurve
function.
If you just need the response curve graphs (plots), you can put a sdmModels
object directly in the rcurve
function, and do not need to first use getResponseCurve
function.
In getResponseCurve
function (or in rcurve
when x
is sdmModels
), there are some additional arguments:
- size
: a numeric value; default is 100. Specifies the size of the variable sequence that is used as the x-axis in the response curve plot. Greater number results to a smoother curve.
- includeTest
: a logical value; default is FALSE; when a data object based on which a sdmModels is created containing independent test data; it specifies whether those records should be included into the response curve generation or not.
- ...
: additional arguments for the plot
function (e.g., xlab, ylab, main, col, lwd, lty)
Value
an object of class .responseCurve
or a series of graphs
Author(s)
Babak Naimi naimi.b@gmail.com
https://www.biogeoinformatics.org/
References
Naimi, B., Araujo, M.B. (2016) sdm: a reproducible and extensible R platform for species distribution modelling, Ecography, 39:368-375, DOI: 10.1111/ecog.01881
Examples
## Not run:
file <- system.file("external/model.sdm", package="sdm")
m <- read.sdm(file) # a sdmModels Object (fitted using sdm function)
rcurve(m)
rcurve(m,id=1) # for the first model
rcurve(m, id=1:2)
rcurve(m,method = 'glm',smooth = T) # only for models fitted using glm method & with smoothed curve
## End(Not run)