This function accepts a list of lists containing squared FC matrices or three-dimensional arrays (brain volumes) - such as one created by loadFC() - and apply feature reduction techniques. Available techniques are listed under the method parameter and currently include Principal Component Analysis (PCA) and Independent Component Analysis (ICA). Both are applied on the upper triangular part of the matrices, if matrices are provided, or to the whole array: if many brain volumes are provided, consider masking them beforehand to reduce memory consumption. PCA uses base R prcomp() while ICA uses ica::icafast(), thus the ica package must be installed. The user can supply the desired number of components to retain; else, the number of components needed to explain at least a given proportion of the variance of FC matrices will be returned under the Weights slot - for ICA, this is based on the PCA analysis. The default is 95% of the varaince.

reduce_featuresFC(
  FCmatrices,
  method = c("PCA", "ICA"),
  Ncomp = NULL,
  parallel = F,
  explore = F,
  ...
)

Arguments

FCmatrices

a list of lists including (squared) FC matrices or three-dimensional arrays, such as one provided by loadFC().

method

One of "PCA" or "ICA", defining the method for the desired feature reduction technique.

Ncomp

Number of components to retain. The default (NULL) automatically retains 95% of the explained variance. If Ncomp== "all" returns all the components. If Ncomp <1 this is interpreted as if the user wishes to retain a given proportion of variance (e.g. 0.6). If Ncomp is a vector, an additional slot is returned: a list of lists offering solutions with many components (redundant for PCA but possibly useful for crossvalidating the number of features in the case of ICA). In that last case the Weight slot always returns the model accounting for at least 95% of variance.

parallel

If TRUE uses future.apply::future_lapply(): future.apply must be installed, your machine should have multiple cores available for use, and threads should be defined explicitly beforehand by the user (e.g. by calling plan(multisession)). Provided these conditions are met, this can sensibly speed up the process - especially for ICA estimations - when solutions with different components are asked (i.e. Ncomp is a vector).

explore

If TRUE only returns the proportion of explained variance of all components, possibly useful to inform analyses.

...

More commands passed to ica::icafast().

Value

Weights is a matrix of reduced features. Loadings contains either the eigenvectors or the estimated sources mapping the reduced features onto the original space. SummaryPCA reports the amount of explained variance of the features with respect to variability in the original matrices. MeanFC is the mean FC matrix or volume. CrossWeights (optional) is a list of lists reporting weights and loadings for a range of provided Ncomp. Dim is a dataframe with information about the original dimensions.