yield_error_fun function

Calculate yield error