Quote:
Originally Posted by KleineBiere
is there a formula?

No, but in practice the MSE (
http://en.wikipedia.org/wiki/Mean_squared_error) as a function of the Kfactor decreases up to one point and increasing from that point, which allow us to make aמ adjusted binary search. I can give you some java code that searches the best value if you want...