added function to calucate correlation