algorithm 3: local score p-value