From a012342c1d7604cebeec447d7083eb7aca548a29 Mon Sep 17 00:00:00 2001 From: surtur Date: Thu, 17 Nov 2022 21:54:52 +0100 Subject: [PATCH] fix: correctly name correlation coefficient --- p1/p1/funcs.py | 2 +- p1/p1/main.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/p1/p1/funcs.py b/p1/p1/funcs.py index 2fc21c2..6f53954 100644 --- a/p1/p1/funcs.py +++ b/p1/p1/funcs.py @@ -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) diff --git a/p1/p1/main.py b/p1/p1/main.py index 1e4ea04..d64c13b 100644 --- a/p1/p1/main.py +++ b/p1/p1/main.py @@ -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())