cat_lines2: Categorize fixations into appropriate text lines

Description Usage Arguments Details Value Author(s)

Description

Function to optimize slope, offset and sd for all lines of fixations (extended from original paper)This function uses one slope, offset, sd to fit all lines, and use sum(min y_diff) as target measure for optimization uses.

Usage

1
2
3
cat_lines2(params, fit_it = TRUE, data, start_pts, k_bounds, o_bounds,
  s_bounds, den_sd_cutoff, den_ratio_cutoff, num_checkFirst = 5,
  num_checkLast = 10)

Arguments

params

A vector of parameters for optimization, the three values in it refer to slope, offset, and sd

fit_it

A bollean variable; if it is TRUE, the function will return fit measure; if it is FALSE, the function will return fit information

data

A data.frame storing the fixation data including at least the x_pos and y_pos of each fixation

start_pts

A data.frame containing the starting position of each text line. It has three columns:

  1. x_pos: x position of the first word in each text line.

  2. y_pos: y position of the first word in each text line.

  3. trial_num: the trial number of the current start_pts

k_bounds

A list containing the lower and upper boundaries of slope; default value is [-0.1, 0.1]

o_bounds

A list containing the lower and upper boundaries of offset; defaul value is [-0.5*dist of adjacent text lines, 0.5*dist of adjacent text line])

s_bounds

A list containing the lower and upper boundaries of sd; default value is [1, 20]

den_sd_cutoff

A float variable for cutoff threshold for density; If it is Inf, use mean(inv_dnorm(exp(data_den_max))) + 3*sd(inv_dnorm(exp(data_den_max))) as cutoff (99.7% are accepted)

den_ratio_cutoff

A float variable for cutoff threshold for density ratio (ratio between the maximum density and second maximum density)

num_checkFirst

An integer denoting the number of starting fixations used for checking start-reading bound; default value is 5

num_checkLast

An integer denoting the number of ending fixations used for checking end-reading bound; default value is 10

Details

This function optimizes the slope, offset and sd for all lines of fixations. It uses sum(min(y_diff)) as fit measure for optimization.

Value

A data.frame including fixation data, and fitting data including fit measures and fitted lines information. It adds the following columns:

  1. line: Text line that each fixation belongs to

  2. y_line: y position of the text line that each fixation is assigned to

  3. y_res: Residualized y position of each fixation y_line + y_res will give the original y position of each fixation

  4. slope: Optimized slope value for all fitted lines

  5. offset: Optimizaed offset value for all fitted lines

  6. sd: Optimized sd value for all fitted lines

  7. fit_den: fitted density value

  8. fit_y_diff: fitted y difference (accumulated y differences between each fixation and the fitted line)

Author(s)

Tao Gong [email protected]


davebraze/FDBeye documentation built on May 14, 2019, 9 p.m.