fix: correctly name correlation coefficient
This commit is contained in:
parent
b7ecd6a7b7
commit
a012342c1d
@ -62,7 +62,7 @@ def covar(dat: pd.DataFrame) -> float:
|
|||||||
return dat['u'].dot(dat['y']) / len(dat)
|
return dat['u'].dot(dat['y']) / len(dat)
|
||||||
|
|
||||||
|
|
||||||
def covar_coeff(cov: float, std_dev_u: float, std_dev_y: float) -> float:
|
def correl_coeff(cov: float, std_dev_u: float, std_dev_y: float) -> float:
|
||||||
return cov / (std_dev_u * std_dev_y)
|
return cov / (std_dev_u * std_dev_y)
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,8 @@ def main(argv):
|
|||||||
cov = f.covar(d)
|
cov = f.covar(d)
|
||||||
std_dev_u = f.std_dev(d['u'])
|
std_dev_u = f.std_dev(d['u'])
|
||||||
std_dev_y = f.std_dev(d['y'])
|
std_dev_y = f.std_dev(d['y'])
|
||||||
cov_c = f.covar_coeff(cov, std_dev_u, std_dev_y)
|
# correlation coefficient
|
||||||
|
correl_c = f.correl_coeff(cov, std_dev_u, std_dev_y)
|
||||||
|
|
||||||
print("data covariance:\n", d.cov())
|
print("data covariance:\n", d.cov())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user