# Significance test in trimodal distribution [duplicate]

I have a trimodal null distribution that looks like this:

In order to calculate the significance we just check how extreme the values are respect to our null distribution.

We do it this way:

  find.pvalue <- function(value, null.dist, length(null.dist))  {
if (value<0) {
p = (sum(null.dist < value)+1)/length(null.dist)
} else {
p = (sum(null.dist > value)+1)/length(null.dist)
}
return(p)
}