> 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/eye-tracking/fixation-classifiers/changes-to-the-fixation-classification-filters-from-imotions-8-1-12-and-onwards.md).

# Fixation classification filters as an R script

Understand what the R script for the I-VT and Duration Dispersion fixation filters offers, and how its results differ from the earlier hard-coded filters.

The detection of fixations and saccades with the Duration Dispersion or I-VT filter is handled by an [R script](https://help.imotions.com/lab/analysis/signal-processing-r-notebooks/what-are-r-notebooks.md) rather than hard-coded into the software, so you can review the signal processing code. This article describes what the R script offers and how its results differ from the earlier hard-coded filters.

## Features of the R script

### Full transparency of the computation

The built-in fixation classification algorithms are implemented as an R script. This means full transparency for you because you are able to review the code line by line. If you prefer the high-level explanation, please review our documentation of the [I-VT](https://help.imotions.com/lab/analysis/eye-tracking/fixation-classifiers/fixation-and-saccade-classification-with-the-i-vt-filter.md) and [Duration Dispersion filter](https://help.imotions.com/lab/analysis/eye-tracking/fixation-classifiers/fixation-classification-with-the-duration-dispersion-filter.md) on the Help Center.

![image\_\_22\_.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-46d0978b341cdab0a474f3fdec95cc67f07dc8e9%2F415e47f9ec_image__22_.webp?alt=media)

### Ability to plot all eye movement related data in the Replay editor

All eye movement metrics that are computed by the fixation classification algorithm (such as the current gaze velocity, duration of a fixation, or the acceleration of a saccade) can be visualized as a graph when you replay the data. This allows you to understand the eye movement behavior in greater depth.

![image\_\_18\_.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-040c3b98b66ba32e392b7dbdc16dca774258a966%2F476d1fedb7_image__18_.webp?alt=media)

### Detailed metadata for all exportable data

In the exports, all exported eye movement metrics will be displayed along with metadata that explains the meaning of the signal.

![image\_\_23\_.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-92475fdaab9ad200715eff45ab04f291f131ef29%2F244f4b3f2d_image__23_.png?alt=media)

### Customizable export for eye movement data

You are able to only export those eye movement metrics that matter to you, to keep your data exports as concise as possible.

![image\_\_19\_.png](https://286068319-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNLNBWkNpljDaAj5rQtNa%2Fuploads%2Fgit-blob-23ac3251e461e0e8b6434329ca1b68c6fb2f7212%2F44b87405a6_image__19_.webp?alt=media)

## Using the fixation classification algorithms

Please note: You will not need to add the fixation classification algorithm in the analysis, as you are used to it when adding signal processing algorithms ("R notebooks") for other modalities. The fixation classification is automatically executed and you can edit the parameters in the familiar UI under *Study level > Gaze Analysis*.

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

## Changes to the algorithms in detail

The change of programming language can lead to slight changes in the results of this signal processing. We also made some adjustments in our computations. In order for you to understand potential deviations in your results, we are outlining the changes below:

1\. For the I-VT filter only, small rounding differences can occur, which can lead to the gaze velocity being classified as slightly lower than the velocity threshold by the old algorithm may now be classified as slightly higher and therefore counted as part of a saccade, or vice versa.

2\. Also for the I-VT filter only, small differences can occur in how fixations get merged. For chains of subsequent short fixations, it can happen that the new algorithm merges fixations if the nth and n+2nd fixation are spatially as well as temporally close together, even if the n+1st fixation's distance actually exceeds the spatial threshold for merging fixations.

3\. The fixation detection algorithm now runs on the entire duration of the recording, from the start of the data collection until the very end. The earlier hard-coded algorithm was executed per stimulus. By basing the computation on the entire recording duration, it is also possible to detect fixations or saccades that started during one stimulus and ended during the subsequent one.

4\. Because it is possible that a fixation starts before the stimulus started, or ended after the stimulus ended, it is possible that stimulus based exports (e.g. AOI metrics) show negative TTFF (time to first fixation) values or Dwell time/ Time spent longer than the actual duration of the stimulus. In the Sensor Data export, the index for fixations on the current stimulus starts counting from the first fixation starting after the StartMedia event.

5\. The computation of gaze angles requires information about the distance at which the respondent is sitting. For screen based eye trackers, iMotions is using the dynamic distance information received from the eye tracker to compute gaze angles. If this information is not available, it uses the fixed distance parameters that you entered in the study settings. Together with the information about the width and height of your screen, iMotions can compute the gaze angles from the pixel coordinates.

For eye tracking glasses, iMotions is only using the fixed field of view parameters (i.e. the height and width of the world camera's field of view, in centimeters, at the given distance) as they are automatically filled in by the software. These parameters about the visual field are based on the manufacturer's information about the scene camera's field of view as well as resolution.

The earlier hard-coded algorithm used the dynamic distance information of the gaze (if available) also for mobile eye tracking glasses. Since the gaze pixels were converted to centimeters based on the fixed width and height information, the dynamic distance together with a fixed pixel-to-centimeter conversion led to varying gaze angle results.

## Validation

To illustrate the impact of these changes, we executed the earlier hard-coded algorithms (Duration Dispersion as well as I-VT filter) as well as the R script versions with the same parameter configurations on five studies and contrasted their results with respect to the amount of detected fixations as well as their duration:

### Study overview

| **Study ID** | **Eye tracker type** | **Sampling rate** | **# Respondents** | **# Stimuli** | **Stimulus types**   | **Average total exposure time** |
| ------------ | -------------------- | ----------------- | ----------------- | ------------- | -------------------- | ------------------------------- |
| Study 1      | Glasses              | 50                | 3                 | 1             | mET recording        | 61 s                            |
| Study 2      | Glasses              | 50                | 2                 | 1             | mET recording        | 335 s                           |
| Study 3      | Screen based         | 60                | 14                | 2             | Video + survey slide | 95 s                            |
| Study 4      | Screen based         | 600               | 5                 | 9             | Text with questions  | 448 s                           |
| Study 5      | Screen based         | 60                | 4                 | 5             | Survey slides        | 37 s                            |

### Results for count of detected fixations with the I-VT filter

| **Study ID** | **Average fixation count with old I-VT** | **Average fixation count with new I-VT** | **Average difference** | **Minimum difference** | **Maximum difference** | **Average overshoot of new I-VT** |
| ------------ | ---------------------------------------- | ---------------------------------------- | ---------------------- | ---------------------- | ---------------------- | --------------------------------- |
| Study 1      | 80                                       | 65                                       | -14                    | -42                    | 8                      | 93%                               |
| Study 2      | 619                                      | 721                                      | 102                    | 67                     | 137                    | 117%                              |
| Study 3      | 190                                      | 187                                      | -4                     | -5                     | -1                     | 98%                               |
| Study 4      | 1579                                     | 1555                                     | -24                    | -39                    | -14                    | 98%                               |
| Study 5      | 99                                       | 96                                       | -3                     | -4                     | -1                     | 97%                               |

### Results for count of detected fixations with the Duration Dispersion filter

| **Study ID** | **Average fixation count with old DD** | **Average fixation count with new DD** | **Average difference** | **Minimum difference** | **Maximum difference** | **Average overshoot of new DD** |
| ------------ | -------------------------------------- | -------------------------------------- | ---------------------- | ---------------------- | ---------------------- | ------------------------------- |
| Study 1      | 129                                    | 129                                    | 0.67                   | 0                      | 1                      | 101%                            |
| Study 2      | 509                                    | 511                                    | 2                      | 0                      | 3                      | 100%                            |
| Study 3      | 242                                    | 240                                    | -1                     | -18                    | 16                     | 100%                            |
| Study 4      | 1513                                   | 1511                                   | -2                     | -19                    | 20                     | 100%                            |
| Study 5      | 105                                    | 103                                    | -2                     | -4                     | 1                      | 98%                             |

### Results for averaged median fixation duration with the I-VT filter

(only available for static stimuli)

| **Study ID** | **Averaged median fixation duration from old I-VT** | **Averaged median fixation duration from new I-VT** | **Average difference** | **Average overshoot of new I-VT** |
| ------------ | --------------------------------------------------- | --------------------------------------------------- | ---------------------- | --------------------------------- |
| Study 4      | 193.5                                               | 194.5                                               | 1.0                    | 100%                              |
| Study 5      | 222.8                                               | 228.5                                               | 5.7                    | 102%                              |

### Results for detected fixation duration with the Duration Dispersion filter

| **Study ID** | **Averaged median fixation duration from old DD** | **Averaged median fixation duration from new DD** | **Average difference** | **Average overshoot of new DD** |
| ------------ | ------------------------------------------------- | ------------------------------------------------- | ---------------------- | ------------------------------- |
| Study 4      | 201.8                                             | 203.1                                             | 1.3                    | 101%                            |
| Study 5      | 202.4                                             | 202.0                                             | -0.4                   | 100%                            |

### Conclusion

For screen based eye tracking studies, there is a very high consistency in the amount and duration of the classified fixations, both for the Duration Dispersion as well as the I-VT filter.

Because of the changes made to the gaze angle computation for mobile eye tracking glasses, the results of the fixation classification varied more for studies collected with a mobile eye tracker.


---

# 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/eye-tracking/fixation-classifiers/changes-to-the-fixation-classification-filters-from-imotions-8-1-12-and-onwards.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.
