View source: R/presence.absence.accuracy.R
presence.absence.accuracy | R Documentation |
Calculates five accuracy measures (pcc, sensitivity, specificity, Kappa, and AUC) for Presence/Absence data, and (optionally) their associated standard deviations.
presence.absence.accuracy(DATA, threshold = 0.5, find.auc = TRUE, st.dev = TRUE, which.model = (1:(ncol(DATA) - 2)), na.rm = FALSE)
DATA |
a matrix or dataframe of observed and predicted values where each row represents one plot and where columns are:
| ||||||||||||||||||||||||
threshold |
a cutoff values between zero and one used for translating predicted probabilities into 0 /1 values, defaults to 0.5. If calculations are to be performed on a single model prediction | ||||||||||||||||||||||||
find.auc |
a logical indicating if area under the curve should be calculated | ||||||||||||||||||||||||
st.dev |
a logical indicating if standard deviations should be calculated | ||||||||||||||||||||||||
which.model |
a number indicating which models from | ||||||||||||||||||||||||
na.rm |
a logical indicating whether missing values should be removed |
presence.absence.accuracy
calculates five standard accuracy measures for presence absence data, and (optionally) their associated standard deviations.
Function will work for one model and multiple thresholds, or one threshold and multiple models, or multiple models each with their own threshold.
Depending on the size of the dataset and the speed of the computer this function may take a couple of minutes to run. Finding the AUC is the slowest part of this function. The AUC can be suppressed by setting find.auc
= FALSE.
which.model
can be used to specify which of the prediction models from DATA
should be used.
if st.dev
= FALSE, returns a dataframe where:
[,1] | model | model name (column name from DATA ) |
[,2] | threshold | thresholds used for each row in the table |
[,3] | PCC | percent correctly classified |
[,4] | sensitivity | |
[,5] | specificity | |
[,6] | Kappa | |
[,7] | AUC | area under the curve |
if st.dev
= TRUE, returns a dataframe where:
[,1] | model | model name (column name from DATA ) |
[,2] | threshold | thresholds used for each row in the table |
[,3] | PCC | percent correctly classified |
[,4] | sensitivity | |
[,5] | specificity | |
[,6] | Kappa | |
[,7] | AUC | area under the curve |
[,8] | PCC.sd | standard deviation of PCC |
[,9] | sensitivity.sd | standard deviation of sensitivity |
[,10] | specificity.sd | standard deviation of specificity |
[,11] | Kappa.sd | standard deviation of Kappa |
[,12] | AUC.sd | standard deviation of AUC
|
if find.auc
= FALSE, then columns for AUC
and AUC.sd
are not returned.
Elizabeth Freeman eafreeman@fs.fed.us
cmx
, pcc
, sensitivity
, specificity
, Kappa
, auc
data(SIM3DATA) ### EXAMPLE 1 - multiple model predictions at one threshold### presence.absence.accuracy(SIM3DATA) presence.absence.accuracy(SIM3DATA,threshold=.4,st.dev=FALSE) presence.absence.accuracy(SIM3DATA, which.model=c(1,3),st.dev=FALSE) ### EXAMPLE 2 - one model prediction at multiple thresholds ### presence.absence.accuracy(SIM3DATA, threshold=c(.25,.5,.75), which.model=3) presence.absence.accuracy(SIM3DATA, threshold=11, which.model=2) ### EXAMPLE 3 - multiple model predictions, each at it's own treshold ### presence.absence.accuracy(SIM3DATA, threshold=c(.5,.5,.2), which.model=c(1,2,2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.