Code for regression analysis