Calculate Out-of-Bounds Proportion by Subject and Trial

Description

This function calculates the number and percentage of gaze points that fall outside a specified range (0,1) for both X and Y coordinates, grouped by subject and trial.

Usage

gaze_oob(
  data,
  subject_col = "subject",
  trial_col = "trial",
  x_col = "x_pred_normalised",
  y_col = "y_pred_normalised"
)

Arguments

data A data frame containing gaze data.
subject_col A string specifying the name of the column that contains the subject identifier. Default is "subject".
trial_col A string specifying the name of the column that contains the trial identifier. Default is "trial".
x_col A string specifying the name of the column that contains the X coordinate. Default is "x_pred_normalised".
y_col A string specifying the name of the column that contains the Y coordinate. Default is "y_pred_normalised".

Value

A list containing two data frames:

subject_results
Summary of missingness at the subject level, including total trials, total points, and percentages.
trial_results
Summary of missingness at the trial level, including total points, and percentages.

Examples

library("webgazeR")

  # Example data
  data <- data.frame(
    subject = rep(1:2, each = 10),
    trial = rep(1:5, times = 4),
    x_pred_normalised = runif(20, -0.5, 1.5),
    y_pred_normalised = runif(20, -0.5, 1.5)
  )

  # Calculate out-of-bounds proportion by subject and trial
  results <- gaze_oob(data)

  # View results
  print(results$subject_results)
  print(results$trial_results)