Learn R Programming

MIAmaxent (version 0.4.0)

plotResp: Plot single-effect model response.

Description

plotResp plots the single-effect response of a given Maxent model over any of the included explanatory variables (EVs) in that model. For categorical variables, a bar plot is returned rather than a scatter plot. plotResp also returns a data frame containing the plotted data (for customizable graphics). Single-effect response curves present the response of a model containing the explanatory variable of interest only (cf. marginal-effect response curves; plotResp2).

Usage

plotResp(data, dvdata, EV, dir = NULL, logscale = FALSE, ...)

Arguments

data
Data frame containing the response variable in the first column and explanatory variables in subsequent columns. The response variable should represent presence/background data, coded as: 1/NA. See readData.
dvdata
List of explanatory variables used to train the model, where each list item is a data frame containing selected DVs for a selected EV (e.g. the first item in the list returned by selectEV).
EV
Name or list index of the explanatory variable in dvdata for which the response curve is to be generated. Interaction terms not allowed.
dir
Directory to which files will be written. Defaults to the working directory.
logscale
Logical. Plot the common logarithm of PRO rather than PRO itself.
...
Arguments to be passed to plot to control the appearance of the plot. For example:
  • cex for size of points
  • col for color
  • pch for type

Value

In addition to the graphical output, the plotted data is returned. In the case of a continuous EV, the plotted data is a list of 2:
  1. respPts. Model response across individual data points. Columns in this data frame represent the following: EV value ("EV"), Probability Ratio Output of the model ("PRO"), and corresponding EV interval ("int").
  2. respLine. Model response across intervals of the EV. Columns in this data frame represent the following: EV interval ("int"), number of points in the interval ("n"), mean EV value of the points in the interval ("intEV"), mean Probability Ratio Output of the points in the interval ("intPRO"), and exponentially weighted moving average of intPRO ("smoothPRO").
In the case of a categorical EV, the plotted data is a data frame containing the number of points in the level ("n"), the level name ("level"), and the mean Probability Ratio Output of the level ("levelRV").

Details

The plot contains points, representing the model response across individual data points, as well as a line, representing an exponentially weighted moving average of the model response over intervals of the EV. The EV specified in dvdata must not be an interaction term.

Examples

Run this code
## Not run: ------------------------------------
# responseEV1 <- plotResp(dat, deriveddat, "EV1", dir = "D:/path/to/modeling/directory")
# 
# # From vignette
# pr_bygallResp <- plotResp(grasslandPO, grasslandEVselect[[1]], "pr_bygall")
# par(mfrow = c(1,2))
# pr_bygallFOP <- plotFOP(grasslandPO, "pr_bygall", intervals=50)
# pr_bygallResp <- plotResp(grasslandPO, grasslandEVselect[[1]], "pr_bygall")
# par(mfrow = c(1,1))
## ---------------------------------------------

Run the code above in your browser using DataLab