I am not a mathematician or a statistician. But, I think the question I have is related to statistics. I will start with a made up example.

If I can grade apples into,say four grades from 1 to 4, one being the best and 4 being the worst. Now, I get two random samples of apples from two farms. The first sample has grade-1 40%, grade-2 20%, grade-3 30% and grade-4 10%. The second sample has grade-1 36%, grade-2 36%, grade-3 20% and grade-4 8%. Is there a summary statistic that can say which of the two samples agree best with the preferred ranking? The preference is to have more of the better grades.

I thought about using a weighted sum of proportions. The weight I thought was the inverse of the numerical value of the rank. This metric will have a value of one if all of the sample is grade 1 (the most preferred situation) and goes down towards zero as the sample consists less of the preferred ranks and more of the lesser preferred ranks.

The second metric I thought of is (Spearman) rank correlation between the inverse of the numerical value of the ranks and the percentages of each rank.

I will be grateful if anyone can tell me if a statistic exists that can help me chose between the two samples as having greater agreement with the ranking. If there are no such statistics, your valuable comments on the appropriateness of the two metrics I have considered and their mathematical properties in the context of example will be greatly appreciated.

Now, the real problem is related to comparison of different keyboard layouts in a language. I can arrive at a subjective ranking of various keys. From a corpus, I can find what frequency of character falls on these keys for each of the layouts. I want to be able to tell which of the layouts agree more with my ranking of keys.




1 Answer 1


Yes, it's just expected value. If you multiply the ranks by the frequencies (%) and sum it, they would be weighted by how popular they are. You would get the average rank, so the lower the better.

For a different perspective, the weighted average is calculated as a dot product between the values and the weights. Dot product is proportional to cosine similarity and is itself a measure of similarity. So it does measure how “correlated” weights and values are.

See also Why is the expected value named so?

  • $\begingroup$ That simple! Thanks for your answer. $\endgroup$
    – Ajith
    Commented Jun 26, 2022 at 5:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.