Recently, I introduced the golden search method – a special way to save computation time by modifying the bisection method with the golden ratio – and I illustrated how to minimize a cusped function with this script. I also wrote an R function to implement this method and an R script to apply this method with an example. Today, I will use apply this method to a statistical topic: minimizing the sum of absolute deviations with the median.
While reading Page 148 (Section 6.3) in Michael Trosset’s “An Introduction to Statistical Inference and Its Applications”, I learned 2 basic, simple, yet interesting theorems.
If X is a random variable with a population mean and a population median , then
a) minimizes the function
b) minimizes the function
I won’t prove these theorems in this blog post (perhaps later), but I want to use the golden section search method to show a result similar to b):
c) The sample median, , minimizes the function
This is not surprising, of course, since
– is just a function of the random variable
– by the law of large numbers,
Thus, if the median minimizes , then, intuitively, it minimizes . Let’s show this with the golden section search method, and let’s explore any differences that may arise between odd-numbered and even-numbered data sets.
Read more of this post