The single pass algorithm, although faster, is numerically unstable.
Furthermore, at can't reasonably be achieved when categorical variables
are involved. This change implements a two pass algorithm and allows
the caller to choose which algorithm (s)he prefers.