Percentile-based summary statistics of a TPD probability distribution.
percentileTPD <- function(x) {
TPDList <- x$TPDc$TPDc
results <- list()
for (comm in 1:length(TPDList)) {
percentile <- rep(NA, nrow(TPDList[[comm]]))
TPDList[[comm]] <- cbind(TPDList[[comm]], percentile)
orderTPD <- order(TPDList[[comm]][, "notZeroProb"], decreasing = TRUE)
TPDList[[comm]] <- TPDList[[comm]][orderTPD, ]
TPDList[[comm]][, "percentile"] <- cumsum(TPDList[[comm]][, "notZeroProb"])
TPDList[[comm]] <- TPDList[[comm]][order(TPDList[[comm]][, "notZeroIndex"]), ]
results[[comm]] <- TPDList[[comm]]
}
names(results) <- names(TPDList)
return(results)
}