In this vignette we consider approximating multiple data matrices as a product of multiple low-rank matrices (a.k.a., factor matrices).
Test data is available from toyModel
.
library("iTensor")
<- iTensor::toyModel("MICA")
data1 <- iTensor::toyModel("GroupICA")
data2 str(data1, 2)
## List of 2
## $ X: num [1:10001, 1:3] -0.0613 -0.0593 0.5027 0.3647 0.357 ...
## $ Y: num [1:10001, 1:3] 0.342 0.385 0.473 0.898 1.001 ...
str(data2, 2)
## List of 2
## $ X: num [1:5000, 1:6] -2.43 4.07 8.83 -1.56 6.1 ...
## $ Y: num [1:5000, 1:6] -9.644 -2.587 -0.261 -2.316 -15.774 ...
Both data1
and data2
contain two
time-series data X
and Y
as follows.
plot.ts(data1$X[7700:8000,], main="data1 (X)")
plot.ts(data1$Y[7700:8000,], main="data1 (Y)")
plot.ts(data2$X[4700:5000,], main="data2 (X)")
plot.ts(data2$Y[4700:5000,], main="data2 (Y)")
As a formulation that extends ICA (independent component analysis) to the multiple matrices case, Multimodal Independent Component Analysis (MICA) was proposed ((Akaho 1999)). MICA extracts statistically dependent pairs of features from the sources, where the components of feature vector extracted from each source are independent.
MICA
can be performed as follows.
<- seq(from = 0.00, to = 1.000, by = 1e-4)
t_series <- MICA(data1$X, data1$Y, J=3, gamma_ts = 1 - 1 / (1 + exp(-100 * (t_series - 0.3)))) out.MICA
J
is the rank parameter for ICA and
gamma_ts
is the weighting factor for dependence on
independence. You will see that MICA
could extract some
time-series signals.
plot.ts(out.MICA$U[7700:8000, ], main="Source Signal (X)")
plot.ts(out.MICA$V[7700:8000, ], main="Source Signal (Y)")
Another formulation of the decomposition is Group Independent
Component Analysis (GroupICA (Calhourn 2009;
Pfister 2018)). GroupICA
can be performed as
follows.
<- GroupICA(data2, J1=6, algorithm="pooled") out_groupica
The rank for each factor matrix can be set as J1
and the
decomposition algorithm can be easily switched by
ica.algorithm
(algorithm
of ICA
and ICA2
can be specified). To pool the results of ICA
against each data matrix, we implemented three algorithms such as
pooled
, Calhoun2009
, and
Pfister2018
. For the details, see the references (Calhourn 2009; Pfister 2018).
You will see that GroupICA
could extract some
time-series signals.
plot.ts(out_groupica$Ss[[1]], main="Source Signal (X)")
plot.ts(out_groupica$Ss[[2]], main="Source Signal (Y)")
Unlike MICA
, GroupICA
can also be applied
to more than three matrices.
## R version 4.3.0 (2023-04-21)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Debian GNU/Linux bookworm/sid
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.21.so; LAPACK version 3.11.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] mixOmics_6.24.0 ggplot2_3.4.2 lattice_0.21-8 MASS_7.3-59
## [5] iTensor_1.0.2
##
## loaded via a namespace (and not attached):
## [1] tidyr_1.3.0 sass_0.4.5 utf8_1.2.3
## [4] generics_0.1.3 stringi_1.7.12 digest_0.6.31
## [7] magrittr_2.0.3 evaluate_0.20 grid_4.3.0
## [10] RColorBrewer_1.1-3 fastmap_1.1.1 plyr_1.8.8
## [13] jsonlite_1.8.4 Matrix_1.5-4 ggrepel_0.9.3
## [16] RSpectra_0.16-1 gridExtra_2.3 mgcv_1.8-42
## [19] purrr_1.0.1 fansi_1.0.4 scales_1.2.1
## [22] codetools_0.2-19 jquerylib_0.1.4 cli_3.6.1
## [25] rlang_1.1.0 splines_4.3.0 munsell_0.5.0
## [28] withr_2.5.0 cachem_1.0.7 yaml_2.3.7
## [31] ellipse_0.4.5 tools_4.3.0 parallel_4.3.0
## [34] reshape2_1.4.4 BiocParallel_1.34.0 einsum_0.1.0
## [37] dplyr_1.1.2 colorspace_2.1-0 corpcor_1.6.10
## [40] groupICA_0.1.1 vctrs_0.6.2 R6_2.5.1
## [43] matrixStats_0.63.0 lifecycle_1.0.3 stringr_1.5.0
## [46] pkgconfig_2.0.3 rTensor_1.4.8 geigen_2.3
## [49] pillar_1.9.0 bslib_0.4.2 gtable_0.3.3
## [52] jointDiag_0.4 glue_1.6.2 rARPACK_0.11-0
## [55] Rcpp_1.0.10 highr_0.10 xfun_0.39
## [58] tibble_3.2.1 tidyselect_1.2.0 knitr_1.42
## [61] nlme_3.1-162 htmltools_0.5.5 igraph_1.4.2
## [64] rmarkdown_2.21 compiler_4.3.0