stats functions: added percentile and median