Getting Started: Microsaccade Analysis in R
#1
The online saccade parser implemented in the EyeLink Host Software is not designed to detect microsaccades (e.g. saccades < ~1 degree of visual angle). If you want to analyze your data for microsaccades you will need to use an alternative technique, such as the widely adopted approach described by Engbert and Kleigl in their 2003 paper.

The authors have made their microsaccade detection R code available for researchers.

There are two versions of the EyeLink_MS_Toolbox_R Scripts, the first takes a Data Viewer Sample Report as input. The second reads EDF files in directly via the eyelinkReader package. This package can be installed via cran: https://cran.r-project.org/package=eyelinkReader

1) Sample Report Version:
The ZIP file found here contains the original R scripts from the MS_Toolbox_R package linked above, and an additional helper script - EyeLink_Demo.R - which acts as a wrapper for the E&K functions, and which allows EyeLink users to apply them directly to a Data Viewer Sample Report. The only change made to the original E&K scripts is a minor modification to the microsacc.R function, which adds a short delay to prevent post-saccadic oscillations from being detected as saccades.

To use the helper script first import all your EDF files into Data Viewer and output a Sample Report containing the following Data Viewer variables, plus any experimental variables that code trial / condition parameters that may be required for further statistical analysis / comparisons:

Code:
RECORDING_SESSION_LABEL, TRIAL_INDEX, LEFT_GAZE_X, LEFT_GAZE_Y, RIGHT_GAZE_X, RIGHT_GAZE_Y

Place the sample report in the data subfolder.

The code in Microsaccades_EyeLink.R can be executed block by block, by highlighting each section in turn and clicking Run in RStudio. The first block loads the required libraries and functions. The second block sets screen resolution / dimension / distance variables. Please change these variables to match your physical set up. These variables are used in the third block, which reads in the sample report and converts gaze data from pixels to degrees of visual angle (which is what the E&K functions expect). The fourth block contains a loop that runs through the Sample Report, and executes the E&K saccade detection functions for each trial / participant, combining the output of the "sacpar" function into a single output array. Please make sure to set the sampling rate and critical MINDUR and VFAC parameters that are used by the E&K functions. The final block writes the output array to a tab-delimited text file in the data subdirectory. There is an additional block that creates a summary plot of the frequency of saccades as a function of their orientation (as a sanity check / example).

2) EDF Import version
The code attached below is identical, but reads in EDF files directly as input, and uses the eyelinkReader package to convert the EDF data

.zip   EyeLink_MS_Toolbox_eyelinkReader.R.zip (Size: 1.68 MB / Downloads: 119)

In both cases, the code should be considered evaluative and is offered in the hope some users find it helpful.

If you find the code useful for your research, please cite the following in any resulting publication:

Quote:Engbert, R., Sinn, P., Mergenthaler, K., & Trukenbrod, H. (2015) Microsaccade Toolbox