Adjust y coordinates for gaze data, such as might occur in reading multi-line text or other tasks with a similar visual scanning component. While "ground truth" for fixation locations is not easily obtained, consensus among reading researchers who use eye tracking to understand on-line reading processes holds that data for y coordinates obtained through most (all) eye tracking devices is imperfect and often in need of adjustment prior to computing regional summaries of gaze data. This function serves that purpose, using an optimization approach similar to that used in aligning neurimaging data with standard templates.

adjust_y(data, lines, init_params, FUN, ...)

Arguments

data

A data.frame containing gaze data (fixations or samples), possibly from multiple subjects/trials.

lines

A vector of known y positions (centroids) of text lines for each trial contained in data. This argument is passed to FUN. [maybe this should be a data.frame]

init_params

A vector or a matrix (each row is a vector of parameters for one fitted line) containing the parameters to be optimized using different cat_line functions,

FUN

A function to optimize in order to compute adjusted y-values for a single trial.

...

Additional arguments passed to FUN.

Value

A copy of data enriched with adjusted y values and fit parameters.

Details

The function first uses optim() to optimize the parameters for FUN (classify_lines). Then, it uses FUN with optimized parameters to classify fixations into different text lines. Finally, it returns the fixation dataframe with classified lines and optimized parameters.

Author

Tao Gong gtojty@gmail.com