Improved numerical integral for regression

Fixes #19