# Sort lists using statistics

I want to make a ranking of music genres. I have a list of artists and top genres with a value (1 - 100) which describes how much their music is from that genre. Now I need to organise the genres so the most popular is on top.

Bellow I have genres from 4 artists (3 genres per each). We can see that Rock and Metal are both in 3 groups, but when looking at the value it is clear that Rock is more popular than Metal.

I was thinking about summing the values from the genres, and order the by the summ, but I think in statistics it must be an algorithm that will give better result when doing the rank.

The question is how to order the genres (btw, I'm using PHP).

• metal (71)
• industrial (65)
• rock (36)

• rock (100)
• alternative (67)
• metal (36)

• metal (100)
• Melodic Death Metal (72)
• modern metal (68)

• alternative rock (100)
• rock (78)
• alternative (63)

• Please try to explain your problem more clearly; we'd like to help you but your question will get no answers in its present form because from the little that's here it's too hard to tell what you actually want. Please read through the help relating to asking questions, including this part and the answers to this discussion on meta.stats.stackexchange – Glen_b -Reinstate Monica Dec 20 '13 at 1:09
• @Glen_b, I edited my question. Is now clear what I want to achieve? – Marin Bînzari Dec 20 '13 at 8:32
• It is a good deal better, thank you. However, you do still leave a number of totally subjective things (such as 'a better result') unspecified. Better in what way? What makes it better? How are we to guess? Many things might be optimized, but what do you want it to achieve? – Glen_b -Reinstate Monica Dec 20 '13 at 9:33
• I try to rank the genres. "Beter" means that is present in multiple lists and popularity value is bigger. – Marin Bînzari Dec 20 '13 at 11:02

You could do a weighted average in which the final score for each genre is the average over all artists weighted by the percentage of artists that don't make music in that genre.

$x_i = (1 - \frac{1}{m + 0.5}) \frac{\sum_{j=1}^{m} x_{ij}}{N}$

Where $m$ is the number of artists in a genre (i.e. $m = 3$ for rock and $m = 1$ for industrial) and $N$ is the total number of artists, 4 in the example data given. I added 0.5 so that if there was only 1 artist in a genre, like Melodic Death Metal, the weight wouldn't be 0, making the assumption that if only 1 artist has made music in that genre that it is less popular than genres with more artists. When I do that on your data, I get:

rock = 38.21429
metal = 36.96429
alternative = 19.5
industrial = 5.416667
alternative rock = 8.333333
melodic death metal = 6