> For the complete documentation index, see [llms.txt](https://help.imotions.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-intersubject-correlation-isc.md).

# R Notebook: EEG Intersubject Correlation (ISC)

Run the EEG Intersubject Correlation R notebook to measure how similar respondents' EEG responses to a stimulus are, and read its replay, export and report.

*This Help Center article describes the EEG Intersubject Correlation R Notebook for EEG.*

The EEG Intersubject Correlation R Notebook runs a complete signal processing protocol for obtaining EEG Intersubject Correlation scores across a group of respondents. The scores can be used as EEG-based metrics for further statistical analysis or feature extraction.

Note that EEG Intersubject Correlation is a correlation computation on PSD metrics derived from a Power Spectral Decomposition of the EEG signal (see also: [R Notebook (EEG): Power Spectral Density](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md)).

This Help Center article will guide you through:

* What is EEG Intersubject Correlation
* How to add the EEG Intersubject Correlation R Notebook to your iMotions analysis
* Details about the algorithm
* Parameters
* Is it possible to use the ABM ‘decontaminated’ data?
* Is it possible to use the power band data from Emotiv?
* What the R Notebook delivers: replay, export files, report

## What is EEG Intersubject Correlation (ISC)?

EEG Intersubject Correlation (also known as neural synchrony) measures the similarity between respondents’ brain activity during exposure to certain stimuli (E.g., movies, music). For example, Hasson et al. (2004) were one of the first to identify similar brain responses across the subject pool while they were watching *The Good, the Bad, and the Ugly*. These similar responses indicated that movie viewing also engaged neural patterns associated with narrative and emotional processing. These brain-to-brain similarities can be understood as a collective engagement of the observers (Schmälzle and Grall, 2020), and also could be explained by the idea that efficient communication requires a successful translation from one individual to another (Hasson et al., 2004) (Leeuwis et al. 2021).

## How to add the EEG Intersubject Correlation (ISC) R Notebook to your analysis

The EEG Intersubject Correlation R Notebook can be added to iMotions analysis during the creation process of a new analysis, or later, by returning to the signal processing page within an existing analysis.

To add the R Notebook to the analysis:

1. Navigate to the Signal Processing page, and click the '+' button to add an active flow
2. In the 'Devices' drop-down menu, select the correct EEG device
3. In the 'Algorithms' drop-down menu, select the [**EEG Power Spectral Density**](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md) R Notebook
4. Set the parameters for EEG Power Spectral Density R Notebook
5. Repeat steps 1 - 4 to add **EEG Intersubject Correlation** R Notebook
6. Click 'Next'

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-8b8b7fdb0a40fa451e59b22d89042ef444d5a1db%2F49d5239544_EEG-ISC-signal-processing-section-with-default-parameters.webp?alt=media)

{% hint style="warning" %}
**Reminder**

In order to run the EEG Intersubject Correlation R Notebook, ***you have to run the EEG Power Spectral Density R Notebook on an individual level first.***
{% endhint %}

{% hint style="info" %}
**Tips:** Use "Save as default" button to save your customized parameter set for your added notebook. When you create another analysis under the same study (for example, to compare ISC with a different brain region), you can easily reuse the same set of parameters for the same notebook (in this case, reuse EEG Power Spectral Density R Notebook and only change the selected channels).

At any time, you can restore the default values by clicking "Factory defaults".
{% endhint %}

{% hint style="info" %}
You are able to add multiple versions of the EEG Intersubject Correlation R Notebook if you want to compare between, for example, high vs low missing PSD data percentage \[%] threshold for the same group of respondents. You can do this by directly adding multiple EEG Intersubject Correlation R Notebooks under "Active flows" with alteration in corresponding parameters based on your own interest (see illustration below). Results from multiple versions of the EEG Intersubject Correlation R Notebook will be exported altogether in one file later to facilitate your analysis. ***Please always add only one EEG Power Spectral Density R Notebook though***.
{% endhint %}

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-15293d2f3b3db2755cc0e0163c0050147867cb57%2F0eae33a130_image-1683281434276.webp?alt=media)

## Details about the algorithm

{% hint style="info" %}
**More Information**

Please refer to the [PSD R Notebook article](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md) for descriptions of how iMotions computes power spectral density.
{% endhint %}

After retrieving PSD data, this R notebook has performed the following steps on the derived PSD data on the stimulus of interest:

