added function for binary outcome