Standardised effect size (SES) and p-value from an observed value vs. a null randomisation vector.
sesandpvalues_bis <- function(obs, rand, nreps, probs = c(0.025, 0.975), rnd = 2) {
SES <- (obs - mean(rand)) / sd(rand)
pValsSES <- rank(c(obs, rand))[1] / (length(rand) + 1)
results <- round(c(obs, SES, mean(rand), quantile(rand, prob = probs), pValsSES, nreps), rnd)
names(results) <- c("Observed", "SES", "MeanRd", "CI025Rd", "CI975Rd", "Pval", "Nreps")
return(results)
}