1\. Retrieval of the PSD data (in dB) for each respondent and filtering of respondents with a missing PSD data percentage threshold higher than 75% (by default).

2\. For each powerband (N\_powerbands), computation of the absolute Pearson correlation score for each pair of respondents (N\_pairs) and each window of 5 samples (by default) with a 50% overlap (by default) (N\_windows) only taking data up to the minimal duration of exposure in case the two respondents were not exposed to the same stimulus for the same amount of time (resulting dimension N\_powerbands \* N\_pairs \* N\_windows). Incomplete windows at the beginning and end of each stimulus are excluded from the analysis. Missing values are treated by case-wise deletion.

3\. Aggregating these correlation scores across respondent pairs (N\_powerbands \* N\_windows).

4\. Calculate the final EEG Intersubject Correlation metric for each powerband by aggregating these correlation scores over time.

## Parameters

{% hint style="info" %}
**More Information**

Please refer to the [PSD R Notebook article](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md) for descriptions of the parameters of EEG Power Spectral Density R Notebook.
{% endhint %}

The R Notebook can be altered by changing the following parameters:

* **Window length \[samples] for the Intersubject Correlation:** Window length used for applying absolute correlation score stepwise.
* **Window overlap percentage \[%] for the Intersubject Correlation:** Window overlap together with window length used for applying absolute correlation score stepwise. Please input a value within the range of 0 to 100.
* **Missing PSD data percentage threshold \[%] above which a respondent should be excluded:** a quality score computed on PSD data directly, counting NA from **all** the electrodes included in the PSD R Notebook for one respondent (so if some channels recorded no data but were included in the analysis, it will decrease the percentage of Missing PSD data). Please input a value within the range of 0 to 100.

{% hint style="info" %}
**Note on Missing PSD data percentage threshold \[%]:** This quality score is different from the one reported in EEG Power Spectral Density R Notebook Report. This quality score is counted from PSD data directly, while the quality score from EEG PSD R Notebook is computed from raw EEG data.
{% endhint %}

* **Consider multiple devices as different respondents**: check this when you have more than one EEG device collected in one recording, and you want to compute correlation on these two data streams. For example, in a dyad communication study where two respondents' EEG data were collected at the same time.

## Is it possible to use the ABM ‘decontaminated’ data?

Users of the ABM system may wonder whether it is possible to use the ‘decontaminated’ data provided by ABM, rather than the ‘raw’ data. The answer is **No**. You can only apply R Notebook on ABM raw data. Please make sure that you select the ABM 'raw' data (B-Alert EEG) instead of ABM 'decontaminated' data (B-Alert Decontaminated EEG) in the drop-down menu under 'Devices'. If you choose the ABM 'decontaminated' data (B-Alert Decontaminated EEG), there will be no available EEG R Notebooks shown.

## Is it possible to use the ‘power bands‘ data from Emotiv?

The answer is **Yes**. Users of the Emotiv system may note that Emotiv already provides power band information directly. The most salient difference between the power band information computed by Emotiv and by iMotions, is that slightly different frequency bands are used: theta (4-8 Hz), alpha (8-12 Hz), low beta (12-16 Hz), high beta (16-25 Hz) and gamma (25-45 Hz). However, the algorithms developed by Emotiv are proprietary, and therefore, it can be assumed that the methods deviate from the methods described [in this Help Center article](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md). Users of the Emotiv system are able to choose to run the EEG Power Spectral Density R Notebook from the ‘raw’ EEG data, or from the 'power band' EEG data provided by Emotiv directly. This is done by either selecting Emotiv 'raw' data or Emotiv 'powerbands' data in the drop-down menu Devices (See also: [How to add the PSD R Notebook to your analysis](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md)). Then one can run EEG ISC R Notebook on the retrieved PSD data.

## What the R Notebook delivers: replay, export files, report

#### Individual Replay

Everything delivered from EEG Power Spectral Density R Notebook will be shown in the individual replay as well when you add EEG ISC R Notebook. Please see [this article](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md) for more descriptions of deliverables from the EEG Power Spectral Density R Notebook.

#### Aggregate replay

In the Aggregate Replay you will find the section 'EEG Intersubject Correlation'. This section contains multiple data channels, representing the intersubject correlation scores per time unit (across all respondents included in the analysis) of each selected powerbands (E.g., Theta, Alpha).

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-08dee80e1735ee7b9652913061a40327674ed560%2Fdab8a2647b_FA-aggregate-replay.webp?alt=media)

