fix: correctly name correlation coefficient

This commit is contained in:
surtur 2022-11-17 21:54:52 +01:00
parent b7ecd6a7b7
commit a012342c1d
Signed by: wanderer
SSH Key Fingerprint: SHA256:MdCZyJ2sHLltrLBp0xQO0O1qTW9BT/xl5nXkDvhlMCI
2 changed files with 3 additions and 2 deletions

@ -62,7 +62,7 @@ def covar(dat: pd.DataFrame) -> float:
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)

@ -50,7 +50,8 @@ def main(argv):
cov = f.covar(d)
std_dev_u = f.std_dev(d['u'])
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())