excluding masked values from averages when computing correlations