Statistics with optimization