passing f to d3.mean function call in the variance implementation