code for IRR estimation