calculate mean and median for data