Detecting Selection in Population Trees: The Lewontin and Krakauer Test Extended