Produces four types of Presence/Absence accuracy plots for a single set of model Predictions.
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)
a matrix or dataframe of observed and predicted values where each row represents one plot and where columns are:
DATA[,1] |
plot ID | text | |||
DATA[,2] |
observed values | zero-one values | |||
DATA[,3] |
predicted probabilities from first model | numeric (between 0 and 1) |
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.
a logical indicating if area under the curve should be calculated
a number indicating which model from DATA
should be used
a logical indicating whether missing values should be removed
an overall title for the plot
a vector of the names of each model included in DATA
to be used in the legend box
alpha value for confidence intervals for calibration.plot
integer giving number of bins for predicted probabilities for calibration.plot
number of bars in histogram
a logical indicating if the tallest bar should be truncated to fit for presence.absence.hist
a logical indicating whether the optimal thresholds should be calculated and plotted
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:
1 | Default |
threshold=0.5 |
2 | Sens=Spec |
sensitivity=specificity |
3 | MaxSens+Spec |
maximizes (sensitivity+specificity)/2 |
4 | MaxKappa |
maximizes Kappa |
5 | MaxPCC |
maximizes PCC (percent correctly classified) |
6 | PredPrev=Obs |
predicted prevalence=observed prevalence |
7 | ObsPrev |
threshold=observed prevalence |
8 | MeanProb |
mean predicted probability |
9 | MinROCdist |
minimizes distance between ROC plot and (0,1) |
10 | ReqSens |
user defined required sensitivity |
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).
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).
observed prevalence for opt.method
= "PredPrev=Obs"
and "ObsPrev"
. Defaults to observed prevalence from DATA
.
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.
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
.
logical indicating if a legend should be included on the plot
logical indicating if optimization criteria legend should be included on the plot
cex for legends
cex for optimization criteria legend
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.
False Positive Costs, or for C/B ratio C = 'net costs of treating nondiseased individuals'.
False Negative Costs, or for C/B ratio B = 'net benefits of treating diseased individuals'.
a logical indicating if the line representing the realtive cost ratio should be added to the plot.
creates a graphical plot
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.
optimal.thresholds, error.threshold.plot, auc.roc.plot, calibration.plot, presence.absence.hist
# NOT RUN {
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