Psuedocode to calculate variance of errors