Optimizing multinomial based on k-means clustering tests