coeff. of determination from covariance matrix added
fixed array indexing