Change std to std ddof=1 because mean is calculated from data
NF: regress bad components out of good, with tests, and tested against matlab result