In the motivating toy example to our ABC model choice paper, we compare summary statistics, mean, median, variance, and… median absolute deviation (mad). The latest is the only one able to discriminate between our normal and Laplace models (as now discussed on Cross Validated!). When rerunning simulations to produce nicer graphical outcomes (for the revision), I noticed a much longer run time associated with the computation of the mad statistic. Here is a comparison for the computation of the mean, median, and mad on identical simulations:
> system.time(mmean(10^5)) user system elapsed 4.040 0.056 4.350 > system.time(mmedian(10^5)) user system elapsed 12.509 0.012 15.353 > system.time(mmad(10^5)) user system elapsed 23.345 0.036 23.458
Now, this is not particularly surprising: computing a median takes longer than computing a mean, even using quicksort!, hence computing two medians… Still, having to wait about six times longer for the delivery of a mad statistics is somehow…mad!
Filed under: R, Statistics, University life Tagged: ABC, mad, median, quicksort, R, revision