Learn R Programming

PresenceAbsence (version 1.1.11)

presence.absence.summary: Presence/Absence Summary Plots

Description

Produces four types of Presence/Absence accuracy plots for a single set of model Predictions.

Usage

presence.absence.summary(DATA, threshold = 101, find.auc = TRUE, which.model = 1, 
na.rm = FALSE, main = NULL, model.names = NULL, alpha = 0.05, N.bins = 5, N.bars = 10, 
truncate.tallest = FALSE, opt.thresholds = NULL, opt.methods = NULL, req.sens, req.spec, 
obs.prev = NULL, smoothing = 1, vert.lines = FALSE, add.legend = TRUE, 
add.opt.legend=TRUE, legend.cex = 0.6, opt.legend.cex = 0.6, pch = NULL, 
FPC, FNC, cost.line = FALSE)

Value

creates a graphical plot

Arguments

DATA

a matrix or dataframe of observed and predicted values where each row represents one plot and where columns are:

DATA[,1]plot IDtext
DATA[,2]observed valueszero-one values
DATA[,3]predicted probabilities from first modelnumeric (between 0 and 1)
DATA[,4]predicted probabilities from second model, etc...

threshold

cutoff values between zero and one used for translating predicted probabilities into 0 /1 values, defaults to 0.5. It can be a single value between zero and one, a vector of values between zero and one, or a positive integer representing the number of evenly spaced thresholds to calculate.

find.auc

a logical indicating if area under the curve should be calculated

which.model

a number indicating which model from DATA should be used

na.rm

a logical indicating whether missing values should be removed

main

an overall title for the plot

model.names

a vector of the names of each model included in DATA to be used in the legend box

alpha

alpha value for confidence intervals for calibration.plot

N.bins

integer giving number of bins for predicted probabilities for calibration.plot

N.bars

number of bars in histogram

truncate.tallest

a logical indicating if the tallest bar should be truncated to fit for presence.absence.hist

opt.thresholds

a logical indicating whether the optimal thresholds should be calculated and plotted

opt.methods

what methods should be used to optimize thresholds. Argument can be given either as a vector of method names or method numbers. Possible values are:

1Defaultthreshold=0.5
2Sens=Specsensitivity=specificity
3MaxSens+Specmaximizes (sensitivity+specificity)/2
4MaxKappamaximizes Kappa
5MaxPCCmaximizes PCC (percent correctly classified)
6PredPrev=Obspredicted prevalence=observed prevalence
7ObsPrevthreshold=observed prevalence
8MeanProb mean predicted probability
9MinROCdistminimizes distance between ROC plot and (0,1)
10ReqSensuser defined required sensitivity
11ReqSpecuser defined required specificity

req.sens

a value between zero and one giving the user defined required sensitivity. Only used if opt.thresholds = TRUE. Note that req.sens = (1-maximum allowable errors for points with positive observations).

req.spec

a value between zero and one giving the user defined required sspecificity. Only used if opt.thresholds = TRUE. Note that req.sens = (1- maximum allowable errors for points with negative observations).

obs.prev

observed prevalence for opt.method = "PredPrev=Obs" and "ObsPrev". Defaults to observed prevalence from DATA.

smoothing

smoothing factor for maximizing/minimizing. Only used if opt.thresholds = TRUE. Instead of find the threshold that gives the max/min value, function will average the thresholds of the given number of max/min values.

vert.lines

a logical where: TRUE means vertical lines added to plot at optimal thresholds; FALSE means no vertical lines, instead optimal thresholds marked along error statistics plots. Only used if opt.thresholds = TRUE.

add.legend

logical indicating if a legend should be included on the plot

add.opt.legend

logical indicating if optimization criteria legend should be included on the plot

legend.cex

cex for legends

opt.legend.cex

cex for optimization criteria legend

pch

plotting "character", i.e., symbol to use for the thresholds specified in MARK. pch can either be a single character or an integer code for one of a set of graphics symbols. See help(points) for details.

FPC

False Positive Costs, or for C/B ratio C = 'net costs of treating nondiseased individuals'.

FNC

False Negative Costs, or for C/B ratio B = 'net benefits of treating diseased individuals'.

cost.line

a logical indicating if the line representing the realtive cost ratio should be added to the plot.

Author

Elizabeth Freeman eafreeman@fs.fed.us

Details

presence.absence.summary produces a set of summary plots for a single model, along with calculating AUC and optimal thresholds. presence.absence.summary is not quite as flexible as the individual plot functions, as some arguments are preset so that the plots will be comparable, but the remaining arguments have the same meaning. See the individual plot functions error.threshold.plot, auc.roc.plot, calibration.plot, and presence.absence.hist for further details.

See Also

optimal.thresholds, error.threshold.plot, auc.roc.plot, calibration.plot, presence.absence.hist

Examples

Run this code
data(SIM3DATA)

presence.absence.summary(SIM3DATA)

presence.absence.summary(	SIM3DATA,
					threshold=101,
					find.auc=TRUE,
					which.model=2,
					na.rm=FALSE,
					main=NULL,
					model.names=NULL,
					alpha=0.05,
					N.bins=5,
					N.bars=10,
					truncate.tallest=FALSE,
					opt.thresholds=TRUE,
					opt.methods=c(1,2,4),
					req.sens=0.85,
					req.spec=0.85,
					obs.prev=NULL,
					smoothing=1,
					vert.lines=FALSE,
					add.legend=TRUE,
					add.opt.legend=TRUE,
					legend.cex=0.6,
					opt.legend.cex=0.6,
					pch=NULL)

Run the code above in your browser using DataLab