tidyfun / tf

S3 classes and methods for tidy functional data
https://tidyfun.github.io/tf/
GNU Affero General Public License v3.0
5 stars 2 forks source link

Add (synchronous) covariance / correlation #30

Closed fabian-s closed 6 months ago

fabian-s commented 1 year ago

So: $Cov(y(t), x(t))$ for x, y on same domain.

More general $Cov(y(t), x(t'))$ (same domain) or $Cov(y(t), x(s))$ (different domains) would need multivariate functions/surfaces.

sebffischer commented 1 year ago

I think for the {mlr3fda} project, a different type of correlation was meant, i.e. the cross-correlation of two functions on the individual level, which will give a different scalar correlation for each individual, e.g. how strongly Ann and Bobs measurements of variables $x$ and $y$ correlate over time. If I understand it correctly, $Cov(y(t), x(t))$ implements how strongly the functions $y$ and $x$ correlate on the population level. Is this correct? (I think this clarifies my initial confusion).

fabian-s commented 1 year ago

OK, so $c(x_i, y_i) = \int_T (x_i(t) - \bar{x_i})(y_i(t)-\bar{y_i}) dt$ where $\bar{z_i} = |T|^{-1} \int_T z_i(t) dt$ ?

sebffischer commented 1 year ago

Also other individual-level operators functions like the minimum / maximum / variance of the functions would be great to have to be able to extract tabular features from these functions.

fabian-s commented 6 months ago

$c(x_i, y_i) = \int_T (x_i(t) - \bar{x_i})(y_i(t)-\bar{y_i}) dt$

@sebffischer this is now implemented as tf_crosscov(x, y) (in dev, for now)