response: Generate and plot response curves

Description Usage Arguments Details Value Author(s) References Examples

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

1
2
3
rcurve(x,n,id,mean,confidence,gg,...)
     
getResponseCurve(x,id,...)

Arguments

x

A sdmModels object; in the function response, it can be a .responseCurve object which is the output of the getResponse function

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

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

http://r-gis.net

http://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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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)

Example output

Loading required package: sp
sdm 1.0-67 (2019-02-26)
The id is missing; the first successfully fitted model is considered, i.e., id = 1
Loading required package: dismo
Loading required package: raster
Loading required package: gbm
Loaded gbm 2.1.5
Loading required package: tree
Loading required package: mda
Loading required package: class
Loaded mda 0.4-10

Loading required package: mgcv
Loading required package: nlme

Attaching package: 'nlme'

The following object is masked from 'package:raster':

    getData

This is mgcv 1.8-28. For overview type 'help("mgcv-package")'.
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16

Loading required package: earth
Loading required package: Formula
Loading required package: plotmo
Loading required package: plotrix
Loading required package: TeachingDemos
Loading required package: rJava
Loading required package: RSNNS
Loading required package: Rcpp
Loading required package: randomForest
randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.
Loading required package: rpart
Loading required package: kernlab

Attaching package: 'kernlab'

The following objects are masked from 'package:raster':

    buffer, rotated

Loading required package: ggplot2

Attaching package: 'ggplot2'

The following object is masked from 'package:kernlab':

    alpha

The following object is masked from 'package:randomForest':

    margin

The id is missing; the first successfully fitted model is considered, i.e., id = 1

sdm documentation built on April 30, 2020, 1:04 a.m.