{% hint style="warning" %}
**Notes:** There will be no aggregate replay visible for iMotions stimulus type which is supposed to have unique content based on the individual recording. These stimuli include website, screen recording, and scene recording. However, the ISC metrics will be available in Exports files for these types of stimuli. If you are in need of visualizing ISC curve for this type of stimuli, please make use of "[Scene editor](https://help.imotions.com/lab/analysis/signal-processing-r-notebooks/my-library/scene-editor.md)" in iMotions to create scenes out of this type of stimuli, then you will be able to visualize ISC curve. But please be aware of the interpretations that underlie this type of stimuli from the notebook results.
{% endhint %}

#### Metrics export

The R Notebook further produces an export file, which, for the respondents' group included in the analysis and for every stimulus, and scene presented in the study, computes the mean intersubject correlation metrics, for each selected powerband.

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-c672e17753eba10c54bdd257be02d992a99501c0%2F8ef5fd4dff_image-1683299912491.webp?alt=media)

One example of the Export file is shown as follows:

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-7e6beaaaab6ce39247263747c326bd47ca68fa64%2Fd422bfccfc_Export-excel-file-of-EEG-ISC-scores-2023.webp?alt=media)

**More explanations on "Respondent Base" and "Respondent Count" in the export file:**

**Respondent Base**: Number of respondents that were presented with the stimulus or relevant interval.

**Respondent Count**: Actual number of respondents that were used for computation (after accounting for Missing PSD data percentage \[%] and multiple devices).

When Respondent Base < Respondent Count?: when multiple devices are counted as different respondents.

When Respondent Base > Respondent Count?: when some respondents were excluded from the computation because their Missing PSD data percentage \[%] was too high.

{% hint style="warning" %}
Note: Please note that exports for annotations created in iMotions replay are not available in export files for EEG ISC R Notebook.
{% endhint %}

{% hint style="warning" %}
Note: Please note that if you see an "NA" for a certain stimulus in the export file, this could be that there is only one valid respondent's data available for this stimulus. Since EEG ISC R Notebook is running on an aggregation (group) level, you need at least two valid respondents' data to compute a value.
{% endhint %}

#### Report

By clicking the "Reports" button it is also possible to retrieve a report with the R-code embedded and a step-by-step description of the algorithm. Here in the report, you will also find information/messages on troubleshooting if something is going wrong, and a list with the percentage of missing PSD data.

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-37ffd18f550adea16a94deed7214495152e97ea5%2F975a934d5b_report.webp?alt=media)

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-5c449328c357b225b3348ecbaa27a8ccec81860d%2F8221c7a223_HTML-Reports-of-EEG-ISC-2023.webp?alt=media)

### Troubleshooting tips

{% hint style="info" %}
Tips - Use Report for Troubleshooting:

It is a good practice to use Warning messages in the Report for troubleshooting as shown in color yellow in the screenshot below when you spot something wrong.

Particularly, if you see a message like shown below, you could possibly check: 1. if you have at least two respondents who have enough good and usable EEG data 2. if you set the right Notch filter frequency when adding EEG Power Spectral Density R Notebook 3. if you set an appropriate Artifact Threshold when adding EEG Power Spectral Density R Notebook 4. if you exclude channels from the computation if you have not used them for data collection 5. More...
{% endhint %}

![](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-28895ca6a04060386f35feaa070cfaa611687a94%2Fa29b2821b3_Warning-messages-of-the-EEG-ISC-2023-1-.webp?alt=media)

## References

Hasson, U., Nir, Y., Levy, I., Fuhrmann, G., and Malach, R. (2004). Intersubject synchronization of cortical activity during natural vision. Science 303,1634–1640. doi: 10.1126/science.1089506

Imhof, M. A., Schmälzle, R., Renner, B., and Schupp, H. T. (2020). Strong health messages increase audience brain coupling. NeuroImage 216:116527. doi: 10.1016/j.neuroimage.2020.116527

Hasson, U., Nir, Y., Levy, I., Fuhrmann, G., and Malach, R. (2004). Intersubject synchronization of cortical activity during natural vision. Science 303, 1634–1640. doi: 10.1126/science.1089506

Leeuwis N, Pistone D, Flick N and van Bommel T (2021). A Sound Prediction: EEG-Based Neural Synchrony Predicts Online Music Streams. Front. Psychol. 12:672980. doi: 10.3389/fpsyg.2021.672980


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-intersubject-correlation-isc.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
