Modern Statistical Methods for Astronomy: With R Applications