From cd51dc6af23c41e63b06cae847282a9873851298 Mon Sep 17 00:00:00 2001 From: Alexander Date: Mon, 25 Apr 2022 11:03:20 +0300 Subject: initial commit correlation with rust add pearson correlation structure --- src/main.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/main.rs (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..1832f9b --- /dev/null +++ b/src/main.rs @@ -0,0 +1,35 @@ +use rgsl::{ + randist::t_distribution::{tdist_P, tdist_Q}, + statistics::{correlation, spearman}, +}; + + +trait Correlation { + fn correlate(&self,x:&[f64],y:&[f64]) ->(f64,f64); +} + +struct Pearson { + n: usize, + degree_of_freedom:f64, +} + +impl Pearson { + fn new(n:usize) -> Self { + + Self { + n, + degree_of_freedom:(n - 2) as f64, + } + } +} + + +impl Correlation for Pearson { + fn correlate(&self,x:&[f64],y:&[f64]) ->(f64,f64){ + (1.2,0.1) + } +} + +fn main() { + +} -- cgit 1.4.1