analyze_by_period function

Period-level summary statistics