This is NicheToolBox: Model Evaluation module here you can find a quick view of the thinks that you have done in the software. Remember that this is free software so it comes with no waranty, please report any bugs you find at luismurao@gmail.com or or via projects GitHub repository https://github.com/luismurao/ntbox.

library(knitr)
library(rgl)
knitr::opts_chunk$set(echo = TRUE)
knit_hooks$set(rgl = hook_rgl, webgl = hook_webgl)
printPROC <- FALSE
printCMoptim <- FALSE 
printMTP <- FALSE
printPERCENTIL <- FALSE
printUDT <- FALSE
printBIN <- FALSE
if(!is.null(partialRoc())) printPROC <- TRUE
if(!is.null(threshold_search2())) printCMoptim <- TRUE
if(!is.null(mtp_threshold()))  printMTP <- TRUE
if(!is.null(percentil_threshold()))  printPERCENTIL <- TRUE
if(input$compBin && !is.null(binary_user_method()))  printUDT <- TRUE
if(input$run_binomial && !is.null(binomial_testDF()))  printBIN <- TRUE
cat("### Partial ROC results")
cat("##### Table")
head(partialRoc())
cat("##### Partial ROC stats")
pRocStats()
cat("##### Partial ROC distribution")
auc_res <- pRoc_distribution()
hist(auc_res$aucRatio,prob=TRUE,col="grey",
     xlim=c(min(auc_res$dens_rnd$x,na.rm = TRUE),
            max(auc_res$aucRatio,na.rm = TRUE)),
        main="Partial AUC distribution", xlab="AUC ratio")
lines(auc_res$dens_rnd,col='red')
lines(auc_res$dens_ratio,col='blue')
cat("### Confusion matrix optimization\n")
head(threshold_search2())

# Print function for confusion matrix
confu_matrix <- function(a,b,c,d){

  m <- matrix(c(paste0("a = ", a),paste0("b = ",b),paste0("c = ", c),paste0("d = ", d)),ncol=2)
  colnames(m) <- c("Predicted presence","Prediceted absence")
  m <- as.data.frame(m)
  rownames(m) <- c("Observed presence", "Observed absence")
  m <- t(m)
  return(m)

}
a <- input$a
b <- input$b
c <- input$c
d <- input$d

confu_matrix(a=a,b=b,c=c,d=d)

meta_data_cm_method()

plot(binary_cm_method())
cat("### Minimum training presence results\n")
meta_data_mtp_method()
plot(binary_mtp_method())
cat("### User percentil results\n")
meta_data_percentil_method()
plot(binary_percentil_method())
cat("### User defined threshold results\n")
meta_data_user_method()
plot(binary_user_method())
cat("### Binomial test results\n")
binomial_testDF()$results_bin
cat("#### Coordinates and prediction values\n")
binomial_testDF()$coords_df


luismurao/ntbox documentation built on May 9, 2024, 8:24 p.m.