I want to find a specific algorithm to choose either 2 or 3 out of 3 given values. Like if I have a set of values 10,11,12 all three are close enough so I will calculate the mean of the value and return the mean. For another example if the values are 6,10,12. then I will choose 10 and 12 and calculate the mean and return the mean. Though these value can not necessarily be of of this range , they can go in thousands as well . But there will only be three number of values . I hope I am clear enough. I am not sure how to proceed over this and I need some help . Thank you

  • Tip: if you were writing a recipe (like in cooking) for this, what would it look like? – Kain0_0 Jun 30 '20 at 5:25
  • 1
    see Open letter to students with homework problems. "If your question... is just a copy paste of homework problem, expect it to be downvoted, closed, and deleted - potentially in quite short order." – gnat Jun 30 '20 at 18:30
  • ...also, please don't cross-post: stackoverflow.com/questions/62657962/… "Cross-posting is frowned upon as it leads to fragmented answers splattered all over the network..." – gnat Jun 30 '20 at 18:31

Use statistical analysis.

You're looking to reject a value that is outside some "normal" range for the 3.  There are several ways to interpret what the normal range is and what outliers are, so you'll have to pick one that meets your needs, in particular with such a small sample size.

From the wikipedia article on outliers and their detection:

There is no rigid mathematical definition of what constitutes an outlier; determining whether or not an observation is an outlier is ultimately a subjective exercise.  There are various methods of outlier detection...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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