icac: ICA noise correction.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/icac.R

Description

By-trial correction of EEG/MEG data for known (i.e., recorded) and unknown (i.e., not recorded) sources of noise.

Usage

1
2
3
4
icac(x, channel, noise.sig, trial.cn = "Trial", 
include = TRUE, threshold = 0.4, n.comp = length(channel), 
ica.method = "R", correct = TRUE, ica.only = FALSE, 
proctime = TRUE, seed = NULL, verbosity = 5, ...)

Arguments

x

A data frame containing the EEG/MEG data to be corrected. Measurements for each channel/electrode should be arranged in columns with the channel/electrode to which it pertains as their names (e.g., Fp1, Fp2, AF3, AF4, ...). If the noise channels (e.g., VEOG, HEOG, ECG, ...) are present in this data frame, they will be removed unless argument include is set to TRUE. Note that there must be a column containing trial information.

channel

The channels to correct. You can use the output of function des from package eRp, e.g., des("biosemi.32")$electrodes.

noise.sig

The channel(s) against which each independent component (IC) will be correlated. Can be anything really, HEOG, VEOG, ECG, ...

trial.cn

The name of the column containing trial information. Defaults to "Trial".

include

Whether to include the noise channels in the ICA. Defaults to TRUE.

threshold

The correlation threshold between noise signal(s) and IC above which the EEG/MEG data will be corrected. Default is 0.4 (as in Flexer et al., 2005). Can be set to anything between 0 (will zero-out every IC) and 1 (will most probably zero-out nothing).

n.comp

Number of components. Defaults to the number of channels used.

ica.method

If method == "R" then computations are done exclusively in R (default). The code allows the interested R user to see exactly what the algorithm does. If method == "C" then C code is used to perform most of the computations, which makes the algorithm run faster. During compilation the C code is linked to an optimized BLAS library if present, otherwise stand-alone BLAS routines are compiled.

correct

Logical. Defaults to TRUE. Whether to correct the data or to simply get information pertaining to the what IC correlated with what noise signal at what trial.

ica.only

Logical. Defaults to FALSE. Whether to perform fastICA only without noise correction.

proctime

Logical. Defaults to TRUE. Determines how much real and CPU time (in minutes) the currently running R process has already taken.

seed

Defaults to NULL, which means that set.seed is randomly set for every run. There is the possibility, however, to pass an arbitrary seed, e.g., 0 to insure replicability between runs for instance. In this later case, if fastICA doesn't converge (e.g., it returns matrices and data frames with NAs), try setting the seed to another value (e.g., 1).

verbosity

Numeric. The amount of information printed to screen during the modeling process. The higher the number, the more information is printed. 0 turns this option off. Defaults to 5. Maximum value is 6.

...

Further arguments to pass to function fastICA.

Details

If the verbosity level is high enough, the output will contain the noise signal beeing processed, the trial, the IC, and the correlation between the noise signal and the IC at that trial. For example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
     ...
     noise signal = Temp; trial = 19; IC = 6; cor = -0.307971687318979 
     noise signal = Temp; trial = 19; IC = 7; cor = 0.111036533642789 
     noise signal = Temp; trial = 19; IC = 8; cor = -0.0226991408620133 
     noise signal = Temp; trial = 19; IC = 9; cor = 0.233890667361682 
     noise signal = Temp; trial = 19; IC = 10; cor = 0.878635491834294 
     noise signal = Temp; trial = 19; IC = 11; cor = 0.0891185123593569 
     noise signal = Temp; trial = 19; IC = 12; cor = 0.524880913590867 
     noise signal = Temp; trial = 19; IC = 13; cor = -0.126156352285347 
     noise signal = Temp; trial = 19; IC = 14; cor = -0.312246072685998 
     ...

If one wishes to simply know what ICs correlate at or above threshold with what noise signal at what trial (i.e., no correction), set correct = FALSE. This would be done if one only wished to zero-out entire ICs without zeroing-out anything else.

Value

data

If correct = TRUE, the corrected data. Otherwise, the Pre-processed data.

channel

The channels that were corrected.

noise.sig

The noise signals for which the data were corrected.

threshold

The correlation threshold above which the EEG/MEG data will be corrected.

n.comp

The number of independent components used in the ICA.

X

Pre-processed data.

K

Pre-whitening matrix that projects data onto th first n.comp principal components.

W

The estimated un-mixing matrix.

A

The estimated mixing matrix.

S

If correct = TRUE, the corrected estimated source matrix. Otherwise, the original (uncorrected) source matrix (which will be equal to S0).

S0

The uncorrected estimated source matrix.

col.means

The mean of each channel.

correlations

For each noise signal and each trial, the correlation between the IC and the noise signal.

correction.info

A data frame with columns "NoiseSignal" (the noise signal with which ICs were compared), "IC" (the IC which correlated above threshold with the noise signal), "Trial" (the trial at which the noise signal and the IC correlated above threshold), and "Corr" (the correlation between the noise signal and the IC).

proctime

If proctime = TRUE, a data frame with processing time information.

Author(s)

Antoine Tremblay, Dalhousie University, trea26@gmail.com

References

Flexer, A., Bauer, H., Pripfl, J. & Dorffner, G. (2005). Using ICA for removal of ocular artifacts in EEG recorded from blind subjects. Neural Networks, 18, 998–1005.

Hyvarinen, Aapo & Oja, Erkki. (1999). Independent Component Analysis: A Tutorial. Available at http://cis.legacy.ics.tkk.fi/aapo/papers/IJCNN99_tutorialweb/.

See Also

fastICA; mwd.thrsh; plot_avgba; plot_trba; plot_nic; plot_tric; summary.icac; topo_ic; update.icac.

Examples

1
### See vignette for examples.

Example output

Loading required package: fastICA
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-27. For overview type 'help("mgcv-package")'.

icaOcularCorrection documentation built on May 29, 2017, 1:53 p.m.