def r(self):
"""
Pearson correlation of the fitted Variogram
:return:
"""
# get the experimental and theoretical variogram and cacluate means
experimental, model = self.__model_deviations()
mx = np.nanmean(experimental)
my = np.nanmean(model)
# claculate the single pearson correlation terms
term1 = np.nansum(np.fromiter(map(lambda x, y: (x-mx) * (y-my), experimental, model), np.float))
t2x = np.nansum(np.fromiter(map(lambda x: (x-mx)**2, experimental), np.float))
t2y = np.nansum(np.fromiter(map(lambda y: (y-my)**2, model), np.float))
return term1 / (np.sqrt(t2x * t2y))
评论列表
文章目录