nearest neighbor used in sampling