eegica | R Documentation |
Computes temporal (default) or spatial ICA decomposition of EEG data. Can use Infomax (default), FastICA, or JADE algorithm. ICA computations are conducted via icaimax
, icafast
, or icajade
from the ica
package.
eegica(X, nc, center = TRUE, maxit = 100, tol = 1e-6,
Rmat = diag(nc), type = c("time", "space"),
method = c("imax", "fast", "jade"), ...)
X |
Data matrix with |
nc |
Number of components to extract. |
center |
If |
maxit |
Maximum number of algorithm iterations to allow. |
tol |
Convergence tolerance. |
Rmat |
Initial estimate of the |
type |
Type of ICA decomposition: |
method |
Method for ICA decomposition: |
... |
Additional inputs to |
ICA Model
The ICA model can be written as X = tcrossprod(S, M) + E
, where columns of S
contain the source signals, M
is the mixing matrix, and columns of E
contain the noise signals. Columns of X
are assumed to have zero mean. The goal is to find the unmixing matrix W
such that columns of S = tcrossprod(X, W)
are independent as possible.
Whitening
Without loss of generality, we can write M = P %*% R
where P
is a tall matrix and R
is an orthogonal rotation matrix. Letting Q
denote the pseudoinverse of P
, we can whiten the data using Y = tcrossprod(X,Q)
. The goal is to find the orthongal rotation matrix R
such that the source signal estimates S = Y %*% R
are as independent as possible. Note that W = crossprod(R,Q)
.
Infomax
The Infomax approach finds the orthogonal rotation matrix R
that (approximately) maximizes the joint entropy of a nonlinear function of the estimated source signals. See Bell and Sejnowski (1995) and Helwig (in prep) for specifics of algorithms.
FastICA
The FastICA algorithm finds the orthogonal rotation matrix R
that (approximately) maximizes the negentropy of the estimated source signals. Negentropy is approximated using
J(s) = [E\{G(s)\}-E\{G(z)\} ]^2
where E denotes the expectation, G is the contrast function, and z is a standard normal variable. See Hyvarinen (1999) for specifics of fixed-point algorithm.
JADE
The JADE approach finds the orthogonal rotation matrix R
that (approximately) diagonalizes the cumulant array of the source signals. See Cardoso and Souloumiac (1993,1996) and Helwig and Hong (2013) for specifics of the JADE algorithm.
S |
Matrix of source signal estimates ( |
M |
Estimated mixing matrix. |
W |
Estimated unmixing matrix ( |
Y |
Whitened data matrix. |
Q |
Whitening matrix. |
R |
Orthogonal rotation matrix. |
vafs |
Variance-accounted-for by each component. |
iter |
Number of algorithm iterations. |
type |
ICA type (same as input). |
method |
ICA method (same as input). |
If type="time"
, the data matrix is transposed before calling ICA algorithm (i.e., X = t(X)
), and the columns of the tranposed data matrix are centered.
Nathaniel E. Helwig <helwig@umn.edu>
Bell, A.J. & Sejnowski, T.J. (1995). An information-maximization approach to blind separation and blind deconvolution. Neural Computation, 7, 1129-1159. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1162/neco.1995.7.6.1129")}
Cardoso, J.F., & Souloumiac, A. (1993). Blind beamforming for non-Gaussian signals. IEE Proceedings-F, 140, 362-370. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1049/ip-f-2.1993.0054")}
Cardoso, J.F., & Souloumiac, A. (1996). Jacobi angles for simultaneous diagonalization. SIAM Journal on Matrix Analysis and Applications, 17, 161-164. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1137/S0895479893259546")}
Helwig, N.E. (2022). ica: Independent Component Analysis, \Sexpr[results=rd]{tools:::Rd_expr_doi("10.32614/CRAN.package.ica")}, R package version 1.0-3. http://CRAN.R-project.org/package=ica
Helwig, N.E. & Hong, S. (2013). A critique of Tensor Probabilistic Independent Component Analysis: Implications and recommendations for multi-subject fMRI data analysis. Journal of Neuroscience Methods, 213, 263-273. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.jneumeth.2012.12.009")}
Hyvarinen, A. (1999). Fast and robust fixed-point algorithms for independent component analysis. IEEE Transactions on Neural Networks, 10, 626-634. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/72.761722")}
########## EXAMPLE ##########
# get "c" subjects of "eegdata" data
data(eegdata)
idx <- which(eegdata$group=="c")
eegdata <- eegdata[idx,]
# get average data (across subjects)
eegmean <- tapply(eegdata$voltage,list(eegdata$channel,eegdata$time),mean)
# remove ears and nose
acnames <- rownames(eegmean)
idx <- c(which(acnames=="X"),which(acnames=="Y"),which(acnames=="nd"))
eegmean <- eegmean[-idx,]
# get spatial coordinates (for plotting)
data(eegcoord)
cidx <- match(rownames(eegmean),rownames(eegcoord))
# temporal ICA with 4 components
icatime <- eegica(eegmean,4)
icatime$vafs
# quartz()
# par(mfrow=c(4,2))
# tseq <- (0:255)*1000/255
# for(j in 1:4){
# par(mar=c(5.1,4.6,4.1,2.1))
# sptitle <- bquote("VAF: "*.(round(icatime$vafs[j],4)))
# eegtime(tseq,icatime$S[,j],main=bquote("Component "*.(j)),cex.main=1.5)
# eegspace(eegcoord[cidx,4:5],icatime$M[,j],main=sptitle)
# }
# spatial ICA with 4 components
icaspace <- eegica(eegmean,4,type="space")
icaspace$vafs
# quartz()
# par(mfrow=c(4,2))
# tseq <- (0:255)*1000/255
# for(j in 1:4){
# par(mar=c(5.1,4.6,4.1,2.1))
# sptitle <- bquote("VAF: "*.(round(icaspace$vafs[j],4)))
# eegtime(tseq,icaspace$M[,j],main=bquote("Component "*.(j)),cex.main=1.5)
# eegspace(eegcoord[cidx,4:5],icaspace$S[,j],main=sptitle)
# }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.