This function should support specifying an arbitrary subset of columns to use as reference for computing the median and MAD statistics.