# standard deviation with mean for final score [closed]

• I have an array of numbers
• The goal is for every number to be as close to 1 as possible

The way I have interpreted this is that I want a mean as close to 1 as possible for the whole array, and a standard deviation as close to 0 as possible for the whole array.

Question: How do I combine the mean and the standard deviation in a meaningful way to show a score for "how close" my array is to the goal. The array can be any size.

Examples:

[.9, 1.1, .9] is a good solution

[.2, .5, .3] is not a good solution

[0, 0, 0] is the worst solution

[1, 1, 1] is the best solution

## closed as unclear what you're asking by Michael Chernick, kjetil b halvorsen, user158565, mkt, mdeweyFeb 7 at 10:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• I think that you could use just percentage for both. I calculate geometric mean. – Paweł Feb 6 at 23:14
• If you have numbers, you have them. In what sense, then, do you want the "mean to be as close as possible to 1" and the "SD as close as possible to 0"? If you're willing to change the numbers arbitrarily, there's a unique and obvious solution: set them all to 1. I doubt you're asking that, but what are you trying to ask? – whuber Feb 6 at 23:24
• I mean I'd like to have a score for any array to rank how close it is to the ideal state. – bentedder Feb 7 at 0:07

## 1 Answer

What you are looking for is called a loss function - function $$l(target, data)$$ that describes how far the current $$data$$ is from the $$target$$. Searching for this on google or this website will give you many sources, but here's a summary of the basic ideas: This plot shows several common loss functions for target 0. Their choice depends on your goals. MSE (mean squared error) grows steeply, which in your case means that any numbers far from 1 will be "punished" badly: $$[0.7, 1, 1]$$ will appear worse than $$[0.9, 0.9, 0.9]$$. MAE grows slowly and would mark both of these examples as equally close to target.

Calculating mean is equivalent to using MSE, because both are based on squared difference between points. If your numbers have a lower bound of 0, you might want to consider some asymmetric function: maybe log-transform them, and then apply MSE, so that 0.1 and 10 would incur equal loss?

• Thanks, finding the nomenclature to solve these types of problems is half the battle. Knowing now to google for loss functions and use your examples should get me there. – bentedder Feb 7 at 3:48