> For the complete documentation index, see [llms.txt](https://nigelrogasch.gitbook.io/tesa-user-manual/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nigelrogasch.gitbook.io/tesa-user-manual/remove_minimise_tms_muscle_activity/pca_suppression.md).

# PCA suppression

This function suppresses data by the top PCA n-dimensions. Note that PCA is generated from average data, but subtracted from single trial data. For further details, see the following paper:

* [Hernandez-Pavon et al (2012) Uncovering neural independent components from highly artifactual TMS-evoked EEG data. J Neurosci Meth, 209:144-57.](http://www.ncbi.nlm.nih.gov/pubmed/22687937)

After the function is run, the user needs to decide how many principal components to remove. A summary figure showing the impact of removing between 1 and 5 of the top components on the EEG data is provided to assist with the decision.

&#x20;

![](https://3092694373-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LmJDCxgyXG9A9GA-gSy%2F-LmJDDdbvCHG7SXDX4aP%2F-LmJDLmW4xY53HEez5Sw%2Fpca_suppression_ex.png?generation=1565854895599543\&alt=media)

**Example of the summary figure following PCA suppression.** The top figure shows the impact of removing between 1-5 principal components on the data. Once the user has decided how many PCs to remove, the number (between 0-5) is entered in to second window.

## EEGLAB user interface

![](https://3092694373-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LmJDCxgyXG9A9GA-gSy%2F-LmJDDdbvCHG7SXDX4aP%2F-LmJDLmZQGkEnUffHdGr%2Fpca_suppression.png?generation=1565854895643429\&alt=media)

**1.** Enter the time range considered by the principal component analysis. This should be the time range in which the TMS-evoked muscle artifact is expected. Times are in ms.

## Scripts

### Base function

`EEG = tesa_pcasuppress( EEG, timeWin );` Default use.

### Pop function

`EEG = pop_tesa_pcasuppress( EEG );` Pop up window.

`EEG = pop_tesa_pcasuppress( EEG, timeWin );` Custom inputs.

### Required inputs

| Input   | Description                                                          | Example  | Default |
| ------- | -------------------------------------------------------------------- | -------- | ------- |
| EEG     | EEGLAB EEG structure                                                 | EEG      | -       |
| timeWin | Vector setting time window for data suppression in ms. \[start, end] | \[11,50] | -       |

### Outputs

| Output | Description          |
| ------ | -------------------- |
| EEG    | EEGLAB EEG structure |

### Examples

`EEG = pop_tesa_pcasuppress( EEG, [11, 50] );`
