> 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/how-to-calculate-mental-workload-metrics-using-eeg-r-notebook.md).

# How to calculate mental workload metrics using EEG R Notebook

Follow a worked example, based on Smith et al. (2001), of using the EEG PSD R notebooks to compare theta and alpha power across task load levels.

In (Smith et al., 2001), an EEG-based measurement of mental workload has been studied and developed during Human-Computer-Interaction. This paper has been selected and abstracted below as an example of illustrating how one can utilize iMotions EEG Power Spectral Density R Notebooks for EEG studies.

*Statement: This article contains abstracted as well as selected sentences directly taken from (Smith et al., 2001) and (Gevins & Smith, 2003).*

*Please note that R Notebook is used for data analysis phase, therefore this article is only discussing data analysis AFTER study design and data collection. However, a proper study design and good quality data collection are both keys to interpretable results.*

This Help Center article will guide you through:

* [*Backgrounds and Methods*](#backgrounds-and-methods)
* [*EEG Processing*](#eeg-processing)
* [*Preliminary Statistical Analyses*](#preliminary-statistical-analyses)
* [*References*](#references)

## Backgrounds and Methods:

A modern computer-based work environment requires sustained vigilance to multiple streams of information. Such conditions have the potential to exceed a man's capability to attend to and process information. Mental workload has thus been identified as an important source of performance errors during human-computer interaction (Card et al. 1983, Kieras 1988, Olson and Olson 1990).

***Regarding how to actually "measure" this workload***, one possibility is to use the electroencephalogram (EEG) to directly measure the brain’s response to a particular set of task demands. The study presented in (Smith et al., 2001) was thus performed in order to further evaluate the potential of the EEG as a modality for monitoring the degree to which one's mental resources are engaged by a relatively complex form of computer-based work. It has been observed in this paper that at the midline frontal site, power within 5–7 Hz is increased during the high load task, relative to the low load task. This finding is consistent with a number of prior studies that have found enhanced theta band activity in tasks requiring sustained mental effort (Gundel & Wilson, 1992; Miyata, Tanaka, & Hono, 1990; Yamamoto & Matsuoka, 1990). This type of spectral pattern has been supported by other measurements too, for example, topographical studies (Gevins et al., 1997; Inouye et al., 1994; Ishii et al., 1999). This study (Smith et al., 2001) has used \*Multi-Attribute Task Battery (MATB; Comstock & Arnegard, 1992) task supported by behavioral and subjective workload ratings that provided evidence about the variations in the task difficulties: low level (LL), middle level (ML), high level (HL) and passive-watching control (PW) conditions.

*Please note that a proper study design (including a carefully designed mental workload task) is important for generating interpretable results.*

***During study design and data collection in iMotions***, you can, for example, utilize multiple "stimuli" for each respondent to conduct tasks of different difficulty levels, while collecting their EEG recordings. You can utilize our "Survey" stimulus to launch a self-assessment survey after respondents finish the tasks. Please refer to *here* for more information on iMotions stimuli types, and *here* for more information on study design within iMotions.

After a proper study design, a high-quality EEG data collection should also be ensured in order to generate interpretable results. Use [*this article*](https://imotions.com/blog/eeg-cap/#top-of-page) as a start to select your EEG device. Use our Help Center articles on [*How to place the EEG-system correctly on the head*](https://help.imotions.com/lab/sensor-setup/eeg/how-to-place-the-eeg-system-correctly-on-the-head.md) or other device-specific guides on data collection for your reference.

Towards the end of the paper (Smith et al., 2001), the author pointed out that: in prior studies in which the perceptual and motor requirements of tasks were kept constant while the cognitive demands of those tasks varied (Gevins et al., 1997, 1998), patterns of EEG modulation were very similar to those observed in the study. Because of this, it is reasonable to suppose that a significant proportion of the variance observed in EEG signals in the current study was related to between-task differences in cognitive, rather than perceptuomotor factors. However, in the experiment performed here and, more generally, in naturalistic task environments, increased task difficulty tends to be associated with greater perceptual and motor demands. Thus, although the current data provide evidence for the basic feasibility of the analytic approach described here, an important area for future research is the development of physiological indices that differentiate between the loading of separate resource systems.

*\*Multi-Attribute Task Battery: The MATB is a computer-based multitasking environment that simulates some of the activities a pilot might be required to perform. It has been used in several prior studies of mental workload and adaptive automation (e.g., Fournier, Wilson, & Swain, 1999; Parasuraman, Molloy, & Singh, 1993; Parasuraman, Mouloua, & Molloy, 1996).*

## EEG Processing:

After the EEG data collection, filtering and noise reduction should be applied to preprocess EEG data. Then log power spectra are derived from 2-second windows and averaged over all data segments for each participant for each task of different difficulty levels (E.g., PW, LL, ML, and HL). Measurements of average power were made of the frontal midline theta power (5–7 Hz) at Fz in the paper (Smith et al., 2001). For more details of processing steps from this study (Smith et al., 2001), please refer to the paper.

In *iMotions EEG Power Spectral Density Notebook parameters settings*, you can alter the **Band-pass filter frequencies \[in Hz**] based on your own research need, or use our default values: 0.5 - 100 Hz.

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

In *iMotions EEG Power Spectral Density Notebook parameters settings*, you can alter **Notch filter frequency**, **Artefact threshold \[in µV]** to eliminate line noise and noise-induced high amplitude EEG data (most likely are induced by blinks, movement etc.) from subsequent analyses.

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

You are able to visualize and inspect your Notebook preprocessed EEG data, as a comparison to raw EEG data directly from the headset:

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

In *iMotions EEG Power Spectral Density Notebook parameters settings*, you can alter **Window length for Welch PSD \[in second], Powerbands options, Theta band frequencies \[in Hz]** to achieve the settings as described in the paper (Smith et al., 2001). If your targeted computation brain location is not a single channel, but a region that is composed of multiple channels: You can also use the **Electrode cluster for average** to compute average PSD from a selected electrode cluster. This clustering method has also been reported in other studies for mental workload measurement.

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

In iMotions, for each selected stimulus, you are able to view averaged spectral power over all data segments (windows) for each participant from Notebook computation in the individual replay window:

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

For each selected stimulus, you can also view the averaged theta power across respondents through [*iMotions EEG Power Spectral Density Aggregation R Notebook*](https://help.imotions.com/lab/analysis/eeg/r-notebook-eeg-power-spectral-density-psd.md). You will be able to observe the variations in the theta power along the timeline if: 1) your variations of task conditions happen within one stimulus, 2) if you have a proper number of respondents and 3) properly collected and analyzed EEG data:

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

*Figure 1: This screenshot of aggregated theta power at Enobio Ch4 (Fpz) was from a study originating from an experiment conducted by Simons and Chabris (1999). Please note that this experiment reflected that when respondents pay close attention to a task, they may fail to notice salient (but task-irrelevant) information. It is not a strictly designed mental workload task. For more information about this study in iMotions, please refer to* [*here*](https://help.imotions.com/lab/getting-started/demo-studies/8-1-demo-studies/demo-study-inattentional-blindness-psychology-experiment.md)*. In the experiment, respondents were asked to pay sustained attention to a task of correctly counting the number of passes a basketball team was making, while at some point a gorilla (distraction) walked through the screen and patted himself on the chest. The created annotation in iMotions marked up the moment in the video when gorilla walked in. An averagely increased aggregated theta power was shown from the EEG recordings since the gorilla moment started.*

## Preliminary Statistical Analyses:

To have an overview of all selected stimuli (including annotations, created scenes) and respondents' averaged power outputs, you can export a summary metrics file through *R PROCESSING - EEG Power Spectral Density Metrics Export*. The exported summary metrics file can be used as a starting point for further analysis, for example, statistical analysis as described below, or developing features for further modeling or classifier.

![mceclip6.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-45705dc011fd235a310ceab7c2dacfa04c1a6cfc%2F8c3ef43ff5_pcr4bqdrykqjqctoohyzjamceclip6.png?alt=media)

By importing the iMotions *exported summary metrics file* into statistical analysis software/tools you have (R Studio, Microsoft Excel, MATLAB etc.), you are able to continue to conduct steps such as graph plotting, statistical analysis, and more.

*Please note that a proper number of respondents and selection of statistical methods are keys to interpretable results. For more about statistical analysis, see* [*General data analysis and interpretation*](https://help.imotions.com/lab/getting-started/multimodal-data-overview/general-data-analysis-and-interpretation.md)*.*

An example illustrating how to plot the graph from Notebook exported summary metrics file is shown below, given two stimuli representing low and high level of task loading (Please note that the step of applying z-scores before plotting is skipped here):

The example graph generated after conducting the steps in the video: X axis: HL: high load, LL: low load task. Y axis: average theta power across respondents.

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

In (Smith et al., 2001): Statistical analyses were performed to compare behavioral and EEG measures across task load levels. For EEG data, task-related EEG modulation in the theta frequency bands was illustrated by Figure 2 below, which plots the values of individual features in the theta band after normalizing the data within each participant subject across the different task versions. A repeated-measures ANOVA of the effect of varying load level (PW, LL, ML, and HL) on normalized theta power at Fz revealed a significant effect of task difficulty: ![mceclip7.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-74c3041375b47a1a900bf2537f251322df0db3a2%2F3771d5abd1_7uyedhktb0kli1pbgntgaqmceclip7.webp?alt=media)

*Figure 2 (Smith et al., 2001):Mean (SEM) amplitude of frontal theta (6–7 Hz) at Fz and alpha (8–10 Hz and 10–12 Hz) at Pz for each of the four task versions. Data have been converted to z scores within each participant across the task versions and then averaged across participants (N = 16). Theta power increases from the PW to the HL task version, whereas alpha power decreases from the PW to the HL task version.*

## References:

Smith, M. E., Gevins, A., Brown, H., Karnik, A., & Du, R. (2001). Monitoring Task Loading with Multivariate EEG Measures during Complex Forms of Human-Computer Interaction. Human Factors: The Journal of the Human Factors and Ergonomics Society, 43(3), 366–380. <https://doi.org/10.1518/001872001775898287>

Gevins, A., & Smith, M. E. (2003). Neurophysiological measures of cognitive workload during human-computer interaction. Theoretical Issues in Ergonomics Science, 4(1–2), 113–131. <https://doi.org/10.1080/14639220210159717>.

Card, S. K., Moran, T. P. and Newell, A. 1983, The Psychology of Human-Computer Interaction (Hillsdale, NJ: Lawrence Erlbaum Associates, Inc).

Kieras, D. E. 1988, Towards a practical GOMS model methodology for user interface design, in M. Helander (ed.), The Handbook of Human–Computer Interaction (Amsterdam: North-Holland), 135–158.

Olson, J. R. and Olson, G. M. 1990, The growth of cognitive modeling in human-computer interaction since GOMS, Human-Computer Interaction, 5, 221-265.

Miyata, Y., Tanaka, Y. and Hono, T. 1990, Long term observation on Fm-theta during mental effort, Neuroscience, 16, 145–148.

Yamamoto, S. and Matsuoka, S. 1990, Topographic EEG study of visual display terminal VDT performance with special reference to frontal midline theta waves, Brain Topography, 2, 257–267.

Gundel, A. and Wilson, G. F. 1992, Topographical changes in the ongoing EEG related to the difficulty of mental tasks, Brain Topography, 5, 17–25.

Gevins, A., Smith, M. E., McEvoy, L. and Yu, D. 1997, High-resolution EEG mapping of cortical activation related to working memory: effects of task difficulty, type of processing, and practice, Cerebral Cortex, 7, 374–385.

Inouye, T., Shinosaki, K., Iyama, A., Matsumoto, Y., Toi, S. and Ishihara, T. 1994, Potential flow of frontal midline theta activity during a mental task in the human electroencephalogram, Neuroscience Letters, 169, 145–148.

Ishii, R., Shinosaki, K., Ukai, S., Inouye, T., Ishihara, T., Yoshimine, T., Hirabuki, N., Asada, H., Kihara, T., Robinson, S. E. and Takeda, M. 1999, Medial prefrontal cortex generates frontal midline theta rhythm, Neuroreport, 10, 675–679.

Comstock, J. R., & Arnegard, R. J. (1992). The multi-attribute task battery for human operator workload and strategic behavior research (NASA Tech. Memorandum 104174). Hampton, VA: Langley Research Center.

Sharbrough, F., Chatrian, G., Lesser, R. P., Luders, H., Nuwer, M., & Picton, T. W. (1990). Guidelines for standard electrode position nomenclature. Bloomfield, IL: American EEG Society.

Fournier, L. R., Wilson, G. F., & Swain, C. R. (1999). Electrophysiological, behavioral, and subjective indexes of workload when performing multiple tasks: Manipulations of task difficulty and training. International Journal of Psychophysiology, 31, 129–145.

Parasuraman, R., Molloy, R., & Singh, I. L. (1993). Performance consequences of automation-induced “complacency.” International Journal of Aviation Psychology, 3, 1–23.

Simons, D. J., & Chabris, C. F. (1999). Gorillas in our midst: Sustained inattentional blindness for dynamic events. perception, 28(9), 1059-1074.


---

# 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/how-to-calculate-mental-workload-metrics-using-eeg-r-notebook.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.
