add function to estimate error on Qi