integrate error calculation