Introduction to Optimization Methods and their Application in Statistics