simpson.proc <- function(pvect){
#
# Procedure to compute the normalized Simpson heterogeneity measure
#
# Note: the input variable pvect is assumed to be a normalized
# probability vector that sums to 1 and is of length M.
# Missing values are not allowed, but components of pvector
# are allowed to be zero.
#
M <- length(pvect)
if (M == 1){
ISimpson <- 0
}
else{
normfactor <- M-1
rawsum <- sum(pvect^2)
num <- M*rawsum - 1
ISimpson <- num/normfactor
#
}
round(ISimpson,digits=6)
#
}