# Frontal alpha asymetry

**URL:** https://mne.discourse.group/t/frontal-alpha-asymetry/7364
**Category:** Support & Discussions
**Tags:** eeg, visualization, regression-analysis
**Created:** [August 11, 2023, 12:18pm UTC](https://mne.discourse.group/t/frontal-alpha-asymetry/7364 "2023-08-11T12:18:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![rbn13](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rbn13/32/2951_2.png) [@rbn13](https://mne.discourse.group/u/rbn13)
#### Post date: [August 11, 2023, 12:18pm UTC](https://mne.discourse.group/t/frontal-alpha-asymetry/7364/1 "2023-08-11T12:18:55Z")

</div>

Hello, I am trying to calculate the frontal asymmetry of alpha for the F3 and F4 electrodes. To do this, I have calculated the PSD using this code:

`psd = raw.compute_psd(method="welch", fmin=5, fmax=18, picks="eeg")`

with fmin set to 8 and fmax set to 13 to select the alpha frequency bands (I’m not sure if this is the correct way).  
Then, I have selected the F3 and F4 channels using this code:

```python
    F3 = psd.copy().pick_channels(['F3'])
    F4 = psd.copy().pick_channels(['F4'])

```

Then, I have seen in different studies that they use different ways to calculate it:

```python
        1. FAAln: ln(F4) - ln(F3)
        2. FAAratio: (F4 - F3)/(F3 + F4)
        3. FAAlnratio: (ln(F4) - ln(F3))/(ln(F3) + ln(F4))
        4. FAAlnrel: ln(rel(F4)) - ln(rel(F3))

```

But I am interested in using this formula (F4 - F3)/(F3 + F4). In the end, my code would look like this:

```python
raw = mne.io.read_raw_fif(fif_path)
psd = raw.compute_psd(method="welch", fmin=5, fmax=18, picks="eeg")
F3 = psd.copy().pick_channels(['F3'])
F4 = psd.copy().pick_channels(['F4'])

```

Now I don’t know how to proceed to arrive to this final step “Faa\_ratio = (F4 - F3)/(F3 + F4)”. Does anyone know any tutorial or example of how to do it? According to what I have seen in some studies, they have calculated the relative band power, but how is it done? Can someone help me?

---

<div class="post-metadata">

### Author: ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)
#### Post date: [August 11, 2023, 1:36pm UTC](https://mne.discourse.group/t/frontal-alpha-asymetry/7364/2 "2023-08-11T13:36:38Z")

</div>

Hi @rbn13,

I think you’ll need to extract the underlying data using the `get_data` method, which will return a numpy Array, and then do your calculations from there. For example to add to your code:

```python
raw = mne.io.read_raw_fif(fif_path)
psd = raw.compute_psd(method="welch", fmin=5, fmax=18, picks="eeg")
F3 = psd.copy().pick_channels(['F3'])
F4 = psd.copy().pick_channels(['F4'])
F3_data = F3.get_data() # numpy array
F4_data = F4.get_data() # numpy array

```

Then you can use the returned numpy arrays for your asymetry calculations.

---

<div class="post-metadata">

### Author: ![rbn13](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rbn13/32/2951_2.png) [@rbn13](https://mne.discourse.group/u/rbn13)
#### Post date: [August 14, 2023, 8:56am UTC](https://mne.discourse.group/t/frontal-alpha-asymetry/7364/3 "2023-08-14T08:56:08Z")

</div>

Thanks for your response @scott-huberty. With the code you have provided, I can extract an array with the data from the chosen channel. But now what I am looking for is to know how to calculate the FFA. I’m not sure if I should first calculate the “relative band power” and how to do it, and what steps to follow, or if it would be enough to calculate the averages of the arrays for each channel and apply one of the mentioned formulas. What would be the correct steps to calculate the FFA?

---

<div class="post-metadata">

### Author: ![scott-huberty](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/scott-huberty/32/2715_2.png) [@scott-huberty](https://mne.discourse.group/u/scott-huberty)
#### Post date: [August 14, 2023, 2:25pm UTC](https://mne.discourse.group/t/frontal-alpha-asymetry/7364/4 "2023-08-14T14:25:41Z")

</div>

> [@rbn13](#):
>
> I’m not sure if I should first calculate the “relative band power” and how to do it, and what steps to follow, or if it would be enough to calculate the averages of the arrays for each channel and apply one of the mentioned formulas.

Hi @rbn13

Relative power is basically a ratio score of the power in your band of interest divided by the power in the entire frequency range of your PSD. For example in your case it would allow you to estimate the percentage of the power spectrum that is accounted for by the alpha band.

Whether you should use relative or absolute power is dependent on your research question and study, i.e. there’s no one right answer. For example, if there is a wide age range across your participants, some may argue for the use of relative power, because head size etc can affect the measurement absolute power - the argument being that using relative power normalizes the measurement for each participant and makes it more comparable across subjects. But I am just sharing with you arguments that I’ve heard in the field, not telling you a hard and fast rule.

Anyways, in your code you _only_ calculate power for (what you define as) your alpha band: `psd = raw.compute_psd(method="welch", fmin=5, fmax=18, picks="eeg")`, so you cannot calculate relative power. If you want to calculate relative power you’ll need to change your code a bit. something like:

```python
psd = raw.compute_psd(method="welch", fmin=1, fmax=50, picks="eeg")
alpha_mask = ((psd.freqs >= 8) & (psd.freqs <= 13))

F3 = psd.copy().pick(['F3'])
F4 = psd.copy().pick(['F4'])

F3_data_total = F3.get_data().squeeze() # numpy array
F4_data_total = F4.get_data().squeeze() # numpy array

F3_data_alpha = F3_data_total[alpha_mask].mean()
F4_data_alpha = F4_data_total[alpha_mask].mean()

F3_rel_alpha = F3_data_alpha / F3_data_total.mean()
F4_rel_alpha = F4_data_alpha / F4_data_total.mean()

# compute asymetry 
# ...

```

Above we define a total psd range of interest (this range can be changed depending on your research question) and calculate the psd. Then we limit the psd to the alpha range and calculate relative power for each sensor.

> [@rbn13](#):
>
> What would be the correct steps to calculate the FFA?

Again this is probably a matter of some debate, as you shared above, there seem to be multiple suggested metrics for this. I’ve never conducted alpha asymmetry analyses so don’t have a strong/informed opinion, but hopefully there is some analytical flexibility in the method you use (i.e. hopefully they would produce similar results). If I were you I’d take a look at the literature, and compare the results of the different suggested calculations and go from there.

Hope this helps!

Scott

---

<div class="post-metadata">

### Author: ![rbn13](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rbn13/32/2951_2.png) [@rbn13](https://mne.discourse.group/u/rbn13)
#### Post date: [August 21, 2023, 8:12am UTC](https://mne.discourse.group/t/frontal-alpha-asymetry/7364/5 "2023-08-21T08:12:43Z")

</div>

Thanks for share your knowledge! Your answer has been very usefull for me.
