I am using replicates, and the Maximum.training.sensitivity.plus.specificity.logistic.threshold threshold rule.
If you are using a different threshold rule, you have to change it in the script.
You will have to change the maxent output directory too.
It will generate a file named __tssgeral.csv, in the Maxent output directory wich has three columns: 1. Name of replica, 2. TSS, 3. Binomial Probability
It will only work if the "Write background predictions" option is marked in Maxent.
Hope it helps, I have translated some of the code so you can understand the parts that may need changes.
##########################################
#### Avaliação de modelos por TSS
#### a partir do output do Maxent
####
#### A opção "Write background predictions" tem que
#### estar habilitada no Maxent
####
##########################################
library(ROCR)
library(vcd)
library(boot)
##### Output Maxent Directory
setwd("E:/MaxentOutput")
list.files(pattern="_samplePredictions.csv")->listaoutput
sub("_samplePredictions.csv","",listaoutput)->listaoutput
############
## Run it from here
#############
tssgeral <- as.data.frame(matrix(ncol = 3, nrow = 0))
colnames(tssgeral)<-c("Replica","TSS","Bin.Prob")
lapply(listaoutput, function(nome){
nome->sp
presence <- read.csv(paste(sp,"_samplePredictions.csv",sep=""))
background <- read.csv(paste(sp,"_backgroundPredictions.csv",sep=""))
pp <- presence$Logistic.prediction # get the column of predictions
testpp <- pp[presence$Test.or.train=="test"] # select only test points
trainpp <- pp[presence$Test.or.train=="train"] # select only test points
bb <- background$logistic
combined <- c(testpp, bb) # combine into a single vector
read.csv("maxentResults.csv")->maxres
### Set the threshold rule here
threshold<-maxres[maxres[,1]==nome,"Maximum.training.sensitivity.plus.specificity.logistic.threshold"]
bin.prob<-maxres[maxres[,1]==nome,"Maximum.training.sensitivity.plus.specificity.binomial.probability"]
#Número de valores maior e menor que threshold no teste
sum(testpp > threshold)->maiortest
sum(testpp < threshold)->menortest
#Número de valores maior e menor que o threshold no background
sum(bb > threshold)->maiorbb
sum(bb < threshold)->menorbb
### Calcula a sensitivity e a specificity
sensit<-(maiortest)/(maiortest+menortest)
specit<-(menorbb)/(maiorbb+menorbb)
tss<-sensit+specit-1
tsssp<-as.data.frame(sp)
tsssp[2]<-tss
tsssp[3]<-bin.prob
colnames(tsssp)<-c("Replica","TSS","Bin.Prob")
rbind(tssgeral,tsssp)->>tssgeral
})
#########
## Escreve o arquivo final
########
write.csv(tssgeral,file="__tssgeral.csv")