z-score calculations and csv output