define a function calculating correlation matrix of a data set