| Title: | Import, Inspect, Analyse, and Report Gazepoint GP3 Exports |
|---|---|
| Description: | Tools for importing, inspecting, cleaning, summarising, modelling, and reporting Gazepoint GP3 and Gazepoint Analysis CSV exports. The package supports offline workflows for all-gaze, fixation, pupil, area-of-interest, transition, time-course, quality-audit, and manuscript-reporting analyses. The package methodology is described in the peer-reviewed software paper <doi:10.3390/jemr19040076>. |
| Authors: | Stefanos Balaskas [aut, cre] (ORCID: <https://orcid.org/0000-0003-2444-9796>) |
| Maintainer: | Stefanos Balaskas <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.4.0 |
| Built: | 2026-10-11 13:16:14 UTC |
| Source: | https://github.com/stefanosbalaskas/gp3tools |
Labels gaze samples using one or more rectangular AOI definitions.
add_gazepoint_aoi( master_df, aoi_defs, x_col = "FPOGX", y_col = "FPOGY", aoi_name = NULL, output = c("logical", "label", "both"), prefix = "aoi_", label_col = "aoi_current", outside_label = "outside", overlap = c("first", "last", "error"), include_overlap_count = TRUE )add_gazepoint_aoi( master_df, aoi_defs, x_col = "FPOGX", y_col = "FPOGY", aoi_name = NULL, output = c("logical", "label", "both"), prefix = "aoi_", label_col = "aoi_current", outside_label = "outside", overlap = c("first", "last", "error"), include_overlap_count = TRUE )
master_df |
A sample-level gaze data frame. |
aoi_defs |
AOI definition data frame. Recognised aliases include
|
x_col, y_col
|
Gaze-coordinate columns. |
aoi_name |
Optional AOI name selecting one row from |
output |
Add logical AOI columns, a single label column, or both. |
prefix |
Prefix for logical AOI columns. |
label_col |
Name of the single AOI-label column. |
outside_label |
Label for samples outside all AOIs. |
overlap |
Overlap handling for the label column. |
include_overlap_count |
Add the number of AOIs containing each sample. |
The input data with AOI membership columns.
gaze <- data.frame( FPOGX = c(0.2, 0.5, 0.8), FPOGY = c(0.2, 0.5, 0.8) ) defs <- data.frame( name = c("top_left", "bottom_right"), L = c(0, 0.6), R = c(0.4, 1), T = c(0, 0.6), B = c(0.4, 1) ) add_gazepoint_aoi(gaze, defs, output = "both")gaze <- data.frame( FPOGX = c(0.2, 0.5, 0.8), FPOGY = c(0.2, 0.5, 0.8) ) defs <- data.frame( name = c("top_left", "bottom_right"), L = c(0, 0.6), R = c(0.4, 1), T = c(0, 0.6), B = c(0.4, 1) ) add_gazepoint_aoi(gaze, defs, output = "both")
Match each gaze sample to a time-indexed AOI definition and classify the sample against rectangular or polygon geometry. Definitions can also be grouped by participant, stimulus, trial, or other shared columns.
add_gazepoint_dynamic_aoi( master_df, aoi_defs, x_col = "FPOGX", y_col = "FPOGY", time_col = "TIME", aoi_time_col = "aoi_time", aoi_name_col = "aoi_name", shape = c("auto", "rectangle", "polygon"), group_cols = NULL, match = c("nearest", "previous", "next"), max_time_gap = Inf, left_col = "left", right_col = "right", top_col = "top", bottom_col = "bottom", vertex_x_col = "vertex_x", vertex_y_col = "vertex_y", vertex_order_col = NULL, output = c("label", "logical", "both"), prefix = "aoi_", label_col = "aoi_current", outside_label = "outside", overlap = c("first", "last", "error"), boundary = c("inside", "outside"), definition_time_col = "aoi_definition_time", time_gap_col = "aoi_time_gap", include_overlap_count = TRUE )add_gazepoint_dynamic_aoi( master_df, aoi_defs, x_col = "FPOGX", y_col = "FPOGY", time_col = "TIME", aoi_time_col = "aoi_time", aoi_name_col = "aoi_name", shape = c("auto", "rectangle", "polygon"), group_cols = NULL, match = c("nearest", "previous", "next"), max_time_gap = Inf, left_col = "left", right_col = "right", top_col = "top", bottom_col = "bottom", vertex_x_col = "vertex_x", vertex_y_col = "vertex_y", vertex_order_col = NULL, output = c("label", "logical", "both"), prefix = "aoi_", label_col = "aoi_current", outside_label = "outside", overlap = c("first", "last", "error"), boundary = c("inside", "outside"), definition_time_col = "aoi_definition_time", time_gap_col = "aoi_time_gap", include_overlap_count = TRUE )
master_df |
A sample-level gaze data frame. |
aoi_defs |
Time-indexed AOI definitions. |
x_col, y_col
|
Gaze-coordinate columns in |
time_col |
Sample timestamp column. |
aoi_time_col |
Definition timestamp column. |
aoi_name_col |
AOI-name column. |
shape |
Geometry type: |
group_cols |
Columns shared by |
match |
Time-matching rule: nearest, previous, or next definition. |
max_time_gap |
Maximum permitted absolute gap between a sample and its matched definition timestamp, in native time units. |
left_col, right_col, top_col, bottom_col
|
Rectangle boundary columns. |
vertex_x_col, vertex_y_col
|
Polygon vertex columns. |
vertex_order_col |
Optional polygon vertex-order column. |
output |
Add logical columns, a label column, or both. |
prefix |
Prefix for logical AOI columns. |
label_col |
AOI-label column. |
outside_label |
Label used outside all AOIs. |
overlap |
Overlap handling. |
boundary |
Polygon-boundary handling. |
definition_time_col, time_gap_col
|
Names of dynamic-match diagnostics. |
include_overlap_count |
Add the number of containing AOIs. |
The input data with dynamic AOI membership and match-diagnostic columns.
Classify sample-level gaze coordinates against one or more polygon AOIs using a base-R ray-casting implementation. Polygon vertices are grouped by AOI name and ordered either by row order or an explicit vertex-order column.
add_gazepoint_polygon_aoi( master_df, vertices, x_col = "FPOGX", y_col = "FPOGY", aoi_col = "aoi_name", vertex_x_col = "vertex_x", vertex_y_col = "vertex_y", vertex_order_col = NULL, output = c("label", "logical", "both"), prefix = "aoi_", label_col = "aoi_current", outside_label = "outside", overlap = c("first", "last", "error"), boundary = c("inside", "outside"), include_overlap_count = TRUE )add_gazepoint_polygon_aoi( master_df, vertices, x_col = "FPOGX", y_col = "FPOGY", aoi_col = "aoi_name", vertex_x_col = "vertex_x", vertex_y_col = "vertex_y", vertex_order_col = NULL, output = c("label", "logical", "both"), prefix = "aoi_", label_col = "aoi_current", outside_label = "outside", overlap = c("first", "last", "error"), boundary = c("inside", "outside"), include_overlap_count = TRUE )
master_df |
A sample-level gaze data frame. |
vertices |
Polygon-vertex data frame. |
x_col, y_col
|
Gaze-coordinate columns. |
aoi_col |
AOI-name column in |
vertex_x_col, vertex_y_col
|
Vertex-coordinate columns. |
vertex_order_col |
Optional vertex-order column. |
output |
Add logical AOI columns, one label column, or both. |
prefix |
Prefix for logical AOI columns. |
label_col |
Name of the AOI-label column. |
outside_label |
Label used outside all polygons. |
overlap |
Overlap handling for the label column. |
boundary |
Should points on polygon boundaries be treated as inside? |
include_overlap_count |
Add the number of containing AOIs. |
The input data with polygon AOI membership columns.
gaze <- data.frame( FPOGX = c(0.2, 0.7, 0.9), FPOGY = c(0.2, 0.7, 0.1) ) triangle <- data.frame( aoi_name = "triangle", vertex_x = c(0, 1, 0), vertex_y = c(0, 0, 1) ) add_gazepoint_polygon_aoi( gaze, triangle, output = "both" )gaze <- data.frame( FPOGX = c(0.2, 0.7, 0.9), FPOGY = c(0.2, 0.7, 0.1) ) triangle <- data.frame( aoi_name = "triangle", vertex_x = c(0, 1, 0), vertex_y = c(0, 0, 1) ) add_gazepoint_polygon_aoi( gaze, triangle, output = "both" )
Constructs the same pupil stream under multiple declared policies and compares data retention, descriptive distribution summaries, condition means/contrasts, and pairwise series correlations. It deliberately avoids converting policy disagreement into an automatic inferential verdict.
analyse_gazepoint_binocular_sensitivity( data, left_col, right_col, policies = c("complete_case", "available_eye", "reconstructed_mean", "left_only", "right_only"), prefix = "gp3_binocular", group_cols = NULL, condition_col = NULL, valid_min = NULL, valid_max = NULL )analyse_gazepoint_binocular_sensitivity( data, left_col, right_col, policies = c("complete_case", "available_eye", "reconstructed_mean", "left_only", "right_only"), prefix = "gp3_binocular", group_cols = NULL, condition_col = NULL, valid_min = NULL, valid_max = NULL )
data |
Raw data or reconstruction output. |
left_col, right_col
|
Original pupil channels. |
policies |
Any of |
prefix |
Reconstruction prefix. |
group_cols |
Optional grouping columns for descriptive summaries. |
condition_col |
Optional condition column. When supplied, simple descriptive mean contrasts relative to the first observed condition are returned; no p-values are calculated. |
valid_min, valid_max
|
Optional raw-channel bounds. |
A gp3_binocular_sensitivity object containing policy summaries,
pairwise correlations, optional condition summaries/contrasts, and the
constructed long series.
audit_gazepoint_binocular_reconstruction()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 24) dat$pupil_right[20:24] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 ) analyse_gazepoint_binocular_sensitivity( rec, "pupil_left", "pupil_right", condition_col = "condition" )dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 24) dat$pupil_right[20:24] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 ) analyse_gazepoint_binocular_sensitivity( rec, "pupil_left", "pupil_right", condition_col = "condition" )
Creates overlapping or non-overlapping time windows and calculates selected summary statistics for numeric gaze or pupil columns.
analyze_gazepoint_window( et_data, window_size = 50, step = 10, summary_stats = c("mean", "sd"), by = "USER_ID", condition_col = NULL, value_cols = NULL, ts_col = "TIME", window_unit = c("milliseconds", "seconds", "native"), time_unit = c("auto", "seconds", "milliseconds"), include_partial = FALSE )analyze_gazepoint_window( et_data, window_size = 50, step = 10, summary_stats = c("mean", "sd"), by = "USER_ID", condition_col = NULL, value_cols = NULL, ts_col = "TIME", window_unit = c("milliseconds", "seconds", "native"), time_unit = c("auto", "seconds", "milliseconds"), include_partial = FALSE )
et_data |
A sample-level data frame. |
window_size |
Window width. |
step |
Distance between consecutive window starts. |
summary_stats |
Statistics to calculate. Supported values are
|
by |
Grouping columns defining independent time series. |
condition_col |
Optional condition column appended to |
value_cols |
Numeric columns to summarise. When |
ts_col |
Timestamp column. |
window_unit |
Unit used by |
time_unit |
Unit of the timestamp column. |
include_partial |
Include a final window that is shorter than
|
A tibble with one row per group and time window.
pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.99, by = 0.01), mean_pupil = sin(seq(0, 2 * pi, length.out = 100)) ) analyze_gazepoint_window( pupil, window_size = 100, step = 50, value_cols = "mean_pupil" )pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.99, by = 0.01), mean_pupil = sin(seq(0, 2 * pi, length.out = 100)) ) analyze_gazepoint_window( pupil, window_size = 100, step = 50, value_cols = "mean_pupil" )
Converts a Gazepoint all-gaze export into a standard sample-level table with
one row per gaze sample. The returned table keeps Gazepoint identifiers but
also adds analysis-friendly columns such as subject, media_id, time_ms,
x, y, left_pupil, right_pupil, mean_pupil, valid_sample,
missing_gaze, missing_pupil, trackloss, blink, aoi_current,
message, and event_type.
as_gazepoint_master( data, screen_width_px = NULL, screen_height_px = NULL, source_col = "USER_FILE", media_col = "MEDIA_ID", media_name_col = "MEDIA_NAME", time_col = "TIME", coordinate_unit = c("auto", "normalised", "pixels"), event_latency_offset_ms = 0 )as_gazepoint_master( data, screen_width_px = NULL, screen_height_px = NULL, source_col = "USER_FILE", media_col = "MEDIA_ID", media_name_col = "MEDIA_NAME", time_col = "TIME", coordinate_unit = c("auto", "normalised", "pixels"), event_latency_offset_ms = 0 )
data |
A Gazepoint all-gaze data frame, usually |
screen_width_px |
Optional screen width in pixels. If supplied and gaze coordinates are detected as normalised 0-1 coordinates, x coordinates are converted to pixels. |
screen_height_px |
Optional screen height in pixels. If supplied and gaze coordinates are detected as normalised 0-1 coordinates, y coordinates are converted to pixels. |
source_col |
Column identifying the source/user file. |
media_col |
Column identifying the Gazepoint media/stimulus. |
media_name_col |
Column identifying the Gazepoint media/stimulus name. |
time_col |
Gazepoint time column, usually |
coordinate_unit |
One of |
event_latency_offset_ms |
Optional timing correction in milliseconds. Positive values shift event/sample time forward. |
This function is intended as a bridge between raw Gazepoint exports and more advanced eye-tracking workflows. It does not require an external trial log. Later, experiment-level information such as condition, trial ID, response, accuracy, or reaction time can be joined to the returned table.
A tibble with one row per sample and standardised sample-level eye-tracking columns.
## Not run: results <- run_gazepoint_workflow( export_dir = "C:/Users/YourName/Desktop/gp3_test_exports", output_dir = "C:/Users/YourName/Desktop/gp3_outputs" ) master <- as_gazepoint_master( results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) dplyr::glimpse(master) ## End(Not run)## Not run: results <- run_gazepoint_workflow( export_dir = "C:/Users/YourName/Desktop/gp3_test_exports", output_dir = "C:/Users/YourName/Desktop/gp3_outputs" ) master <- as_gazepoint_master( results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) dplyr::glimpse(master) ## End(Not run)
Validate observed sample-level AOI labels against AOI labels derived from gaze coordinates and AOI geometry.
audit_gazepoint_aoi_coding_matrix( gaze_data, aoi_geometry, observed_aoi_col = NULL, gaze_x_col = NULL, gaze_y_col = NULL, gaze_stimulus_col = NULL, sample_id_cols = NULL, geometry_aoi_col = NULL, geometry_stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), tie_method = c("ambiguous", "first"), outside_label = "outside", ambiguous_label = "ambiguous", missing_label = "missing_coordinate", observed_outside_values = c("outside", "none", "no_aoi", "non_aoi", "background", "off_aoi"), max_mismatch_prop = 0.05, max_ambiguous_prop = 0.05, max_missing_coordinate_prop = 0.2, ignore_invalid_geometry = TRUE )audit_gazepoint_aoi_coding_matrix( gaze_data, aoi_geometry, observed_aoi_col = NULL, gaze_x_col = NULL, gaze_y_col = NULL, gaze_stimulus_col = NULL, sample_id_cols = NULL, geometry_aoi_col = NULL, geometry_stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), tie_method = c("ambiguous", "first"), outside_label = "outside", ambiguous_label = "ambiguous", missing_label = "missing_coordinate", observed_outside_values = c("outside", "none", "no_aoi", "non_aoi", "background", "off_aoi"), max_mismatch_prop = 0.05, max_ambiguous_prop = 0.05, max_missing_coordinate_prop = 0.2, ignore_invalid_geometry = TRUE )
gaze_data |
A data frame containing gaze samples and observed AOI labels. |
aoi_geometry |
A data frame containing AOI geometry definitions. |
observed_aoi_col |
Observed AOI label column in |
gaze_x_col |
Gaze x-coordinate column. If |
gaze_y_col |
Gaze y-coordinate column. If |
gaze_stimulus_col |
Optional gaze stimulus/media column. |
sample_id_cols |
Optional columns to carry into the sample-level coding audit table. |
geometry_aoi_col |
AOI label/name column in |
geometry_stimulus_col |
Optional stimulus/media column in
|
x_min_col |
Optional AOI left/x-min column. |
y_min_col |
Optional AOI top/y-min column. |
x_max_col |
Optional AOI right/x-max column. |
y_max_col |
Optional AOI bottom/y-max column. |
x_col |
Optional AOI left/x column used with |
y_col |
Optional AOI top/y column used with |
width_col |
Optional AOI width column. |
height_col |
Optional AOI height column. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
tie_method |
How to handle samples falling in multiple AOIs. Use
|
outside_label |
Label used for samples outside all AOIs. |
ambiguous_label |
Label used for samples inside multiple AOIs when
|
missing_label |
Label used for samples with missing/non-finite gaze coordinates. |
observed_outside_values |
Character values in |
max_mismatch_prop |
Maximum acceptable proportion of comparable samples where observed and geometry-derived AOI labels differ. |
max_ambiguous_prop |
Maximum acceptable proportion of samples with ambiguous geometry-derived AOI assignment. |
max_missing_coordinate_prop |
Maximum acceptable proportion of samples with missing/non-finite gaze coordinates. |
ignore_invalid_geometry |
Logical. If |
A list with class gp3_aoi_coding_matrix_audit containing overview,
geometry_summary, sample_coding, coding_matrix, observed_summary,
derived_summary, flagged_samples, and settings tables.
Create a publication-level audit of AOI geometry definitions, including AOI size, area, coordinate validity, screen-bound checks, and duplicate geometry.
audit_gazepoint_aoi_geometry( data, aoi_col = NULL, stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), min_width = 0, min_height = 0, min_area = 0, max_area_prop = 1, require_within_screen = TRUE )audit_gazepoint_aoi_geometry( data, aoi_col = NULL, stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), min_width = 0, min_height = 0, min_area = 0, max_area_prop = 1, require_within_screen = TRUE )
data |
A data frame containing AOI geometry definitions. |
aoi_col |
AOI label/name column. If |
stimulus_col |
Optional stimulus/media column. |
x_min_col |
Optional AOI left/x-min column. |
y_min_col |
Optional AOI top/y-min column. |
x_max_col |
Optional AOI right/x-max column. |
y_max_col |
Optional AOI bottom/y-max column. |
x_col |
Optional AOI left/x column used with |
y_col |
Optional AOI top/y column used with |
width_col |
Optional AOI width column. |
height_col |
Optional AOI height column. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
min_width |
Minimum acceptable AOI width. |
min_height |
Minimum acceptable AOI height. |
min_area |
Minimum acceptable AOI area. |
max_area_prop |
Maximum acceptable AOI area as a proportion of screen area. |
require_within_screen |
Logical. If |
A list with class gp3_aoi_geometry_audit containing overview,
geometry_summary, size_summary, flagged_aois, duplicate_geometry, and
settings tables.
Audit whether sample-level AOI assignments are sensitive to small expansions or shrinkages of AOI boundaries.
audit_gazepoint_aoi_margin_sensitivity( gaze_data, aoi_geometry, gaze_x_col = NULL, gaze_y_col = NULL, gaze_stimulus_col = NULL, sample_id_cols = NULL, geometry_aoi_col = NULL, geometry_stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, margins = c(-0.02, 0, 0.02), screen_x_range = c(0, 1), screen_y_range = c(0, 1), tie_method = c("ambiguous", "first"), outside_label = "outside", ambiguous_label = "ambiguous", missing_label = "missing_coordinate", max_margin_change_prop = 0.1, max_ambiguous_prop = 0.05, ignore_invalid_geometry = TRUE )audit_gazepoint_aoi_margin_sensitivity( gaze_data, aoi_geometry, gaze_x_col = NULL, gaze_y_col = NULL, gaze_stimulus_col = NULL, sample_id_cols = NULL, geometry_aoi_col = NULL, geometry_stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, margins = c(-0.02, 0, 0.02), screen_x_range = c(0, 1), screen_y_range = c(0, 1), tie_method = c("ambiguous", "first"), outside_label = "outside", ambiguous_label = "ambiguous", missing_label = "missing_coordinate", max_margin_change_prop = 0.1, max_ambiguous_prop = 0.05, ignore_invalid_geometry = TRUE )
gaze_data |
A data frame containing gaze samples. |
aoi_geometry |
A data frame containing AOI geometry definitions. |
gaze_x_col |
Gaze x-coordinate column. If |
gaze_y_col |
Gaze y-coordinate column. If |
gaze_stimulus_col |
Optional gaze stimulus/media column. |
sample_id_cols |
Optional columns to carry into the sample-level audit table. |
geometry_aoi_col |
AOI label/name column in |
geometry_stimulus_col |
Optional stimulus/media column in
|
x_min_col |
Optional AOI left/x-min column. |
y_min_col |
Optional AOI top/y-min column. |
x_max_col |
Optional AOI right/x-max column. |
y_max_col |
Optional AOI bottom/y-max column. |
x_col |
Optional AOI left/x column used with |
y_col |
Optional AOI top/y column used with |
width_col |
Optional AOI width column. |
height_col |
Optional AOI height column. |
margins |
Numeric vector of AOI boundary margins. Positive values expand AOIs; negative values shrink AOIs. A zero-margin baseline is always added. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
tie_method |
How to handle samples falling in multiple AOIs. Use
|
outside_label |
Label for samples outside all AOIs. |
ambiguous_label |
Label for samples inside multiple AOIs when
|
missing_label |
Label for samples with missing/non-finite gaze coordinates. |
max_margin_change_prop |
Maximum acceptable proportion of samples whose AOI assignment changes from the zero-margin baseline. |
max_ambiguous_prop |
Maximum acceptable proportion of ambiguous samples. |
ignore_invalid_geometry |
Logical. If |
A list with class gp3_aoi_margin_sensitivity_audit containing
overview, geometry_summary, sample_sensitivity, margin_summary,
aoi_margin_summary, flagged_samples, and settings tables.
Create a publication-level audit of pairwise AOI overlap within each stimulus.
audit_gazepoint_aoi_overlap( data, aoi_col = NULL, stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), min_overlap_area = 0, min_overlap_prop = 0, ignore_invalid_geometry = TRUE )audit_gazepoint_aoi_overlap( data, aoi_col = NULL, stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), min_overlap_area = 0, min_overlap_prop = 0, ignore_invalid_geometry = TRUE )
data |
A data frame containing AOI geometry definitions. |
aoi_col |
AOI label/name column. If |
stimulus_col |
Optional stimulus/media column. |
x_min_col |
Optional AOI left/x-min column. |
y_min_col |
Optional AOI top/y-min column. |
x_max_col |
Optional AOI right/x-max column. |
y_max_col |
Optional AOI bottom/y-max column. |
x_col |
Optional AOI left/x column used with |
y_col |
Optional AOI top/y column used with |
width_col |
Optional AOI width column. |
height_col |
Optional AOI height column. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
min_overlap_area |
Minimum overlap area above which an AOI pair is flagged. |
min_overlap_prop |
Minimum overlap proportion above which an AOI pair is flagged. This is computed relative to the smaller AOI in the pair. |
ignore_invalid_geometry |
Logical. If |
A list with class gp3_aoi_overlap_audit containing overview,
geometry_summary, pairwise_overlap, overlap_summary, flagged_overlaps, and
settings tables.
Checks rectangular AOIs against declared screen or stimulus dimensions. The helper reports missing geometry, invalid rectangle order, off-screen AOIs, raw AOI area, clipped on-screen area, and screen-coverage rates. Coverage summaries are descriptive and do not correct for AOI overlap.
audit_gazepoint_aoi_screen_coverage( data, screen_width, screen_height, aoi_col = NULL, x_min_col = "x_min", x_max_col = "x_max", y_min_col = "y_min", y_max_col = "y_max", margin = 0 )audit_gazepoint_aoi_screen_coverage( data, screen_width, screen_height, aoi_col = NULL, x_min_col = "x_min", x_max_col = "x_max", y_min_col = "y_min", y_max_col = "y_max", margin = 0 )
data |
A data frame containing AOI geometry. |
screen_width, screen_height
|
Numeric screen or stimulus dimensions. |
aoi_col |
Optional AOI identifier column. |
x_min_col, x_max_col, y_min_col, y_max_col
|
Character names of rectangle boundary columns. |
margin |
Numeric tolerance around screen bounds. |
A list with AOI-level summary, overall summary, and settings.
aoi <- data.frame( aoi = c("left", "right"), x_min = c(100, 1200), x_max = c(500, 1700), y_min = c(100, 100), y_max = c(400, 400) ) audit_gazepoint_aoi_screen_coverage(aoi, 1920, 1080, aoi_col = "aoi")aoi <- data.frame( aoi = c("left", "right"), x_min = c(100, 1200), x_max = c(500, 1700), y_min = c(100, 100), y_max = c(400, 400) ) audit_gazepoint_aoi_screen_coverage(aoi, 1920, 1080, aoi_col = "aoi")
Audit AOI-window sample denominators before confirmatory binomial or
logistic mixed-effects modelling. The function is designed for output from
summarise_gazepoint_aoi_windows().
audit_gazepoint_aoi_window_denominators( data, window_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", denominator_col = "n_valid_denominator_samples", total_col = "n_window_samples", target_col = "n_target_samples", condition_col = "condition", group_cols = NULL, min_denominator_samples = 5, min_valid_denominator_prop = 0.7, max_denominator_cv = 0.25, max_condition_ratio = 2 )audit_gazepoint_aoi_window_denominators( data, window_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", denominator_col = "n_valid_denominator_samples", total_col = "n_window_samples", target_col = "n_target_samples", condition_col = "condition", group_cols = NULL, min_denominator_samples = 5, min_valid_denominator_prop = 0.7, max_denominator_cv = 0.25, max_condition_ratio = 2 )
data |
AOI-window summary data. |
window_col |
Name of the AOI-window label column. |
window_start_col |
Optional window-start column. |
window_end_col |
Optional window-end column. |
denominator_col |
Name of the denominator column to audit. |
total_col |
Name of the total window-sample column. |
target_col |
Name of the target-success count column. |
condition_col |
Optional condition column. |
group_cols |
Optional grouping columns for row-level audit context. |
min_denominator_samples |
Minimum acceptable denominator count. |
min_valid_denominator_prop |
Minimum acceptable valid-denominator proportion relative to total window samples. |
max_denominator_cv |
Maximum acceptable denominator coefficient of variation within each window. |
max_condition_ratio |
Maximum acceptable ratio between the largest and smallest mean denominator across conditions within a window. |
A named list containing overview, row audit, window summary, condition-window summary, denominator-imbalance summary, flagged rows, and settings.
Summarises how much of the retained pupil signal depends on model-based reconstruction, where reconstruction was blocked, whether reconstruction is uneven across declared groups, and how much reconstruction shifts a simple available-eye combined signal.
audit_gazepoint_binocular_reconstruction( data, by = NULL, prefix = "gp3_binocular", max_reconstruction_prop = NULL, max_group_rate_difference = NULL )audit_gazepoint_binocular_reconstruction( data, by = NULL, prefix = "gp3_binocular", max_reconstruction_prop = NULL, max_group_rate_difference = NULL )
data |
Output from |
by |
Optional condition, participant, stimulus, trial, or other columns used to assess reconstruction-rate imbalance. |
prefix |
Reconstruction prefix. |
max_reconstruction_prop |
Optional descriptive threshold above which
overall reconstruction burden is flagged for review. |
max_group_rate_difference |
Optional descriptive threshold for the
maximum minus minimum reconstruction fraction across |
Thresholds are governance flags, not statistical tests and not universal validity cutoffs.
A gp3_binocular_audit object with overall burden, grouped burden,
status counts, model diagnostics, and audit status.
analyse_gazepoint_binocular_sensitivity(),
summarise_gazepoint_binocular_reporting()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 23) dat$pupil_left[35:38] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 ) audit_gazepoint_binocular_reconstruction(rec, by = "condition")dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 23) dat$pupil_left[35:38] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 ) audit_gazepoint_binocular_reconstruction(rec, by = "condition")
Create a publication-level audit of whether gaze, pupil, retention, or other quality metrics differ across experimental conditions.
audit_gazepoint_condition_quality_imbalance( data, condition_col = "condition", quality_cols = NULL, subject_col = NULL, min_units_per_condition = 1L, max_mean_difference = 0.1, max_condition_ratio = 2, lower_is_better = c("missing_gaze_prop", "offscreen_prop", "excluded_prop", "failure_prop", "artifact_prop") )audit_gazepoint_condition_quality_imbalance( data, condition_col = "condition", quality_cols = NULL, subject_col = NULL, min_units_per_condition = 1L, max_mean_difference = 0.1, max_condition_ratio = 2, lower_is_better = c("missing_gaze_prop", "offscreen_prop", "excluded_prop", "failure_prop", "artifact_prop") )
data |
A data frame containing condition-level, unit-level, or subject-condition-level quality metrics. |
condition_col |
Condition column. |
quality_cols |
Numeric quality-metric columns. If |
subject_col |
Optional subject column. |
min_units_per_condition |
Minimum number of rows/units expected per condition. |
max_mean_difference |
Maximum acceptable absolute difference between condition means for each quality metric. |
max_condition_ratio |
Maximum acceptable ratio between the largest and smallest non-zero condition mean for each quality metric. |
lower_is_better |
Optional character vector naming metrics where lower values indicate better quality, such as missing-gaze or exclusion metrics. |
A list with class gp3_condition_quality_imbalance_audit
containing overview, condition_summary, metric_summary, flagged_metrics,
and settings tables.
Create a publication-level audit of observed design balance across subjects, conditions, and optional stimulus/trial identifiers.
audit_gazepoint_design_balance( data, subject_col = "subject", condition_col = "condition", unit_cols = c("media_id", "trial_global"), expected_conditions = NULL, min_units_per_condition = 1L, max_condition_ratio = 2, require_all_conditions_per_subject = TRUE )audit_gazepoint_design_balance( data, subject_col = "subject", condition_col = "condition", unit_cols = c("media_id", "trial_global"), expected_conditions = NULL, min_units_per_condition = 1L, max_condition_ratio = 2, require_all_conditions_per_subject = TRUE )
data |
A data frame containing trial-level, window-level, or sample-level Gazepoint-derived data. |
subject_col |
Subject/participant identifier column. |
condition_col |
Experimental condition column. |
unit_cols |
Optional columns defining the repeated unit to count within each subject and condition, such as media, trial, block, or window. |
expected_conditions |
Optional character vector of expected condition labels. |
min_units_per_condition |
Minimum number of observed units expected per subject-condition cell. |
max_condition_ratio |
Maximum allowed ratio between a subject's largest and smallest non-zero condition counts. |
require_all_conditions_per_subject |
Logical. If |
A list with class gp3_design_balance_audit containing overview,
subject_summary, condition_summary, cell_summary, imbalance_summary,
flagged_cells, and settings tables.
Summarise whether gaze samples could be matched to dynamic AOI definitions, how large the definition-time gaps were, and how often samples fell inside versus outside defined AOIs.
audit_gazepoint_dynamic_aoi_coverage( data, label_col = "aoi_current", definition_time_col = "aoi_definition_time", time_gap_col = "aoi_time_gap", group_cols = NULL, outside_label = "outside", max_time_gap = Inf, x_col = NULL, y_col = NULL )audit_gazepoint_dynamic_aoi_coverage( data, label_col = "aoi_current", definition_time_col = "aoi_definition_time", time_gap_col = "aoi_time_gap", group_cols = NULL, outside_label = "outside", max_time_gap = Inf, x_col = NULL, y_col = NULL )
data |
Output from |
label_col |
AOI-label column. |
definition_time_col |
Matched-definition timestamp column. |
time_gap_col |
Definition-time-gap column. |
group_cols |
Optional summary grouping columns. |
outside_label |
Outside-AOI label. |
max_time_gap |
Optional audit threshold for definition-time gaps. |
x_col, y_col
|
Optional coordinate columns used to flag missing gaze. |
An object of class "gp3_dynamic_aoi_coverage_audit" containing
overview, group, AOI, and flagged-row tables plus settings.
Create a publication-level audit of event timing, trial timing, and event availability in a Gazepoint master table or sample-level export.
audit_gazepoint_event_sync( data, time_col = "time", event_col = NULL, group_cols = c("subject", "media_id", "trial_global"), condition_col = NULL, expected_event_labels = NULL, onset_event_label = NULL, response_event_label = NULL, min_samples_per_unit = 1L, max_time_gap_ms = NULL )audit_gazepoint_event_sync( data, time_col = "time", event_col = NULL, group_cols = c("subject", "media_id", "trial_global"), condition_col = NULL, expected_event_labels = NULL, onset_event_label = NULL, response_event_label = NULL, min_samples_per_unit = 1L, max_time_gap_ms = NULL )
data |
A data frame containing sample-level Gazepoint data. |
time_col |
Name of the time column. |
event_col |
Optional event-label column. If |
group_cols |
Columns defining a trial or recording unit. |
condition_col |
Optional condition column. |
expected_event_labels |
Optional character vector of expected event labels. |
onset_event_label |
Optional event label identifying trial/stimulus onset. |
response_event_label |
Optional event label identifying response events. |
min_samples_per_unit |
Minimum number of samples expected per unit. |
max_time_gap_ms |
Optional maximum allowed within-unit time gap in milliseconds. |
A list with class gp3_event_sync_audit containing overview,
unit_summary, event_summary, expected_event_summary, flagged_units, and
settings tables.
Create a publication-level audit of retained and excluded analysis units.
audit_gazepoint_exclusion_flow( data, subject_col = "subject", condition_col = NULL, unit_cols = c("media_id", "trial_global"), include_col = NULL, exclude_col = NULL, status_col = NULL, reason_col = NULL, included_values = c("included", "include", "kept", "keep", "retained", "ok", "ready", "complete", "completed"), excluded_values = c("excluded", "exclude", "drop", "dropped", "removed", "fail", "failed", "not_ready", "review", "invalid"), min_retained_prop = 0.7, max_condition_exclusion_ratio = 2 )audit_gazepoint_exclusion_flow( data, subject_col = "subject", condition_col = NULL, unit_cols = c("media_id", "trial_global"), include_col = NULL, exclude_col = NULL, status_col = NULL, reason_col = NULL, included_values = c("included", "include", "kept", "keep", "retained", "ok", "ready", "complete", "completed"), excluded_values = c("excluded", "exclude", "drop", "dropped", "removed", "fail", "failed", "not_ready", "review", "invalid"), min_retained_prop = 0.7, max_condition_exclusion_ratio = 2 )
data |
A data frame containing row-, trial-, window-, or unit-level data. |
subject_col |
Subject/participant identifier column. |
condition_col |
Optional condition column. |
unit_cols |
Optional columns defining the analysis unit, such as media, trial, block, or window. |
include_col |
Optional logical/numeric/character column indicating rows or units retained for analysis. |
exclude_col |
Optional logical/numeric/character column indicating rows or units excluded from analysis. |
status_col |
Optional status column used to infer inclusion or exclusion. |
reason_col |
Optional exclusion-reason column. |
included_values |
Character values in |
excluded_values |
Character values in |
min_retained_prop |
Minimum acceptable retained-unit proportion. |
max_condition_exclusion_ratio |
Maximum allowed ratio between condition exclusion proportions. |
A list with class gp3_exclusion_flow_audit containing overview,
unit_flow, reason_summary, condition_summary, subject_summary,
flagged_units, and settings tables.
Audits the quality of standardised external facial-behaviour data imported
with read_gazepoint_face_export() and standardised with
standardize_gazepoint_face_columns(). The helper checks face-detection
validity, confidence, success, duplicate frame indices, and basic timing
continuity. It does not infer facial expressions or emotional states.
audit_gazepoint_face_quality( data, group_cols = c("participant_id", "face_file"), confidence_threshold = 0.8, min_valid_percent = 70, warning_valid_percent = 85, max_time_gap_sec = NULL, max_duplicate_frame_percent = 1, standardize = TRUE )audit_gazepoint_face_quality( data, group_cols = c("participant_id", "face_file"), confidence_threshold = 0.8, min_valid_percent = 70, warning_valid_percent = 85, max_time_gap_sec = NULL, max_duplicate_frame_percent = 1, standardize = TRUE )
data |
A data frame returned by |
group_cols |
Character vector of grouping columns for quality summaries.
Columns not present in |
confidence_threshold |
Minimum face-detection confidence used when standardising unstandardised data. |
min_valid_percent |
Minimum valid-row percentage below which a group is
marked as |
warning_valid_percent |
Valid-row percentage below which a group is
marked as |
max_time_gap_sec |
Optional maximum allowed time gap in seconds. If
supplied, groups with larger observed positive gaps are marked as |
max_duplicate_frame_percent |
Maximum tolerated percentage of duplicate
non-missing frame indices before a group is marked as |
standardize |
Should unstandardised data be passed through
|
A list with overview, group_summary, issue_summary, data, and
settings. The returned object has class gp3_face_quality_audit.
face <- data.frame( frame = 1:3, timestamp = c(0, 0.033, 0.066), confidence = c(0.95, 0.90, 0.40), success = c(1, 1, 1), AU12_r = c(0.1, 0.2, 0.3) ) audit_gazepoint_face_quality(face)face <- data.frame( frame = 1:3, timestamp = c(0, 0.033, 0.066), confidence = c(0.95, 0.90, 0.40), success = c(1, 1, 1), AU12_r = c(0.1, 0.2, 0.3) ) audit_gazepoint_face_quality(face)
Summarises the output of sync_gazepoint_face_data() by reporting matched,
unmatched, outside-tolerance, and missing-timing/frame rows. For nearest-time
synchronisation, it also reports absolute time-difference summaries. The
helper audits alignment quality only; it does not infer facial expressions or
emotional states.
audit_gazepoint_face_sync( data, group_cols = NULL, min_matched_percent = 70, warning_matched_percent = 85, max_abs_diff_sec = NULL )audit_gazepoint_face_sync( data, group_cols = NULL, min_matched_percent = 70, warning_matched_percent = 85, max_abs_diff_sec = NULL )
data |
A data frame returned by |
group_cols |
Optional character vector of grouping columns. Columns not
present in |
min_matched_percent |
Minimum percentage of rows that must have
|
warning_matched_percent |
Percentage below which a group is marked as
|
max_abs_diff_sec |
Optional maximum allowed absolute synchronisation
difference in seconds. Only evaluated when |
A list with overview, group_summary, issue_summary, data, and
settings. The returned object has class gp3_face_sync_audit.
gaze <- data.frame( subject_id = "P001", time_sec = c(0.00, 0.03, 0.07) ) face <- data.frame( participant_id = "P001", frame = 1:3, timestamp = c(0.00, 0.033, 0.066), confidence = c(0.95, 0.94, 0.93), success = c(1, 1, 1) ) synced <- sync_gazepoint_face_data( gaze, face, by = c(subject_id = "participant_id"), gaze_time_col = "time_sec" ) audit_gazepoint_face_sync(synced)gaze <- data.frame( subject_id = "P001", time_sec = c(0.00, 0.03, 0.07) ) face <- data.frame( participant_id = "P001", frame = 1:3, timestamp = c(0.00, 0.033, 0.066), confidence = c(0.95, 0.94, 0.93), success = c(1, 1, 1) ) synced <- sync_gazepoint_face_data( gaze, face, by = c(subject_id = "participant_id"), gaze_time_col = "time_sec" ) audit_gazepoint_face_sync(synced)
Computes odd-even or random split-half reliability for common fixation and AOI-derived metrics. The audit returns the split-half correlation and the Spearman-Brown corrected reliability estimate.
audit_gazepoint_fixation_reliability( data, subject_col, trial_col, metric = c("fixation_count", "mean_fixation_duration", "total_fixation_duration", "aoi_dwell_prop", "transition_count", "entropy_score"), duration_col = NULL, aoi_col = NULL, target_aoi = NULL, time_col = NULL, group_cols = NULL, min_trials = 4, split_method = c("odd_even", "random"), seed = NULL, correlation_method = c("pearson", "spearman") )audit_gazepoint_fixation_reliability( data, subject_col, trial_col, metric = c("fixation_count", "mean_fixation_duration", "total_fixation_duration", "aoi_dwell_prop", "transition_count", "entropy_score"), duration_col = NULL, aoi_col = NULL, target_aoi = NULL, time_col = NULL, group_cols = NULL, min_trials = 4, split_method = c("odd_even", "random"), seed = NULL, correlation_method = c("pearson", "spearman") )
data |
A fixation-level or AOI-event-level data frame. |
subject_col |
Character scalar. Subject identifier column. |
trial_col |
Character scalar. Trial identifier column. |
metric |
Metric to audit. Supported values are |
duration_col |
Optional duration column. Required for duration metrics.
Optional for |
aoi_col |
Optional AOI column. Required for AOI, transition, and entropy metrics. |
target_aoi |
Optional AOI label required when |
time_col |
Optional time column used to order AOI sequences. |
group_cols |
Optional grouping columns. Reliability is computed separately within each group. |
min_trials |
Minimum number of trials per subject required for inclusion. |
split_method |
|
seed |
Optional random seed used when |
correlation_method |
Correlation method passed to |
A data frame containing split-half reliability diagnostics.
dat <- expand.grid( subject = paste0("S", 1:6), trial = paste0("T", 1:4), KEEP.OUT.ATTRS = FALSE ) dat$duration <- rep(seq_len(6), each = 4) + rep(c(0, 0.1, 0, 0.1), 6) audit_gazepoint_fixation_reliability( dat, subject_col = "subject", trial_col = "trial", metric = "total_fixation_duration", duration_col = "duration" )dat <- expand.grid( subject = paste0("S", 1:6), trial = paste0("T", 1:4), KEEP.OUT.ATTRS = FALSE ) dat$duration <- rep(seq_len(6), each = 4) + rep(c(0, 0.1, 0, 0.1), 6) audit_gazepoint_fixation_reliability( dat, subject_col = "subject", trial_col = "trial", metric = "total_fixation_duration", duration_col = "duration" )
Create a publication-level audit of gaze coordinate availability, validity, off-screen samples, and optional pupil availability.
audit_gazepoint_gaze_signal_quality( data, subject_col = "subject", condition_col = NULL, group_cols = c("subject", "media_id", "trial_global"), x_col = NULL, y_col = NULL, validity_cols = NULL, pupil_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), min_gaze_valid_prop = 0.7, max_missing_gaze_prop = 0.3, max_offscreen_prop = 0.3, min_pupil_valid_prop = 0.7 )audit_gazepoint_gaze_signal_quality( data, subject_col = "subject", condition_col = NULL, group_cols = c("subject", "media_id", "trial_global"), x_col = NULL, y_col = NULL, validity_cols = NULL, pupil_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), min_gaze_valid_prop = 0.7, max_missing_gaze_prop = 0.3, max_offscreen_prop = 0.3, min_pupil_valid_prop = 0.7 )
data |
A sample-level Gazepoint data frame. |
subject_col |
Subject/participant identifier column. |
condition_col |
Optional condition column. |
group_cols |
Columns defining a recording, stimulus, trial, or analysis unit. |
x_col |
Optional gaze-x coordinate column. If |
y_col |
Optional gaze-y coordinate column. If |
validity_cols |
Optional gaze-validity columns. If |
pupil_col |
Optional pupil column. If |
screen_x_range |
Numeric length-2 vector defining plausible on-screen x range. |
screen_y_range |
Numeric length-2 vector defining plausible on-screen y range. |
min_gaze_valid_prop |
Minimum acceptable gaze-validity proportion. |
max_missing_gaze_prop |
Maximum acceptable missing-gaze proportion. |
max_offscreen_prop |
Maximum acceptable off-screen proportion. |
min_pupil_valid_prop |
Minimum acceptable valid-pupil proportion when a pupil column is available. |
A list with class gp3_gaze_signal_quality_audit containing
overview, unit_summary, subject_summary, condition_summary,
signal_issue_summary, flagged_units, and settings tables.
Creates compact quality-audit tables from a master sample-level table created
by as_gazepoint_master() or create_gazepoint_master(). The audit
summarises missing gaze, missing pupil, off-screen gaze, AOI states, pupil
availability, coordinate ranges, and subject/media-level quality.
audit_gazepoint_master(master)audit_gazepoint_master(master)
master |
A master sample-level table created by |
A named list of tibbles:
One-row overview of the master table.
Quality summary by participant/source.
Quality summary by media/stimulus.
Quality summary by participant/source and media/stimulus.
Counts and percentages of AOI states.
Pupil summary by participant/source and media/stimulus.
Coordinate range and off-screen summary.
## Not run: results <- run_gazepoint_workflow( export_dir = "C:/Users/YourName/Desktop/gp3_test_exports", output_dir = "C:/Users/YourName/Desktop/gp3_outputs" ) master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) audit <- audit_gazepoint_master(master) audit$overview audit$by_subject audit$aoi_states ## End(Not run)## Not run: results <- run_gazepoint_workflow( export_dir = "C:/Users/YourName/Desktop/gp3_test_exports", output_dir = "C:/Users/YourName/Desktop/gp3_outputs" ) master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) audit <- audit_gazepoint_master(master) audit$overview audit$by_subject audit$aoi_states ## End(Not run)
Audit British and American summary-function spellings
audit_gazepoint_naming_consistency(exports = NULL)audit_gazepoint_naming_consistency(exports = NULL)
exports |
Optional character vector of exported function names. When
|
A "gazepoint_naming_audit" object containing paired names and an
overall status.
Create a publication-level audit of whether the retained analysis sample remains balanced across subjects and experimental conditions after exclusions.
audit_gazepoint_post_exclusion_balance( data, subject_col = "subject", condition_col = "condition", unit_cols = c("media_id", "trial_global"), retained_col = NULL, include_col = NULL, exclude_col = NULL, status_col = NULL, expected_conditions = NULL, included_values = c("included", "include", "kept", "keep", "retained", "ok", "ready", "complete", "completed"), excluded_values = c("excluded", "exclude", "drop", "dropped", "removed", "fail", "failed", "not_ready", "review", "invalid"), min_retained_units_per_condition = 1L, min_retained_units_per_subject_condition = 1L, max_condition_count_ratio = 2, max_subject_condition_ratio = 2, require_all_conditions_per_subject = TRUE )audit_gazepoint_post_exclusion_balance( data, subject_col = "subject", condition_col = "condition", unit_cols = c("media_id", "trial_global"), retained_col = NULL, include_col = NULL, exclude_col = NULL, status_col = NULL, expected_conditions = NULL, included_values = c("included", "include", "kept", "keep", "retained", "ok", "ready", "complete", "completed"), excluded_values = c("excluded", "exclude", "drop", "dropped", "removed", "fail", "failed", "not_ready", "review", "invalid"), min_retained_units_per_condition = 1L, min_retained_units_per_subject_condition = 1L, max_condition_count_ratio = 2, max_subject_condition_ratio = 2, require_all_conditions_per_subject = TRUE )
data |
A data frame containing row-, sample-, trial-, or unit-level data. |
subject_col |
Subject/participant identifier column. |
condition_col |
Experimental condition column. |
unit_cols |
Optional columns defining the analysis unit, such as media, trial, block, or window. |
retained_col |
Optional logical/numeric/character column indicating retained units. |
include_col |
Optional logical/numeric/character inclusion column. |
exclude_col |
Optional logical/numeric/character exclusion column. |
status_col |
Optional status column used to infer retained/excluded units. |
expected_conditions |
Optional character vector of expected conditions. |
included_values |
Character values in |
excluded_values |
Character values in |
min_retained_units_per_condition |
Minimum retained units required per condition. |
min_retained_units_per_subject_condition |
Minimum retained units required per subject-condition cell. |
max_condition_count_ratio |
Maximum allowed ratio between condition-level retained counts. |
max_subject_condition_ratio |
Maximum allowed within-subject retained condition-count ratio. |
require_all_conditions_per_subject |
Logical. If |
A list with class gp3_post_exclusion_balance_audit containing
overview, unit_flow, cell_summary, condition_summary, subject_summary,
flagged_cells, flagged_subjects, and settings tables.
Summarise baseline quality after baseline_correct_gazepoint_pupil().
audit_gazepoint_pupil_baseline( data, group_cols = c("subject", "media_id"), time_col = "time", pupil_col = "pupil_interpolated", baseline_n_col = "pupil_baseline_n", baseline_status_col = "pupil_baseline_status", baseline_available_col = "pupil_baseline_available", baseline_used_col = "pupil_baseline_used", baseline_window_start_col = "pupil_baseline_window_start", baseline_window_end_col = "pupil_baseline_window_end", baseline_flag_col = NULL, interpolated_col = "pupil_was_interpolated", artifact_col = NULL, artifact_reason_col = NULL, min_baseline_samples = 1, max_missing_pct = 50, max_interpolated_pct = 50, max_artifact_pct = 50 )audit_gazepoint_pupil_baseline( data, group_cols = c("subject", "media_id"), time_col = "time", pupil_col = "pupil_interpolated", baseline_n_col = "pupil_baseline_n", baseline_status_col = "pupil_baseline_status", baseline_available_col = "pupil_baseline_available", baseline_used_col = "pupil_baseline_used", baseline_window_start_col = "pupil_baseline_window_start", baseline_window_end_col = "pupil_baseline_window_end", baseline_flag_col = NULL, interpolated_col = "pupil_was_interpolated", artifact_col = NULL, artifact_reason_col = NULL, min_baseline_samples = 1, max_missing_pct = 50, max_interpolated_pct = 50, max_artifact_pct = 50 )
data |
A data frame returned by |
group_cols |
Character vector of grouping columns. Use |
time_col |
Name of the time column. |
pupil_col |
Name of the pupil column used to evaluate missingness. |
baseline_n_col |
Name of the baseline valid-sample count column. |
baseline_status_col |
Name of the baseline-status column. |
baseline_available_col |
Name of the baseline-availability column. |
baseline_used_col |
Name of the logical column indicating whether a row used a baseline value. |
baseline_window_start_col |
Name of the baseline-window start column. |
baseline_window_end_col |
Name of the baseline-window end column. |
baseline_flag_col |
Optional logical column identifying baseline rows.
If |
interpolated_col |
Name of the logical interpolation flag column. |
artifact_col |
Optional artifact flag column. If |
artifact_reason_col |
Optional artifact-reason column. If |
min_baseline_samples |
Minimum acceptable number of valid baseline samples before a group is flagged as low quality. |
max_missing_pct |
Maximum acceptable percentage of missing baseline samples. |
max_interpolated_pct |
Maximum acceptable percentage of interpolated baseline samples. |
max_artifact_pct |
Maximum acceptable percentage of artifact-flagged baseline samples. |
The function reports baseline-row counts, valid/missing baseline samples, interpolated baseline samples, artifact-flagged baseline samples, no-baseline cases, and low-quality baseline flags by subject, media, trial, condition, or any selected grouping variables.
A tibble with one row per group.
Summarise tonic pupil/time-on-task drift in processed Gazepoint pupil data.
audit_gazepoint_pupil_drift( data, group_cols = "subject", pupil_col = NULL, time_col = "time", order_col = "trial", condition_col = "condition", exclude_col = "excluded_trial", include_excluded = FALSE, min_valid_samples = 3, max_abs_slope_per_min = 1, max_condition_time_mean_diff_ms = 1000, max_condition_order_mean_diff = 1 )audit_gazepoint_pupil_drift( data, group_cols = "subject", pupil_col = NULL, time_col = "time", order_col = "trial", condition_col = "condition", exclude_col = "excluded_trial", include_excluded = FALSE, min_valid_samples = 3, max_abs_slope_per_min = 1, max_condition_time_mean_diff_ms = 1000, max_condition_order_mean_diff = 1 )
data |
A data frame from a Gazepoint pupil preprocessing pipeline. |
group_cols |
Character vector of grouping columns for the main drift
audit. The default is |
pupil_col |
Name of the pupil column to analyse. If |
time_col |
Name of the within-trial or sample-time column. |
order_col |
Optional trial/order column used to assess time-on-task
imbalance. If |
condition_col |
Optional condition column used to summarise condition
drift and time-on-task imbalance. If |
exclude_col |
Optional logical exclusion column. If present and
|
include_excluded |
Logical. If |
min_valid_samples |
Minimum valid pupil samples required to estimate a drift slope. |
max_abs_slope_per_min |
Maximum acceptable absolute pupil slope per minute before a drift warning is raised. |
max_condition_time_mean_diff_ms |
Maximum acceptable difference in mean sample time across conditions. |
max_condition_order_mean_diff |
Maximum acceptable difference in mean trial/order value across conditions. |
The function estimates simple linear pupil trends over time within selected grouping variables, usually subjects. It also reports subject-level drift, condition-level drift, and possible condition imbalance in time-on-task.
A named list containing by_group, by_subject, by_condition,
condition_balance, and summary tibbles.
Summarise observed, interpolated, and remaining missing pupil samples, together with gap-level counts and gap duration/sample-size summaries.
audit_gazepoint_pupil_gaps( data, group_cols = c("subject", "media_id"), status_col = "pupil_interpolation_status", gap_id_col = "pupil_gap_id", gap_n_samples_col = "pupil_gap_n_samples", gap_duration_col = "pupil_gap_duration_ms", interpolated_col = "pupil_was_interpolated", pupil_col = "pupil_interpolated" )audit_gazepoint_pupil_gaps( data, group_cols = c("subject", "media_id"), status_col = "pupil_interpolation_status", gap_id_col = "pupil_gap_id", gap_n_samples_col = "pupil_gap_n_samples", gap_duration_col = "pupil_gap_duration_ms", interpolated_col = "pupil_was_interpolated", pupil_col = "pupil_interpolated" )
data |
A data frame containing pupil interpolation status columns. |
group_cols |
Character vector of grouping columns. Use |
status_col |
Name of the interpolation status column. |
gap_id_col |
Name of the gap identifier column. |
gap_n_samples_col |
Name of the column containing gap size in samples. |
gap_duration_col |
Name of the column containing gap duration in ms. |
interpolated_col |
Name of the logical column indicating whether a sample was interpolated. |
pupil_col |
Name of the pupil column after interpolation. |
This function is intended for data returned by
interpolate_gazepoint_pupil(), but it can also be used with any table
that contains compatible interpolation-status and gap columns.
A tibble with one row per group, or one row overall when
group_cols = character(0).
Check whether pupil preprocessing loss differs across experimental conditions or other grouping variables.
audit_gazepoint_pupil_imbalance( data, group_cols = "condition", pupil_col = "pupil_interpolated", interpolated_col = "pupil_was_interpolated", interpolation_status_col = "pupil_interpolation_status", artifact_col = NULL, artifact_reason_col = NULL, min_group_n = 1, max_valid_pct_diff = 10, max_artifact_pct_diff = 10, max_missing_pct_diff = 10, max_interpolated_pct_diff = 10 )audit_gazepoint_pupil_imbalance( data, group_cols = "condition", pupil_col = "pupil_interpolated", interpolated_col = "pupil_was_interpolated", interpolation_status_col = "pupil_interpolation_status", artifact_col = NULL, artifact_reason_col = NULL, min_group_n = 1, max_valid_pct_diff = 10, max_artifact_pct_diff = 10, max_missing_pct_diff = 10, max_interpolated_pct_diff = 10 )
data |
A data frame from a pupil preprocessing pipeline. |
group_cols |
Character vector of grouping columns. By default,
summaries are produced by |
pupil_col |
Name of the post-preprocessing pupil column used to define remaining valid and missing samples. |
interpolated_col |
Name of the logical interpolation flag column. |
interpolation_status_col |
Name of the interpolation-status column. |
artifact_col |
Optional artifact flag column. If |
artifact_reason_col |
Optional artifact-reason column. If |
min_group_n |
Minimum group size below which a group is flagged. |
max_valid_pct_diff |
Maximum acceptable range in valid-sample percentage across groups. |
max_artifact_pct_diff |
Maximum acceptable range in artifact percentage across groups. |
max_missing_pct_diff |
Maximum acceptable range in remaining-missing percentage across groups. |
max_interpolated_pct_diff |
Maximum acceptable range in interpolated percentage across groups. |
The function summarises valid pupil samples, interpolated samples, artifact-flagged samples, and remaining missing samples. It also adds simple imbalance flags based on differences between groups.
A tibble with one row per group and imbalance-warning columns.
Check whether event-related pupil-response windows may overlap.
audit_gazepoint_pupil_overlap_risk( data, group_cols = "subject", trial_col = "trial_global", time_col = "time", event_time_cols = c("stimulus_onset_time", "target_onset_time", "response_time"), window_start_ms = 0, window_end_ms = 2000, min_event_gap_ms = 1000, exclude_col = "excluded_trial", include_excluded = FALSE )audit_gazepoint_pupil_overlap_risk( data, group_cols = "subject", trial_col = "trial_global", time_col = "time", event_time_cols = c("stimulus_onset_time", "target_onset_time", "response_time"), window_start_ms = 0, window_end_ms = 2000, min_event_gap_ms = 1000, exclude_col = "excluded_trial", include_excluded = FALSE )
data |
A Gazepoint sample-level data frame. |
group_cols |
Character vector of grouping columns, usually |
trial_col |
Name of the trial identifier column. |
time_col |
Name of the within-trial time column. |
event_time_cols |
Character vector of event-time columns, in ms. |
window_start_ms |
Response-window start relative to each event, in ms. |
window_end_ms |
Response-window end relative to each event, in ms. |
min_event_gap_ms |
Minimum acceptable event-to-event gap in ms. |
exclude_col |
Optional logical exclusion column. |
include_excluded |
Logical. If |
This function is designed as a deconvolution/readiness gate. It checks
whether events within the same trial are too close together and whether
their response windows overlap. If no usable event-time values are found,
the function returns a clean audit with overlap_assessment_status = "no_usable_event_times".
A named list containing events, event_gaps, by_trial, and
summary tibbles.
Create a split-half reliability audit for trial-level or window-level pupil outcomes. The helper is intended for publication-readiness checks when pupil features are interpreted as stable participant-level outcomes or individual difference measures.
audit_gazepoint_pupil_reliability( data, outcome_cols = NULL, participant_col = NULL, trial_col = NULL, split_col = NULL, by_cols = NULL, split_method = c("odd_even", "first_second"), aggregate_function = c("mean", "median"), correlation_method = c("pearson", "spearman"), min_trials_per_split = 2, name = "gazepoint_pupil_reliability" )audit_gazepoint_pupil_reliability( data, outcome_cols = NULL, participant_col = NULL, trial_col = NULL, split_col = NULL, by_cols = NULL, split_method = c("odd_even", "first_second"), aggregate_function = c("mean", "median"), correlation_method = c("pearson", "spearman"), min_trials_per_split = 2, name = "gazepoint_pupil_reliability" )
data |
A data frame containing trial-level or window-level pupil outcomes. |
outcome_cols |
Character vector of pupil outcome columns. If |
participant_col |
Participant/subject column. If |
trial_col |
Trial/order column. If |
split_col |
Optional pre-existing split column. If supplied, it must have exactly two non-missing levels. |
by_cols |
Optional grouping columns for separate reliability audits, such
as |
split_method |
Split method used when |
aggregate_function |
Function used to aggregate trial-level values within
participant and split. Options are |
correlation_method |
Correlation method for split-half association.
Options are |
min_trials_per_split |
Minimum number of non-missing outcome values required in each split for a participant to contribute to the reliability estimate. |
name |
Character label stored in the audit object. |
A list with class gp3_pupil_reliability_audit.
Checks whether gaze coordinates are missing, equal to (0, 0), or outside
the expected screen/stimulus bounds. The helper is intended for transparent
quality-control reporting, not for automatic exclusion decisions.
audit_gazepoint_screen_bounds( data, x_col, y_col, screen_width, screen_height, group_cols = NULL, margin = 0, treat_zero_zero_as_out_of_bounds = TRUE )audit_gazepoint_screen_bounds( data, x_col, y_col, screen_width, screen_height, group_cols = NULL, margin = 0, treat_zero_zero_as_out_of_bounds = TRUE )
data |
A data frame. |
x_col, y_col
|
Character names of gaze-coordinate columns. |
screen_width, screen_height
|
Numeric screen or stimulus dimensions. |
group_cols |
Optional grouping columns for group-level summaries. |
margin |
Numeric tolerance around the screen bounds. A positive value allows coordinates slightly outside the nominal screen area. |
treat_zero_zero_as_out_of_bounds |
If |
A list with row-level flags, group-level summary, overall summary, and settings.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) audit_gazepoint_screen_bounds(x, "gaze_x", "gaze_y", 1920, 1080)x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) audit_gazepoint_screen_bounds(x, "gaze_x", "gaze_y", 1920, 1080)
Compute stimulus-level luminance, brightness, and contrast summaries for image stimuli used in Gazepoint eye-tracking and pupillometry studies. This helper is intended as a publication-readiness audit because pupil size is strongly affected by stimulus brightness.
audit_gazepoint_stimulus_luminance( data, stimulus_file_col = NULL, stimulus_id_col = NULL, condition_col = NULL, image_dir = NULL, recursive = TRUE, name = "gazepoint_stimulus_luminance" )audit_gazepoint_stimulus_luminance( data, stimulus_file_col = NULL, stimulus_id_col = NULL, condition_col = NULL, image_dir = NULL, recursive = TRUE, name = "gazepoint_stimulus_luminance" )
data |
A data frame containing at least a stimulus image/file column. |
stimulus_file_col |
Name of the stimulus image/file column. If |
stimulus_id_col |
Optional stimulus identifier column. If |
condition_col |
Optional experimental condition column. If |
image_dir |
Optional directory prepended to relative stimulus paths. |
recursive |
If |
name |
Character label stored in the audit object. |
A list with class gp3_stimulus_luminance_audit.
Check whether a prepared or raw long-format time-course data set has the subject-by-condition-by-time structure expected by the conservative two-condition cluster-permutation workflow.
audit_gazepoint_timecourse_grid( data, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome" )audit_gazepoint_timecourse_grid( data, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome" )
data |
A data frame. |
subject_col |
Subject column. Defaults to the internal prepared column. |
condition_col |
Condition column. Defaults to the internal prepared column. |
time_col |
Time-bin column. Defaults to the internal prepared column. |
outcome_col |
Outcome column. Defaults to the internal prepared column. |
A list containing grid counts, missing cells, duplicate cells, and readiness flags.
Compares a sustained-threshold onset and maximum-slope tangent onset while reporting estimator spread, sampling rate, robust baseline noise, and a latency-resolvability label. This is a QC/reporting diagnostic rather than a claim that any one estimator is universally correct.
audit_gp3_pupil_latency_resolution( time, pupil, event_time = 0, baseline_window = c(-0.5, 0), search_window = c(0, 2), direction = c("constriction", "dilation"), threshold_sigma = 3, sustain_ms = 50 )audit_gp3_pupil_latency_resolution( time, pupil, event_time = 0, baseline_window = c(-0.5, 0), search_window = c(0, 2), direction = c("constriction", "dilation"), threshold_sigma = 3, sustain_ms = 50 )
time |
Numeric sample times in seconds. |
pupil |
Numeric pupil series. |
event_time |
Nominal event time in seconds. |
baseline_window, search_window
|
Two-element windows relative to the event. |
direction |
|
threshold_sigma |
Multiples of robust baseline noise. |
sustain_ms |
Required sustained threshold duration in milliseconds. |
A structured pupil-latency QC record suitable for reports.
Computes baseline-corrected pupil columns from a Gazepoint pupil time series,
typically after flag_gazepoint_pupil() and interpolate_gazepoint_pupil().
Baselines can be defined either by a time window, such as c(-200, 0), or by
a user-supplied logical baseline/pre-stimulus flag column.
baseline_correct_gazepoint_pupil( data, pupil_col = NULL, time_col = NULL, baseline_time_col = NULL, baseline_window = c(-200, 0), baseline_flag_col = NULL, group_cols = c("subject", "media_id"), baseline_method = c("mean", "median"), min_baseline_samples = 1 )baseline_correct_gazepoint_pupil( data, pupil_col = NULL, time_col = NULL, baseline_time_col = NULL, baseline_window = c(-200, 0), baseline_flag_col = NULL, group_cols = c("subject", "media_id"), baseline_method = c("mean", "median"), min_baseline_samples = 1 )
data |
A Gazepoint master table, preferably after
|
pupil_col |
Optional name of the pupil column to baseline-correct. If
|
time_col |
Optional name of the main time column. If |
baseline_time_col |
Optional name of the time column used for selecting
baseline samples. If |
baseline_window |
Numeric vector of length two giving the baseline
window in milliseconds. Defaults to |
baseline_flag_col |
Optional logical column identifying baseline samples.
If supplied, this takes priority over |
group_cols |
Character vector of grouping columns used to compute one
baseline per independent time series. Defaults to |
baseline_method |
Baseline statistic. One of |
min_baseline_samples |
Minimum number of valid baseline samples required
to compute a baseline. Defaults to |
A tibble containing the original data plus baseline-correction columns.
## Not run: flagged <- flag_gazepoint_pupil(master) interpolated <- interpolate_gazepoint_pupil(flagged) corrected <- baseline_correct_gazepoint_pupil( interpolated, baseline_window = c(-200, 0) ) corrected <- baseline_correct_gazepoint_pupil( interpolated, baseline_window = c(0, 200) ) ## End(Not run)## Not run: flagged <- flag_gazepoint_pupil(master) interpolated <- interpolate_gazepoint_pupil(flagged) corrected <- baseline_correct_gazepoint_pupil( interpolated, baseline_window = c(-200, 0) ) corrected <- baseline_correct_gazepoint_pupil( interpolated, baseline_window = c(0, 200) ) ## End(Not run)
Compare standardized fixation intervals from one or more detectors with a manually reviewed or synthetic reference-event table. Matching is one-to-one within each participant/trial sequence and is based on interval intersection-over-union. Results quantify methodological agreement with the supplied reference annotations; they do not establish a universally correct detector.
benchmark_gazepoint_event_detectors( x, reviewed_events, sequence_cols = NULL, reviewed_start_col = "start_time", reviewed_end_col = "end_time", reviewed_id_col = "review_event_id", review_status_col = "review_status", accepted_status = c("accepted", "include", "reviewed", "confirmed"), min_overlap = 0.5, time_unit = c("seconds", "milliseconds") )benchmark_gazepoint_event_detectors( x, reviewed_events, sequence_cols = NULL, reviewed_start_col = "start_time", reviewed_end_col = "end_time", reviewed_id_col = "review_event_id", review_status_col = "review_status", accepted_status = c("accepted", "include", "reviewed", "confirmed"), min_overlap = 0.5, time_unit = c("seconds", "milliseconds") )
x |
An object returned by |
reviewed_events |
A data frame containing reviewed reference intervals. |
sequence_cols |
Sequence identifier columns. When |
reviewed_start_col, reviewed_end_col
|
Start and end columns in
|
reviewed_id_col |
Optional reviewed-event identifier column. |
review_status_col |
Optional review-status column. When present, only
rows whose status is included in |
accepted_status |
Character values treated as accepted reviews. |
min_overlap |
Minimum interval intersection-over-union required for a true-positive match. |
time_unit |
Unit used by event start/end values. This controls conversion of timing errors to milliseconds. |
An object of class "gp3_event_detector_benchmark" containing
detector-level metrics, sequence-level metrics, one-to-one matches,
unmatched-event diagnostics, accepted reviewed events, detector events,
detector-run information, and settings.
reviewed <- data.frame( USER_ID = "P01", trial = "T01", review_event_id = 1:2, start_time = c(0, 2), end_time = c(1, 3) ) detected <- data.frame( USER_ID = "P01", trial = "T01", detector = "velocity_10", family = "velocity", threshold = 10, event_id = 1:2, start_time = c(0.05, 2.05), end_time = c(1.05, 3.05), duration_ms = 1000 ) benchmark <- benchmark_gazepoint_event_detectors( detected, reviewed, sequence_cols = c("USER_ID", "trial") ) benchmark$detector_metricsreviewed <- data.frame( USER_ID = "P01", trial = "T01", review_event_id = 1:2, start_time = c(0, 2), end_time = c(1, 3) ) detected <- data.frame( USER_ID = "P01", trial = "T01", detector = "velocity_10", family = "velocity", threshold = 10, event_id = 1:2, start_time = c(0.05, 2.05), end_time = c(1.05, 3.05), duration_ms = 1000 ) benchmark <- benchmark_gazepoint_event_detectors( detected, reviewed, sequence_cols = c("USER_ID", "trial") ) benchmark$detector_metrics
Generates deterministic Gazepoint-like all-gaze exports and benchmarks
selected package operations across increasing row and file counts. Ordinary
unit tests should use small scales. The script installed under
inst/benchmarks/ runs the large-export profile.
benchmark_gazepoint_export_performance( scales = data.frame(total_rows = c(10000L, 50000L, 200000L), n_files = c(1L, 4L, 8L)), operations = c("generate", "import", "master", "sampling", "quality"), trials = 3L, seed = 20260717L, limits = gp3tools_performance_limits(), stop_on_regression = FALSE, output_dir = NULL, keep_exports = FALSE, on_error = c("record", "stop") )benchmark_gazepoint_export_performance( scales = data.frame(total_rows = c(10000L, 50000L, 200000L), n_files = c(1L, 4L, 8L)), operations = c("generate", "import", "master", "sampling", "quality"), trials = 3L, seed = 20260717L, limits = gp3tools_performance_limits(), stop_on_regression = FALSE, output_dir = NULL, keep_exports = FALSE, on_error = c("record", "stop") )
scales |
Data frame with integer |
operations |
Any of |
trials |
Number of repetitions per scale. |
seed |
Integer random seed. |
limits |
Performance limits returned by
|
stop_on_regression |
Stop when a completed benchmark exceeds a limit. |
output_dir |
Optional directory used for generated exports. |
keep_exports |
Retain generated CSV exports. |
on_error |
Whether operation errors are recorded or stop the benchmark. |
A "gazepoint_performance_benchmark" object containing trial-level
measurements, aggregated summaries, regression checks, settings, and
session metadata.
Evaluate the stability of scanpath clustering by repeatedly subsampling scanpaths, refitting the clustering solution, and recording co-clustering, adjusted Rand agreement, and representative-scanpath selection.
bootstrap_gazepoint_scanpath_clusters( x, k = 3L, n_boot = 200L, sample_fraction = 0.8, method = c("hierarchical", "pam"), linkages = "average", seed = NULL, aoi_col = NULL, group_cols = NULL, time_col = NULL, distance_col = "normalized_distance", include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )bootstrap_gazepoint_scanpath_clusters( x, k = 3L, n_boot = 200L, sample_fraction = 0.8, method = c("hierarchical", "pam"), linkages = "average", seed = NULL, aoi_col = NULL, group_cols = NULL, time_col = NULL, distance_col = "normalized_distance", include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )
x |
Long-format AOI data, pairwise distance data, a square numeric
distance matrix, or a |
k |
Number of clusters. |
n_boot |
Number of subsampling iterations per specification. |
sample_fraction |
Proportion of scanpaths retained in each iteration.
The resolved sample size is always at least |
method |
Clustering method: |
linkages |
Hierarchical linkage methods to compare. Ignored for PAM. |
seed |
Optional integer seed. The caller's random-number state is restored on exit. |
aoi_col |
AOI column when |
group_cols |
Columns identifying independent scanpaths. |
time_col |
Optional ordering column. |
distance_col |
Distance column for pairwise-distance data. |
include_missing |
Should missing AOI labels be retained? |
missing_label |
Label used for retained missing AOIs. |
collapse_repeats |
Should consecutive repeated AOIs be collapsed? |
max_sequences |
Maximum number of scanpaths permitted when pairwise distances must be calculated. |
The routine reuses the distance formats accepted by
cluster_gazepoint_scanpaths(). Hierarchical solutions can be compared
across multiple linkage methods. PAM remains optional through cluster.
An object of class "gp3_scanpath_cluster_bootstrap" containing
full-data reference fits, co-clustering and pair-coverage matrices,
iteration-level adjusted Rand results, representative stability, the
reusable distance object, and resolved settings.
latent <- rep(1:3, each = 2) d <- outer( latent, latent, FUN = function(x, y) ifelse(x == y, 0.1, 1) ) diag(d) <- 0 dimnames(d) <- list(LETTERS[1:6], LETTERS[1:6]) stability <- bootstrap_gazepoint_scanpath_clusters( d, k = 3, n_boot = 10, seed = 1 ) stability$iteration_summarylatent <- rep(1:3, each = 2) d <- outer( latent, latent, FUN = function(x, y) ifelse(x == y, 0.1, 1) ) diag(d) <- 0 dimnames(d) <- list(LETTERS[1:6], LETTERS[1:6]) stability <- bootstrap_gazepoint_scanpath_clusters( d, k = 3, n_boot = 10, seed = 1 ) stability$iteration_summary
Compute simple nonparametric bootstrap confidence intervals for a time-varying gaze or pupil measure. The function is intentionally lightweight and returns a tidy data frame that can be plotted or used as a descriptive robustness check alongside model-based analyses.
bootstrap_gazepoint_timecourse( data, time_col, value_col, group_col = NULL, subject_col = NULL, n_boot = 1000, ci = 0.95, statistic = c("mean", "median"), difference_groups = NULL, seed = NULL )bootstrap_gazepoint_timecourse( data, time_col, value_col, group_col = NULL, subject_col = NULL, n_boot = 1000, ci = 0.95, statistic = c("mean", "median"), difference_groups = NULL, seed = NULL )
data |
A data frame. |
time_col |
Name of the time column. |
value_col |
Name of the numeric outcome column. |
group_col |
Optional grouping column, for example condition. |
subject_col |
Optional subject/participant column. If supplied, bootstrap resampling is performed over subjects within each time and group cell; otherwise rows are resampled. |
n_boot |
Number of bootstrap draws. |
ci |
Confidence level for the interval. |
statistic |
Summary statistic, either |
difference_groups |
Optional character vector of length two. If
supplied with |
seed |
Optional random seed. |
A data frame with time, group/contrast, estimate, lower and upper bootstrap interval limits, sample size, and status columns.
Performs lightweight structural checks before Bayesian, GAMM, HDDM, or other advanced modelling workflows. The function does not fit any model.
check_gazepoint_bayesian_readiness( data, outcome, subject, trial = NULL, time = NULL, condition = NULL, metric_type = "continuous", baseline_window = NULL, min_observations_per_subject = 10, max_missing_trial_prop = 0.2 )check_gazepoint_bayesian_readiness( data, outcome, subject, trial = NULL, time = NULL, condition = NULL, metric_type = "continuous", baseline_window = NULL, min_observations_per_subject = 10, max_missing_trial_prop = 0.2 )
data |
A data frame. |
outcome |
Name of the outcome column. |
subject |
Name of the subject/participant column. |
trial |
Optional trial column. |
time |
Optional time column. |
condition |
Optional condition column. |
metric_type |
Character scalar describing the planned metric/model type. |
baseline_window |
Optional numeric vector of length two. |
min_observations_per_subject |
Minimum number of observations expected per subject. |
max_missing_trial_prop |
Maximum acceptable missingness proportion per subject-trial cell before a warning is raised. |
A data frame of checks, status values, and messages.
Checks whether each Gazepoint participant/source has both an all-gaze CSV file and a fixation CSV file before running the full workflow.
check_gazepoint_file_pairs( folder, all_gaze_pattern = "_all_gaze\\.csv$", fixation_pattern = "_fixations\\.csv$", recursive = FALSE )check_gazepoint_file_pairs( folder, all_gaze_pattern = "_all_gaze\\.csv$", fixation_pattern = "_fixations\\.csv$", recursive = FALSE )
folder |
Folder containing Gazepoint CSV export files. |
all_gaze_pattern |
Regular expression for selecting all-gaze files. |
fixation_pattern |
Regular expression for selecting fixation files. |
recursive |
Logical. If |
A tibble with one row per detected participant/source and file-pair status.
Check convergence status for fitted models used in gp3tools workflows.
check_gazepoint_model_convergence(model, model_name = NULL)check_gazepoint_model_convergence(model, model_name = NULL)
model |
A fitted model object, or a |
model_name |
Optional model label used in the returned table. |
This helper supports lme4 mixed models, mgcv GAM/GAMM objects,
glm objects, and lm objects where convergence is meaningful. It returns
a compact diagnostic table instead of printing model-specific messages.
A tibble with model class, convergence status, diagnostic status, and message.
Compute a Pearson-residual overdispersion diagnostic for models where this is meaningful, especially binomial and count models.
check_gazepoint_model_overdispersion( model, ratio_threshold = 1.2, model_name = NULL )check_gazepoint_model_overdispersion( model, ratio_threshold = 1.2, model_name = NULL )
model |
A fitted model object, or a |
ratio_threshold |
Numeric threshold above which the model is flagged as overdispersed. |
model_name |
Optional model label used in the returned table. |
This helper supports glm, lme4 GLMMs, and mgcv GAM/GAMM objects when
their family is binomial, quasibinomial, Poisson, quasipoisson, or
negative-binomial-like. Gaussian lm, lmer, and Gaussian GAM models return
a structured not_applicable diagnostic row.
A tibble with Pearson chi-square, residual degrees of freedom, dispersion ratio, overdispersion flag, diagnostic status, and message.
Check whether a fitted mixed model has a singular random-effects structure.
check_gazepoint_model_singularity(model, tolerance = 1e-04, model_name = NULL)check_gazepoint_model_singularity(model, tolerance = 1e-04, model_name = NULL)
model |
A fitted model object, or a |
tolerance |
Numeric tolerance passed to |
model_name |
Optional model label used in the returned table. |
This helper is primarily intended for lme4 mixed models. For model classes
where singularity is not meaningful, such as lm, glm, and mgcv GAM
objects, it returns a structured not_applicable diagnostic row.
A tibble with model class, singular-fit status, diagnostic status, and message.
Applies explicit absolute limits and, optionally, compares matched rows with a saved baseline. Scaling exponents are estimated from median elapsed times across row-count levels.
check_gazepoint_performance_regression( x, limits = gp3tools_performance_limits(), baseline = NULL, elapsed_ratio_limit = 1.5, memory_ratio_limit = 1.5 )check_gazepoint_performance_regression( x, limits = gp3tools_performance_limits(), baseline = NULL, elapsed_ratio_limit = 1.5, memory_ratio_limit = 1.5 )
x |
A benchmark object or summary data frame. |
limits |
Explicit operation-level limits. |
baseline |
Optional prior benchmark object or summary data frame. |
elapsed_ratio_limit |
Maximum allowed elapsed-time ratio to baseline. |
memory_ratio_limit |
Maximum allowed heap-growth ratio to baseline. |
A "gazepoint_performance_regression" object.
Create an explicit final readiness gate for real Gazepoint or gp3tools master data before confirmatory analysis. The gate checks required identifiers, trial/time structure, analysis-specific columns, missingness, basic design balance, and optional upstream audit objects.
check_gazepoint_real_data_readiness( data, analysis_type = c("general", "pupil", "aoi", "combined"), participant_col = NULL, trial_col = NULL, time_col = NULL, condition_col = NULL, stimulus_col = NULL, aoi_col = NULL, pupil_col = NULL, gaze_x_col = NULL, gaze_y_col = NULL, tracking_valid_col = NULL, required_cols = NULL, audit_objects = NULL, min_rows = 1L, min_participants = 1L, min_trials = 1L, max_missing_pupil_prop = 0.4, max_missing_gaze_prop = 0.4, max_condition_imbalance_ratio = 3, name = "gazepoint_real_data_readiness_gate" )check_gazepoint_real_data_readiness( data, analysis_type = c("general", "pupil", "aoi", "combined"), participant_col = NULL, trial_col = NULL, time_col = NULL, condition_col = NULL, stimulus_col = NULL, aoi_col = NULL, pupil_col = NULL, gaze_x_col = NULL, gaze_y_col = NULL, tracking_valid_col = NULL, required_cols = NULL, audit_objects = NULL, min_rows = 1L, min_participants = 1L, min_trials = 1L, max_missing_pupil_prop = 0.4, max_missing_gaze_prop = 0.4, max_condition_imbalance_ratio = 3, name = "gazepoint_real_data_readiness_gate" )
data |
A Gazepoint or gp3tools data frame. |
analysis_type |
Analysis target. Options are |
participant_col |
Optional participant column. If |
trial_col |
Optional trial column. If |
time_col |
Optional time column. If |
condition_col |
Optional condition/group column. If |
stimulus_col |
Optional stimulus/media column. If |
aoi_col |
Optional AOI/state column. If |
pupil_col |
Optional pupil column. If |
gaze_x_col |
Optional horizontal gaze coordinate column. |
gaze_y_col |
Optional vertical gaze coordinate column. |
tracking_valid_col |
Optional tracking-validity column. |
required_cols |
Additional required columns. |
audit_objects |
Optional list of upstream audit/validation objects. |
min_rows |
Minimum acceptable number of rows. |
min_participants |
Minimum acceptable number of participants. |
min_trials |
Minimum acceptable number of participant-trial units. |
max_missing_pupil_prop |
Maximum acceptable pupil missingness proportion when pupil data are required. |
max_missing_gaze_prop |
Maximum acceptable gaze-coordinate missingness proportion when gaze coordinate columns are present. |
max_condition_imbalance_ratio |
Warning threshold for condition imbalance. |
name |
Character label stored in the returned object. |
This helper is a final decision wrapper. It complements, but does not replace,
validate_gazepoint_master() or create_gazepoint_analysis_decision_audit().
A list with class gp3_real_data_readiness_gate.
Check sampling rate by group
check_sampling_rate(data, group_cols = "MEDIA_ID", time_col = "TIME")check_sampling_rate(data, group_cols = "MEDIA_ID", time_col = "TIME")
data |
A Gazepoint all-gaze data frame. |
group_cols |
Character vector of grouping columns, usually |
time_col |
Name of elapsed-time column. |
A tibble with sample interval and estimated Hz.
Estimates gaze velocity, initializes hidden states by k-means, estimates a Gaussian-emission HMM, and decodes the most likely sequence with Viterbi. This is a lightweight package-internal HMM classifier and not a replacement for validated laboratory event-detection software.
classify_gazepoint_events_hmm( data, x, y, time, subject = NULL, n_states = 3, state_labels = NULL )classify_gazepoint_events_hmm( data, x, y, time, subject = NULL, n_states = 3, state_labels = NULL )
data |
A data frame. |
x |
X-coordinate column. |
y |
Y-coordinate column. |
time |
Time column. |
subject |
Optional subject column for within-subject sequences. |
n_states |
Number of hidden states. |
state_labels |
Optional labels for states. If |
The input data with velocity, hmm_state, and hmm_event columns.
Uses the filename and header structure to classify a file as all_gaze,
fixations, summary, or unknown.
classify_gazepoint_export(path)classify_gazepoint_export(path)
path |
File path. |
A single character string.
Computes trackloss rates globally or within user-specified grouping columns, then flags or removes groups exceeding a transparent threshold. Trackloss can be supplied directly through a validity/tracking column or inferred from missing/out-of-range gaze coordinates.
clean_gazepoint_by_trackloss( data, group_cols = NULL, tracking_col = NULL, x_col = NULL, y_col = NULL, max_trackloss = 0.25, action = c("flag", "filter"), treat_zero_zero_as_loss = TRUE, rate_col = ".gp3_trackloss_rate", exclude_col = ".gp3_trackloss_exclude" )clean_gazepoint_by_trackloss( data, group_cols = NULL, tracking_col = NULL, x_col = NULL, y_col = NULL, max_trackloss = 0.25, action = c("flag", "filter"), treat_zero_zero_as_loss = TRUE, rate_col = ".gp3_trackloss_rate", exclude_col = ".gp3_trackloss_exclude" )
data |
A data frame. |
group_cols |
Optional character vector of grouping columns, for example participant and trial identifiers. |
tracking_col |
Optional tracking/validity column. Logical, numeric, and character encodings are supported. |
x_col, y_col
|
Optional gaze coordinate columns used when |
max_trackloss |
Maximum allowed trackloss proportion per group. |
action |
Either |
treat_zero_zero_as_loss |
If |
rate_col, exclude_col
|
Names of the added diagnostic columns. |
A data frame with diagnostic columns. If action = "filter", rows
from excluded groups are removed. A compact summary is stored in the
"gp3_trackloss_summary" attribute.
x <- data.frame( participant = c("P1", "P1", "P2", "P2"), trial = c(1, 1, 1, 1), valid = c(1, 0, 1, 1) ) clean_gazepoint_by_trackloss( x, group_cols = c("participant", "trial"), tracking_col = "valid", max_trackloss = 0.25 )x <- data.frame( participant = c("P1", "P1", "P2", "P2"), trial = c(1, 1, 1, 1), valid = c(1, 0, 1, 1) ) clean_gazepoint_by_trackloss( x, group_cols = c("participant", "trial"), tracking_col = "valid", max_trackloss = 0.25 )
Cluster scanpaths from long-format AOI observations, pairwise scanpath
distances, a numeric distance matrix, or a "dist" object.
cluster_gazepoint_scanpaths( x, k = 3, method = c("hierarchical", "pam"), linkage = c("average", "complete", "single", "ward.D2", "ward.D", "mcquitty", "median", "centroid"), aoi_col = NULL, group_cols = NULL, time_col = NULL, distance_col = "normalized_distance", include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )cluster_gazepoint_scanpaths( x, k = 3, method = c("hierarchical", "pam"), linkage = c("average", "complete", "single", "ward.D2", "ward.D", "mcquitty", "median", "centroid"), aoi_col = NULL, group_cols = NULL, time_col = NULL, distance_col = "normalized_distance", include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )
x |
One of:
|
k |
Integer number of clusters. Must be at least 2 and smaller than the number of scanpaths. |
method |
Clustering method: |
linkage |
Hierarchical linkage method passed to
|
aoi_col |
AOI column when |
group_cols |
Columns identifying independent scanpaths when |
time_col |
Optional ordering column for long-format AOI data. |
distance_col |
Distance column when |
include_missing |
Should missing AOI labels be retained as a state? |
missing_label |
Label used when retaining missing AOIs. |
collapse_repeats |
Should consecutive repeated AOI labels be collapsed before pairwise distances are calculated? |
max_sequences |
Maximum number of grouped scanpaths permitted when pairwise distances must be calculated. |
Long-format AOI data are converted to pairwise normalized edit distances
with compute_gazepoint_scanpath_similarity. Hierarchical
clustering uses base R. Partitioning around medoids requires the optional
cluster package.
An object of class "gp3_scanpath_clusters" containing:
assignments: scanpath identifiers and cluster assignments;
distance: the clustering distance object;
model: the fitted hierarchical or PAM model;
medoids: PAM medoid identifiers, when applicable;
silhouette: scanpath-level silhouette diagnostics when
cluster is available;
clustering settings and status fields.
distance_matrix <- matrix( c( 0, 1, 5, 6, 1, 0, 6, 5, 5, 6, 0, 1, 6, 5, 1, 0 ), nrow = 4, byrow = TRUE, dimnames = list( c("scanpath_1", "scanpath_2", "scanpath_3", "scanpath_4"), c("scanpath_1", "scanpath_2", "scanpath_3", "scanpath_4") ) ) result <- cluster_gazepoint_scanpaths( distance_matrix, k = 2, method = "hierarchical" ) result$assignmentsdistance_matrix <- matrix( c( 0, 1, 5, 6, 1, 0, 6, 5, 5, 6, 0, 1, 6, 5, 1, 0 ), nrow = 4, byrow = TRUE, dimnames = list( c("scanpath_1", "scanpath_2", "scanpath_3", "scanpath_4"), c("scanpath_1", "scanpath_2", "scanpath_3", "scanpath_4") ) ) result <- cluster_gazepoint_scanpaths( distance_matrix, k = 2, method = "hierarchical" ) result$assignments
Collects compact overview/status information from gp3tools audit, workflow, checklist, readiness, diagnostic, or reporting objects. The helper is intended to make existing QC outputs easier to review together; it does not rerun checks or define exclusion rules.
collect_gazepoint_qc_summaries( objects, object_names = NULL, name = "gazepoint_qc_summary_bundle", include_overview_rows = TRUE )collect_gazepoint_qc_summaries( objects, object_names = NULL, name = "gazepoint_qc_summary_bundle", include_overview_rows = TRUE )
objects |
A list of gp3tools objects, audit objects, overview data frames, or a single such object. |
object_names |
Optional character names for unnamed objects. |
name |
Character label stored in the returned object. |
include_overview_rows |
Logical. If |
A list with overview, object_summary, overview_rows, and
settings.
audit <- list( overview = data.frame( audit_status = "ok", message = "Example audit passed." ) ) collect_gazepoint_qc_summaries(list(example_audit = audit))audit <- list( overview = data.frame( audit_status = "ok", message = "Example audit passed." ) ) collect_gazepoint_qc_summaries(list(example_audit = audit))
Combines two numeric eye-specific columns into a single analysis column. The helper is intentionally simple and transparent: it can average available left/right values, prefer one eye with fallback to the other, or select the globally less-missing eye as a pragmatic "best eye" rule.
combine_gazepoint_eyes( data, left_col, right_col, output_col = "combined_eye", method = c("mean", "left", "right", "prefer_left", "prefer_right", "best"), valid_min = NULL, valid_max = NULL )combine_gazepoint_eyes( data, left_col, right_col, output_col = "combined_eye", method = c("mean", "left", "right", "prefer_left", "prefer_right", "best"), valid_min = NULL, valid_max = NULL )
data |
A data frame. |
left_col, right_col
|
Character names of the left- and right-eye columns. |
output_col |
Character name of the combined output column. |
method |
Combination rule. One of |
valid_min, valid_max
|
Optional numeric bounds. Values outside these bounds are treated as missing before combination. |
A copy of data with output_col added.
x <- data.frame(left_pupil = c(3.1, NA, 3.4), right_pupil = c(3.3, 3.2, NA)) combine_gazepoint_eyes(x, "left_pupil", "right_pupil", "pupil")x <- data.frame(left_pupil = c(3.1, NA, 3.4), right_pupil = c(3.3, 3.2, NA)) combine_gazepoint_eyes(x, "left_pupil", "right_pupil", "pupil")
Run native velocity-threshold detection, the lightweight gp3tools HMM classifier, and an optional eyetools branch on the same sample-level gaze data. Detector failures are recorded without invalidating successful branches.
compare_gazepoint_event_detectors( data, id_col = "USER_ID", trial_col = NULL, group_cols = NULL, x_col = "FPOGX", y_col = "FPOGY", time_col = "TIME", methods = c("velocity", "hmm", "eyetools"), velocity_thresholds = c(5, 10, 20), min_duration = 50, hmm_states = 3L, eyetools_method = c("vti", "dispersion"), run_optional_eyetools = FALSE, min_overlap = 0.5, velocity_args = list(), hmm_args = list(), eyetools_args = list() )compare_gazepoint_event_detectors( data, id_col = "USER_ID", trial_col = NULL, group_cols = NULL, x_col = "FPOGX", y_col = "FPOGY", time_col = "TIME", methods = c("velocity", "hmm", "eyetools"), velocity_thresholds = c(5, 10, 20), min_duration = 50, hmm_states = 3L, eyetools_method = c("vti", "dispersion"), run_optional_eyetools = FALSE, min_overlap = 0.5, velocity_args = list(), hmm_args = list(), eyetools_args = list() )
data |
A sample-level gaze data frame. |
id_col |
Participant identifier column. |
trial_col |
Optional trial identifier column. |
group_cols |
Optional additional sequence columns. |
x_col, y_col
|
Gaze-coordinate columns. |
time_col |
Timestamp column. |
methods |
Detector branches to run: |
velocity_thresholds |
One or more positive velocity thresholds. |
min_duration |
Minimum fixation duration in milliseconds for the native velocity branch. |
hmm_states |
Number of HMM states. |
eyetools_method |
eyetools detector method. |
run_optional_eyetools |
Should the optional eyetools branch be run? |
min_overlap |
Minimum intersection-over-union used to classify overlapping events as matched. |
velocity_args |
Named list overriding native velocity-detector defaults. |
hmm_args |
Named list overriding HMM-classifier defaults. |
eyetools_args |
Named list overriding eyetools-wrapper defaults. |
An object of class "gp3_event_detector_comparison" containing
standardized event tables, detector-run status, detector summaries,
pairwise agreement, unmatched events, raw detector outputs, and settings.
gaze <- data.frame( USER_ID = rep("P01", 80), trial = rep("T01", 80), TIME = seq(0, by = 0.01, length.out = 80), FPOGX = c(rep(0.2, 30), seq(0.2, 0.8, length.out = 10), rep(0.8, 40)), FPOGY = 0.5 ) comparison <- compare_gazepoint_event_detectors( gaze, trial_col = "trial", methods = "velocity", velocity_thresholds = c(5, 10) ) comparison$detector_summarygaze <- data.frame( USER_ID = rep("P01", 80), trial = rep("T01", 80), TIME = seq(0, by = 0.01, length.out = 80), FPOGX = c(rep(0.2, 30), seq(0.2, 0.8, length.out = 10), rep(0.8, 40)), FPOGY = 0.5 ) comparison <- compare_gazepoint_event_detectors( gaze, trial_col = "trial", methods = "velocity", velocity_thresholds = c(5, 10) ) comparison$detector_summary
Compare a sequence of nested models, such as null, main-effect, time, condition, and interaction models. The helper returns model-level fit indices, likelihood-ratio comparisons, ranking information, and extraction statuses.
compare_gazepoint_nested_models( models, model_names = NULL, comparison = c("sequential", "against_first"), name = "gazepoint_nested_model_comparison" )compare_gazepoint_nested_models( models, model_names = NULL, comparison = c("sequential", "against_first"), name = "gazepoint_nested_model_comparison" )
models |
A list of fitted model objects. |
model_names |
Optional character vector of model names. If |
comparison |
Comparison strategy. |
name |
Character label stored in the returned object. |
This helper is useful for GCA, confirmatory LMM/GLMM workflows, AOI GLMMs, pupil LMMs, and other fitted model workflows where reviewers expect explicit model-comparison evidence.
A list with class gp3_nested_model_comparison.
Computes spatial AOI entropy, directed transition entropy, and conditional transition entropy for Gazepoint-style AOI sequences. The function is useful for quantifying how concentrated, dispersed, or predictable gaze allocation is across Areas of Interest.
compute_gazepoint_aoi_entropy( data, aoi_col, group_cols = NULL, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, log_base = 2 )compute_gazepoint_aoi_entropy( data, aoi_col, group_cols = NULL, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, log_base = 2 )
data |
A data frame containing AOI observations. |
aoi_col |
Character scalar. Column containing AOI labels. |
group_cols |
Optional character vector of grouping columns, such as participant, trial, stimulus, or condition columns. |
time_col |
Optional character scalar. If supplied, observations are ordered by this column within each group before transitions are computed. |
include_missing |
Logical. If |
missing_label |
Character scalar used when |
collapse_repeats |
Logical. If |
log_base |
Numeric scalar. Base of the logarithm used for entropy. |
A data frame with one row per group and entropy/count columns.
dat <- data.frame( subject = "S01", trial = "T01", time = 1:6, AOI = c("A", "A", "B", "C", "B", "A") ) compute_gazepoint_aoi_entropy( dat, aoi_col = "AOI", group_cols = c("subject", "trial"), time_col = "time" )dat <- data.frame( subject = "S01", trial = "T01", time = 1:6, AOI = c("A", "A", "B", "C", "B", "A") ) compute_gazepoint_aoi_entropy( dat, aoi_col = "AOI", group_cols = c("subject", "trial"), time_col = "time" )
Computes compact scanpath-style descriptors from Gazepoint AOI sequences, including sequence length, AOI visits, transitions, revisits, first and last AOI, dominant AOI, and run-length summaries.
compute_gazepoint_aoi_sequence_metrics( data, aoi_col, group_cols = NULL, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = TRUE )compute_gazepoint_aoi_sequence_metrics( data, aoi_col, group_cols = NULL, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = TRUE )
data |
A data frame containing AOI observations. |
aoi_col |
Character scalar. Column containing AOI labels. |
group_cols |
Optional character vector of grouping columns. |
time_col |
Optional character scalar. If supplied, observations are ordered by this column within each group. |
include_missing |
Logical. If |
missing_label |
Character scalar used when |
collapse_repeats |
Logical. If |
A data frame with one row per group and sequence-metric columns.
dat <- data.frame( subject = "S01", trial = "T01", time = 1:6, AOI = c("A", "A", "B", "A", "C", "C") ) compute_gazepoint_aoi_sequence_metrics( dat, aoi_col = "AOI", group_cols = c("subject", "trial"), time_col = "time" )dat <- data.frame( subject = "S01", trial = "T01", time = 1:6, AOI = c("A", "A", "B", "A", "C", "C") ) compute_gazepoint_aoi_sequence_metrics( dat, aoi_col = "AOI", group_cols = c("subject", "trial"), time_col = "time" )
Compute AOI transition count and probability matrices from sample-level Gazepoint AOI data, AOI-entry tables, or AOI-sequence tables. The function returns both matrix and long-table forms.
compute_gazepoint_aoi_transition_matrix( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), by_cols = NULL, include_non_aoi = TRUE, include_self_transitions = TRUE, states = NULL, time_window = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )compute_gazepoint_aoi_transition_matrix( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), by_cols = NULL, include_non_aoi = TRUE, include_self_transitions = TRUE, states = NULL, time_window = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )
data |
A Gazepoint sample-level data frame, AOI-entry table, or AOI-sequence table. |
aoi_col |
Name of the AOI-state column. Used only when |
time_col |
Name of the time column, in milliseconds. Used only when
|
group_cols |
Character vector of columns defining independent AOI sequences, usually subject/media/trial. |
by_cols |
Optional character vector of columns used to compute separate
matrices, for example |
include_non_aoi |
Logical. If |
include_self_transitions |
Logical. If |
states |
Optional character vector giving the desired row/column order for the transition matrices. |
time_window |
Optional numeric vector of length 2 giving an entry-start time window in milliseconds. |
non_aoi_values |
Character vector of AOI labels treated as background or non-AOI states. |
missing_aoi_label |
Label used when the AOI value is missing. |
A list containing count matrices, probability matrices, and long-form transition counts/probabilities.
Compute between-fixation displacement metrics from ordered fixation coordinates. The function does not perform raw event detection; it assumes that fixation-level coordinates are already available, for example from Gazepoint fixation exports.
compute_gazepoint_saccade_metrics( data, x_col, y_col, group_cols = NULL, time_col = NULL, start_time_col = NULL, end_time_col = NULL, distance_scale = 1, drop_missing = TRUE )compute_gazepoint_saccade_metrics( data, x_col, y_col, group_cols = NULL, time_col = NULL, start_time_col = NULL, end_time_col = NULL, distance_scale = 1, drop_missing = TRUE )
data |
A fixation-level data frame. |
x_col |
Name of the horizontal fixation-coordinate column. |
y_col |
Name of the vertical fixation-coordinate column. |
group_cols |
Optional columns defining independent scanpaths, such as participant and trial. |
time_col |
Optional column used to order fixations and compute inter-fixation time differences. |
start_time_col |
Optional fixation-start column. |
end_time_col |
Optional fixation-end column. If both start and end columns are supplied, saccade duration is computed as the next fixation start minus the current fixation end. |
distance_scale |
Multiplicative scale applied to coordinate distances. |
drop_missing |
Should rows with missing coordinates be dropped? |
A data frame with one row per between-fixation movement.
Computes scanpath length, straight-line distance, efficiency, convex-hull area, and spatial dispersion from sequential gaze/fixation coordinates.
compute_gazepoint_scanpath_geometry( data, x, y, subject, trial, time = NULL, condition = NULL )compute_gazepoint_scanpath_geometry( data, x, y, subject, trial, time = NULL, condition = NULL )
data |
A data frame. |
x |
X-coordinate column. |
y |
Y-coordinate column. |
subject |
Subject column. |
trial |
Trial column. |
time |
Optional time column used for ordering. |
condition |
Optional condition column to carry forward. |
A trial-level data frame of scanpath geometry features.
Compute pairwise AOI-sequence similarity between grouped scanpaths using
a lightweight Levenshtein edit-distance implementation. Similarity is
reported as 1 - normalized_distance, where normalized distance is
divided by the longer sequence length.
compute_gazepoint_scanpath_similarity( data, aoi_col, group_cols, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )compute_gazepoint_scanpath_similarity( data, aoi_col, group_cols, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )
data |
A data frame containing AOI observations. |
aoi_col |
Name of the AOI column. |
group_cols |
Columns defining each scanpath, for example subject and trial. |
time_col |
Optional time/order column. |
include_missing |
Should missing AOI labels be retained as a state? |
missing_label |
Label used when retaining missing AOIs. |
collapse_repeats |
Should consecutive repeated AOI labels be collapsed? |
max_sequences |
Maximum number of grouped sequences to compare. |
A long-format data frame containing pairwise edit distances, normalized distances, and similarities.
Compute compact sequence-complexity summaries from AOI labels. This helper complements transition and entropy summaries by returning simple, interpretable indices such as type-token ratio, transition density, normalized entropy, and a combined complexity index.
compute_gazepoint_sequence_complexity( data = NULL, sequence = NULL, aoi_col = NULL, group_cols = NULL, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE )compute_gazepoint_sequence_complexity( data = NULL, sequence = NULL, aoi_col = NULL, group_cols = NULL, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE )
data |
Optional data frame containing AOI observations. |
sequence |
Optional AOI sequence vector. Used when |
aoi_col |
Name of the AOI column when |
group_cols |
Optional grouping columns. |
time_col |
Optional time/order column. |
include_missing |
Should missing AOI labels be retained as a state? |
missing_label |
Label used when retaining missing AOIs. |
collapse_repeats |
Should consecutive repeated AOI labels be collapsed? |
A data frame with sequence length, unique-state count, entropy, transition density, type-token ratio, and complexity index.
Computes a lightweight edit distance between two AOI sequences using a vector-based Levenshtein distance. This provides a simple scanpath dissimilarity measure without requiring heavy sequence-analysis dependencies.
compute_gazepoint_sequence_distance( sequence_a, sequence_b, ignore_missing = TRUE, missing_label = "missing", collapse_repeats = FALSE, substitution_cost = 1, insertion_cost = 1, deletion_cost = 1 )compute_gazepoint_sequence_distance( sequence_a, sequence_b, ignore_missing = TRUE, missing_label = "missing", collapse_repeats = FALSE, substitution_cost = 1, insertion_cost = 1, deletion_cost = 1 )
sequence_a |
Character, factor, or atomic vector representing the first AOI sequence. |
sequence_b |
Character, factor, or atomic vector representing the second AOI sequence. |
ignore_missing |
Logical. If |
missing_label |
Character scalar used when |
collapse_repeats |
Logical. If |
substitution_cost |
Numeric scalar substitution cost. |
insertion_cost |
Numeric scalar insertion cost. |
deletion_cost |
Numeric scalar deletion cost. |
A one-row data frame with edit distance, normalized distance, and sequence lengths.
compute_gazepoint_sequence_distance( sequence_a = c("Claim", "Evidence", "CTA"), sequence_b = c("Claim", "CTA", "Evidence") )compute_gazepoint_sequence_distance( sequence_a = c("Claim", "Evidence", "CTA"), sequence_b = c("Claim", "CTA", "Evidence") )
Compute lightweight recurrence metrics from AOI/state sequences. This is a compact categorical recurrence helper, not a full replacement for dedicated CRQA/RQA packages.
compute_gazepoint_sequence_recurrence( data = NULL, sequence = NULL, aoi_col = NULL, group_cols = NULL, time_col = NULL, min_line = 2, include_missing = FALSE, missing_label = "missing" )compute_gazepoint_sequence_recurrence( data = NULL, sequence = NULL, aoi_col = NULL, group_cols = NULL, time_col = NULL, min_line = 2, include_missing = FALSE, missing_label = "missing" )
data |
Optional long-format data frame. |
sequence |
Optional AOI/state vector used when |
aoi_col |
AOI/state column when |
group_cols |
Optional grouping columns. |
time_col |
Optional ordering column. |
min_line |
Minimum diagonal-line length for determinism. |
include_missing |
Should missing states be retained? |
missing_label |
Label used for retained missing states. |
A data frame of recurrence metrics.
Compute transition-count and transition-probability matrices across time windows. This helper is a convenience wrapper for studies where AOI/state transitions are expected to vary over the course of a stimulus, trial, or analysis window.
compute_gazepoint_time_varying_transition_matrix( data, from_col = NULL, to_col = NULL, time_col = NULL, window_col = NULL, window_size_ms = NULL, by_cols = NULL, count_col = NULL, states = NULL, complete_states = TRUE, drop_self_transitions = FALSE, normalise = c("row", "global", "none"), name = "gazepoint_time_varying_transition_matrix" )compute_gazepoint_time_varying_transition_matrix( data, from_col = NULL, to_col = NULL, time_col = NULL, window_col = NULL, window_size_ms = NULL, by_cols = NULL, count_col = NULL, states = NULL, complete_states = TRUE, drop_self_transitions = FALSE, normalise = c("row", "global", "none"), name = "gazepoint_time_varying_transition_matrix" )
data |
A data frame containing transition-level rows. |
from_col |
Transition origin column. If |
to_col |
Transition destination column. If |
time_col |
Optional numeric time column used to construct windows when
|
window_col |
Optional existing time-window column. |
window_size_ms |
Numeric window size used when |
by_cols |
Optional grouping columns, such as subject, condition, trial, or stimulus. |
count_col |
Optional count/weight column. If |
states |
Optional character vector of allowed states/AOIs. If |
complete_states |
If |
drop_self_transitions |
If |
normalise |
Probability normalisation. Options are |
name |
Character label stored in the returned object. |
A list with class gp3_time_varying_transition_matrix.
Compute graph-style summaries from AOI transitions without requiring network packages. Metrics include state count, edge count, density, self-loops, and in/out-degree summaries.
compute_gazepoint_transition_network_metrics( data, aoi_col = NULL, from_col = NULL, to_col = NULL, group_cols = NULL, time_col = NULL, include_self_loops = TRUE )compute_gazepoint_transition_network_metrics( data, aoi_col = NULL, from_col = NULL, to_col = NULL, group_cols = NULL, time_col = NULL, include_self_loops = TRUE )
data |
Optional data frame of AOI observations or transition rows. |
aoi_col |
AOI column for raw sequence data. |
from_col |
Source-state column for transition data. |
to_col |
Destination-state column for transition data. |
group_cols |
Optional grouping columns for raw sequence data. |
time_col |
Optional ordering column. |
include_self_loops |
Should self-transitions be included? |
A list with graph-level and state-level summaries.
Compute an AOI transition matrix
compute_transition_matrix( data, group_cols = "MEDIA_ID", aoi_col = "AOI", time_col = "TIME", collapse_repeats = TRUE )compute_transition_matrix( data, group_cols = "MEDIA_ID", aoi_col = "AOI", time_col = "TIME", collapse_repeats = TRUE )
data |
A Gazepoint data frame with AOI labels. |
group_cols |
Columns defining independent sequences. |
aoi_col |
AOI column name. |
time_col |
Time column name. |
collapse_repeats |
If |
A tibble with from, to, n, and prob.
Builds a combined pupil series under a declared policy while retaining a
per-row source label. This function replaces opaque rowMeans(..., na.rm = TRUE) decisions with explicit provenance.
construct_gazepoint_combined_pupil( data, left_col, right_col, policy = c("complete_case", "available_eye", "reconstructed_mean", "left_only", "right_only"), prefix = "gp3_binocular", output_col = "pupil_binocular", status_col = "pupil_binocular_status", valid_min = NULL, valid_max = NULL, overwrite = FALSE )construct_gazepoint_combined_pupil( data, left_col, right_col, policy = c("complete_case", "available_eye", "reconstructed_mean", "left_only", "right_only"), prefix = "gp3_binocular", output_col = "pupil_binocular", status_col = "pupil_binocular_status", valid_min = NULL, valid_max = NULL, overwrite = FALSE )
data |
Raw data or output from |
left_col, right_col
|
Original pupil column names. |
policy |
One of |
prefix |
Reconstruction prefix used by |
output_col |
Name of the constructed pupil column. |
status_col |
Name of the provenance column. |
valid_min, valid_max
|
Optional bounds when working directly from raw channels. |
overwrite |
Whether existing output columns may be replaced. |
data with output_col and status_col appended.
reconstruct_gazepoint_binocular_pupil(),
analyse_gazepoint_binocular_sensitivity()
dat <- simulate_gazepoint_pupil_data(n_subjects = 3, n_trials = 2, seed = 14) dat$pupil_right[30:33] <- NA_real_ construct_gazepoint_combined_pupil( dat, "pupil_left", "pupil_right", policy = "available_eye" )dat <- simulate_gazepoint_pupil_data(n_subjects = 3, n_trials = 2, seed = 14) dat$pupil_right[30:33] <- NA_real_ construct_gazepoint_combined_pupil( dat, "pupil_left", "pupil_right", policy = "available_eye" )
Create a final audit table for a Gazepoint analysis workflow. The function records which analysis branches were run, classifies them as confirmatory, sensitivity, exploratory, diagnostic, preprocessing, or reporting branches, summarises available diagnostics, flags interpretation cautions, and creates a final analysis-readiness table.
create_gazepoint_analysis_decision_audit( ..., results = NULL, branch_roles = NULL, required_confirmatory = character(), diagnostics_required = TRUE, require_clean_diagnostics = FALSE )create_gazepoint_analysis_decision_audit( ..., results = NULL, branch_roles = NULL, required_confirmatory = character(), diagnostics_required = TRUE, require_clean_diagnostics = FALSE )
... |
Named analysis result objects. Each named object is treated as one analysis branch. |
results |
Optional named list of analysis result objects. This can be
used instead of, or together with, |
branch_roles |
Optional data frame describing branch roles. It must
contain |
required_confirmatory |
Character vector of confirmatory branches that must be present for the analysis to be considered complete. |
diagnostics_required |
Logical. If |
require_clean_diagnostics |
Logical. If |
A list with class gp3_analysis_decision_audit containing overview,
branch audit, diagnostics summary, interpretation cautions, readiness, and
settings tables.
Generates a structured checklist for Bayesian or advanced eye-tracking and pupillometry analysis planning.
create_gazepoint_bayesian_sap( outcome, design, primary_model, baseline_window = NULL, analysis_window = NULL, missingness_threshold = 0.2, blink_padding_ms = 50, output = c("data.frame", "markdown") )create_gazepoint_bayesian_sap( outcome, design, primary_model, baseline_window = NULL, analysis_window = NULL, missingness_threshold = 0.2, blink_padding_ms = 50, output = c("data.frame", "markdown") )
outcome |
Outcome name or outcome family. |
design |
Study design description. |
primary_model |
Planned primary model. |
baseline_window |
Optional baseline window. |
analysis_window |
Optional analysis window. |
missingness_threshold |
Trial-level missingness threshold. |
blink_padding_ms |
Blink padding in milliseconds. |
output |
Either |
A data frame or markdown character vector.
Returns formula, family, prior, and reporting-note templates. The function does not require or call brms.
create_gazepoint_brms_template( metric_type, outcome, time = NULL, condition = NULL, subject = NULL, item = NULL )create_gazepoint_brms_template( metric_type, outcome, time = NULL, condition = NULL, subject = NULL, item = NULL )
metric_type |
Metric type, such as |
outcome |
Outcome column name. |
time |
Optional time column. |
condition |
Optional condition column. |
subject |
Optional subject column. |
item |
Optional item/stimulus column. |
A list containing formula, family, priors, and notes.
Create a combined gp3tools-gpbiometrics workflow report
create_gazepoint_cross_package_report(x, output_file = NULL)create_gazepoint_cross_package_report(x, output_file = NULL)
x |
A |
output_file |
Optional Markdown output path. |
Character vector containing a compact Markdown report.
Create a sequence-level CSV-ready template for manually annotating fixation
intervals. The returned table contains one or more placeholder rows per
participant/trial sequence together with the observed sequence boundaries.
Reviewers should fill start_time and end_time, set review_status to
"accepted", and add rows when a sequence contains multiple events.
create_gazepoint_event_review_template( data, id_col = "USER_ID", trial_col = NULL, group_cols = NULL, time_col = "TIME", rows_per_sequence = 1L, event_type = "fixation", reviewer = NA_character_ )create_gazepoint_event_review_template( data, id_col = "USER_ID", trial_col = NULL, group_cols = NULL, time_col = "TIME", rows_per_sequence = 1L, event_type = "fixation", reviewer = NA_character_ )
data |
Sample-level gaze data. |
id_col |
Participant identifier column. |
trial_col |
Optional trial identifier column. |
group_cols |
Optional additional sequence columns. |
time_col |
Timestamp column. |
rows_per_sequence |
Number of placeholder rows created per sequence. |
event_type |
Event label inserted in the template. |
reviewer |
Optional reviewer identifier. |
A data frame suitable for export to CSV and manual review.
gaze <- data.frame( USER_ID = rep(c("P01", "P02"), each = 10), trial = rep("T01", 20), TIME = rep(seq(0, 0.09, by = 0.01), 2), FPOGX = 0.5, FPOGY = 0.5 ) template <- create_gazepoint_event_review_template( gaze, trial_col = "trial" ) templategaze <- data.frame( USER_ID = rep(c("P01", "P02"), each = 10), trial = rep("T01", 20), TIME = rep(seq(0, 0.09, by = 0.01), 2), FPOGX = 0.5, FPOGY = 0.5 ) template <- create_gazepoint_event_review_template( gaze, trial_col = "trial" ) template
Creates a compact checklist for reporting external facial-behaviour analyses alongside Gazepoint data. The checklist is designed for reviewer-facing transparency: it records whether import, quality auditing, synchronisation, window summaries, reactivity summaries, and modelling outputs are available. It also includes interpretation cautions. The helper does not infer facial expressions or emotional states.
create_gazepoint_face_reporting_checklist( face_data = NULL, quality_audit = NULL, sync_audit = NULL, window_summary = NULL, reactivity_summary = NULL, multimodal_model = NULL, include_interpretation_cautions = TRUE )create_gazepoint_face_reporting_checklist( face_data = NULL, quality_audit = NULL, sync_audit = NULL, window_summary = NULL, reactivity_summary = NULL, multimodal_model = NULL, include_interpretation_cautions = TRUE )
face_data |
Optional imported or standardised face-analysis data. |
quality_audit |
Optional object returned by
|
sync_audit |
Optional object returned by |
window_summary |
Optional object returned by
|
reactivity_summary |
Optional object returned by
|
multimodal_model |
Optional object returned by
|
include_interpretation_cautions |
Should interpretation-caution checklist items be included? |
A tibble with class gp3_face_reporting_checklist.
quality <- list( overview = data.frame( n_rows = 10, valid_percent = 95, face_quality_status = "pass" ), issue_summary = data.frame( issue = "missing_confidence", n_groups_affected = 0 ) ) class(quality) <- c("gp3_face_quality_audit", "list") create_gazepoint_face_reporting_checklist(quality_audit = quality)quality <- list( overview = data.frame( n_rows = 10, valid_percent = 95, face_quality_status = "pass" ), issue_summary = data.frame( issue = "missing_confidence", n_groups_affected = 0 ) ) class(quality) <- c("gp3_face_quality_audit", "list") create_gazepoint_face_reporting_checklist(quality_audit = quality)
Writes a Python script for fitting an HDDMRegressor model. The function does not fit HDDM inside R and does not require Python. It creates a reproducible script that can be run in a Python/HDDM environment.
create_gazepoint_hddm_fit_script( data_file, output_file = "fit_gazepoint_hddm.py", regressions = c(v = "target_dwell_ms_z", a = "pupil_peak_z"), include = c("v", "a", "t"), draws = 5000, burn = 2000, dbname = "hddm_traces.db" )create_gazepoint_hddm_fit_script( data_file, output_file = "fit_gazepoint_hddm.py", regressions = c(v = "target_dwell_ms_z", a = "pupil_peak_z"), include = c("v", "a", "t"), draws = 5000, burn = 2000, dbname = "hddm_traces.db" )
data_file |
Path to a CSV file prepared with |
output_file |
Path where the Python script should be written. |
regressions |
Named character vector. Names should be DDM parameters
such as |
include |
Character vector of DDM parameters to include. |
draws |
Number of posterior draws. |
burn |
Number of burn-in samples. |
dbname |
HDDM trace database name. |
Invisibly returns output_file.
Create a dependency-free Markov-chain-style object from AOI/state sequences.
The function computes transition counts, transition probabilities, and matrix
representations from ordered gaze/AOI states. It does not require the external
markovchain package; instead, it returns a lightweight gp3tools object that
can be inspected, exported, or converted later.
create_gazepoint_markovchain_object( data, state_col = NULL, participant_col = NULL, trial_col = NULL, time_col = NULL, sequence_id_cols = NULL, state_order = NULL, exclude_states = c("missing", "missing_aoi", "missing_coordinate", "trackloss", "track_loss"), missing_state_label = NULL, include_self_transitions = TRUE, laplace = 0, empty_state_handling = c("self", "zero", "NA"), name = "gazepoint_markovchain" )create_gazepoint_markovchain_object( data, state_col = NULL, participant_col = NULL, trial_col = NULL, time_col = NULL, sequence_id_cols = NULL, state_order = NULL, exclude_states = c("missing", "missing_aoi", "missing_coordinate", "trackloss", "track_loss"), missing_state_label = NULL, include_self_transitions = TRUE, laplace = 0, empty_state_handling = c("self", "zero", "NA"), name = "gazepoint_markovchain" )
data |
A data frame containing ordered AOI/state observations. |
state_col |
AOI/state column. If |
participant_col |
Optional participant/subject column. |
trial_col |
Optional trial/sequence column. |
time_col |
Optional time/order column. |
sequence_id_cols |
Optional character vector of columns defining separate
sequences. If |
state_order |
Optional character vector giving the preferred state order in the output matrices. |
exclude_states |
Character vector of states to exclude before transition calculation. |
missing_state_label |
Optional label used to retain missing states. If
|
include_self_transitions |
Logical. If |
laplace |
Numeric smoothing value added to all transition cells when computing probabilities. |
empty_state_handling |
How to handle states with no outgoing transitions:
|
name |
Character label stored in the returned object. |
A list with class gp3_markovchain_object.
Converts Gazepoint all-gaze exports imported with read_gazepoint() or
read_gazepoint_folder() into a master sample-level structure suitable for
quality checks, AOI summaries, pupil preprocessing, time-course analyses, and
publication reporting.
create_gazepoint_master( gaze_data, screen_width_px = NULL, screen_height_px = NULL, screen_width_cm = NULL, screen_height_cm = NULL, viewing_distance_cm = NULL, time_unit = c("seconds", "milliseconds"), user_col = "USER_FILE", media_col = "MEDIA_ID", media_name_col = "MEDIA_NAME", tracker_model = "Gazepoint", tracker_sampling_rate = 60, event_latency_offset_ms = 0, baseline_window = NULL, analysis_window = NULL )create_gazepoint_master( gaze_data, screen_width_px = NULL, screen_height_px = NULL, screen_width_cm = NULL, screen_height_cm = NULL, viewing_distance_cm = NULL, time_unit = c("seconds", "milliseconds"), user_col = "USER_FILE", media_col = "MEDIA_ID", media_name_col = "MEDIA_NAME", tracker_model = "Gazepoint", tracker_sampling_rate = 60, event_latency_offset_ms = 0, baseline_window = NULL, analysis_window = NULL )
gaze_data |
Gazepoint all-gaze data frame. |
screen_width_px |
Optional screen width in pixels. If provided and gaze coordinates are normalised, x-coordinates are converted to pixels. |
screen_height_px |
Optional screen height in pixels. If provided and gaze coordinates are normalised, y-coordinates are converted to pixels. |
screen_width_cm |
Optional physical screen width in centimetres. |
screen_height_cm |
Optional physical screen height in centimetres. |
viewing_distance_cm |
Optional viewing distance in centimetres. |
time_unit |
Unit of the Gazepoint |
user_col |
Column identifying the source/user file. |
media_col |
Column identifying the stimulus/media. |
media_name_col |
Column identifying the media/stimulus name. |
tracker_model |
Tracker label stored in the master data. |
tracker_sampling_rate |
Expected tracker sampling rate. |
event_latency_offset_ms |
Optional event-latency correction in milliseconds. |
baseline_window |
Optional numeric vector of length 2 giving baseline start and end in milliseconds. |
analysis_window |
Optional numeric vector of length 2 giving analysis start and end in milliseconds. |
A tibble with one row per Gazepoint sample and publication-oriented master columns.
Create a preprocessing multiverse specification for Gazepoint pupil and AOI workflows. The returned object defines alternative preprocessing decisions that can later be passed to pupil or AOI multiverse runners.
create_gazepoint_preprocessing_multiverse( pupil_max_gap_ms = c(75, 150, 250), pupil_smoothing_window_samples = c(3L, 5L, 7L), pupil_baseline_windows = list(c(0, 200), c(-200, 0)), pupil_artifact_padding_ms = c(0, 50), aoi_denominators = c("valid", "all", "aoi_only"), aoi_min_denominator_samples = c(1L, 5L, 10L), include_pupil = TRUE, include_aoi = TRUE, label_prefix = "mv" )create_gazepoint_preprocessing_multiverse( pupil_max_gap_ms = c(75, 150, 250), pupil_smoothing_window_samples = c(3L, 5L, 7L), pupil_baseline_windows = list(c(0, 200), c(-200, 0)), pupil_artifact_padding_ms = c(0, 50), aoi_denominators = c("valid", "all", "aoi_only"), aoi_min_denominator_samples = c(1L, 5L, 10L), include_pupil = TRUE, include_aoi = TRUE, label_prefix = "mv" )
pupil_max_gap_ms |
Numeric vector of maximum pupil-interpolation gap durations in milliseconds. |
pupil_smoothing_window_samples |
Integer vector of pupil smoothing window sizes in samples. |
pupil_baseline_windows |
List of numeric vectors of length 2 defining pupil baseline windows in milliseconds. |
pupil_artifact_padding_ms |
Numeric vector of artifact-padding values in milliseconds. |
aoi_denominators |
Character vector of AOI denominator definitions.
Typical values are |
aoi_min_denominator_samples |
Integer vector of minimum denominator sample thresholds for AOI-window modelling. |
include_pupil |
Logical. If |
include_aoi |
Logical. If |
label_prefix |
Character prefix used for branch identifiers. |
A list with class gp3_preprocessing_multiverse containing overview,
pupil grid, AOI grid, combined grid, and settings tables.
Creates a compact registry of commonly used preprocessing parameters for Gazepoint pupil and gaze analyses. The registry is designed to make preprocessing choices explicit, auditable, and easy to report.
create_gazepoint_preprocessing_registry( blink_padding_pre_ms = 100, blink_padding_post_ms = 100, max_interpolation_gap_ms = 150, smoothing_window_ms = 50, baseline_start_ms = -200, baseline_end_ms = 0, pupil_physiological_min = 1, pupil_physiological_max = 9, pupil_speed_mad_k = 6, binocular_mad_k = 6, baseline_missing_prop_threshold = 0.3, baseline_interpolated_prop_threshold = 0.3, baseline_artifact_prop_threshold = 0.3, overlap_trial_duration_ms = 3000, overlap_event_gap_ms = 1000 )create_gazepoint_preprocessing_registry( blink_padding_pre_ms = 100, blink_padding_post_ms = 100, max_interpolation_gap_ms = 150, smoothing_window_ms = 50, baseline_start_ms = -200, baseline_end_ms = 0, pupil_physiological_min = 1, pupil_physiological_max = 9, pupil_speed_mad_k = 6, binocular_mad_k = 6, baseline_missing_prop_threshold = 0.3, baseline_interpolated_prop_threshold = 0.3, baseline_artifact_prop_threshold = 0.3, overlap_trial_duration_ms = 3000, overlap_event_gap_ms = 1000 )
blink_padding_pre_ms |
Padding before bad pupil samples, blinks, or
tracking artifacts, in milliseconds. Defaults to |
blink_padding_post_ms |
Padding after bad pupil samples, blinks, or
tracking artifacts, in milliseconds. Defaults to |
max_interpolation_gap_ms |
Maximum missing-pupil gap duration to
interpolate, in milliseconds. Defaults to |
smoothing_window_ms |
Rolling smoothing window, in milliseconds.
Defaults to |
baseline_start_ms |
Baseline-window start, in milliseconds. Defaults to
|
baseline_end_ms |
Baseline-window end, in milliseconds. Defaults to |
pupil_physiological_min |
Minimum plausible pupil value when the pupil
unit is known to be millimetres. Defaults to |
pupil_physiological_max |
Maximum plausible pupil value when the pupil
unit is known to be millimetres. Defaults to |
pupil_speed_mad_k |
MAD multiplier for pupil-speed outlier detection.
Defaults to |
binocular_mad_k |
MAD multiplier for left-right pupil disagreement.
Defaults to |
baseline_missing_prop_threshold |
Baseline missingness threshold used
for baseline-quality audits. Defaults to |
baseline_interpolated_prop_threshold |
Baseline interpolation threshold
used for baseline-quality audits. Defaults to |
baseline_artifact_prop_threshold |
Baseline artifact threshold used for
baseline-quality audits. Defaults to |
overlap_trial_duration_ms |
Trial-duration threshold below which pupil
overlap/deconvolution risk should be considered. Defaults to |
overlap_event_gap_ms |
Event-gap threshold below which pupil-response
overlap should be considered. Defaults to |
A tibble with one row per preprocessing parameter.
registry <- create_gazepoint_preprocessing_registry() registryregistry <- create_gazepoint_preprocessing_registry() registry
Creates a lightweight HTML report from a gp3tools workflow result object.
The report includes dataset dimensions, sampling-rate checks, flagged
recordings, AOI summaries, and standard diagnostic plots.
create_gazepoint_report( results, output_file, title = "Gazepoint diagnostic report", overwrite = TRUE, max_rows = 30, save_plots = TRUE, plot_dir = NULL )create_gazepoint_report( results, output_file, title = "Gazepoint diagnostic report", overwrite = TRUE, max_rows = 30, save_plots = TRUE, plot_dir = NULL )
results |
A named list returned by |
output_file |
Path to the HTML report file to create. |
title |
Report title. |
overwrite |
Logical. If |
max_rows |
Maximum number of rows to show in preview tables. |
save_plots |
Logical. If |
plot_dir |
Optional folder where report plot files should be saved.
If |
A tibble with the written report path and plot folder.
Create an auto-generated reporting checklist for Gazepoint/gp3tools analyses. The checklist summarises whether key dataset, preprocessing, quality-control, AOI, pupil, modelling, sensitivity, and reproducibility elements are present or still need reporting.
create_gazepoint_reporting_checklist( data = NULL, objects = NULL, analysis_type = c("general", "pupil", "aoi", "combined"), study_title = NULL, required_sections = NULL, include_optional = TRUE, name = "gazepoint_reporting_checklist" )create_gazepoint_reporting_checklist( data = NULL, objects = NULL, analysis_type = c("general", "pupil", "aoi", "combined"), study_title = NULL, required_sections = NULL, include_optional = TRUE, name = "gazepoint_reporting_checklist" )
data |
Optional Gazepoint or gp3tools data frame. |
objects |
Optional list of gp3tools audit, model, workflow, readiness, or external-check objects. |
analysis_type |
Analysis target. Options are |
study_title |
Optional study title or short label. |
required_sections |
Optional character vector of checklist item IDs that
should be treated as required. If |
include_optional |
Logical. If |
name |
Character label stored in the returned object. |
This helper is intended as a reporting aid. It does not replace the underlying audit, preprocessing, modelling, or readiness-gate functions.
A list with class gp3_reporting_checklist.
Detects blink-like periods using missing or non-positive pupil samples and optional robust drop/recovery rules. Multiple pupil columns can be supplied; their row-wise mean is used for detection.
detect_gazepoint_blinks( all_gaze, pupil_col = NULL, ts_col = "TIME", id_col = "USER_ID", group_cols = NULL, min_duration = 50, z_thresh = 4, zero_threshold = 0, merge_gap_ms = 20, time_unit = c("auto", "seconds", "milliseconds"), include_rapid_changes = TRUE, return = c("events", "samples", "both") )detect_gazepoint_blinks( all_gaze, pupil_col = NULL, ts_col = "TIME", id_col = "USER_ID", group_cols = NULL, min_duration = 50, z_thresh = 4, zero_threshold = 0, merge_gap_ms = 20, time_unit = c("auto", "seconds", "milliseconds"), include_rapid_changes = TRUE, return = c("events", "samples", "both") )
all_gaze |
A data frame containing sample-level pupil data. |
pupil_col |
Pupil column or columns. When |
ts_col |
Timestamp column. |
id_col |
Participant identifier column. |
group_cols |
Optional additional grouping columns. |
min_duration |
Minimum retained blink duration in milliseconds. |
z_thresh |
Robust threshold for low values and rapid changes. |
zero_threshold |
Values at or below this threshold are invalid. |
merge_gap_ms |
Merge blink candidates separated by no more than this duration. |
time_unit |
Timestamp unit. |
include_rapid_changes |
Include robust rapid drop and recovery flags. |
return |
Return event intervals, sample labels, or both. |
A blink-event tibble, a labelled sample table, or both.
pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.19, by = 0.01), mean_pupil = c(rep(3.2, 7), NA, NA, NA, rep(3.2, 10)) ) detect_gazepoint_blinks(pupil, min_duration = 20)pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.19, by = 0.01), mean_pupil = c(rep(3.2, 7), NA, NA, NA, rep(3.2, 10)) ) detect_gazepoint_blinks(pupil, min_duration = 20)
Apply a lightweight velocity-threshold fixation detector to ordered gaze samples. This helper is intended for exploratory checks and teaching; it does not replace dedicated event-detection packages or Gazepoint's native fixation export.
detect_gazepoint_fixations_ivt( data, x_col, y_col, time_col, group_cols = NULL, velocity_threshold = 0.01, min_duration_ms = 60, distance_scale = 1, time_scale = 1 )detect_gazepoint_fixations_ivt( data, x_col, y_col, time_col, group_cols = NULL, velocity_threshold = 0.01, min_duration_ms = 60, distance_scale = 1, time_scale = 1 )
data |
A sample-level gaze data frame. |
x_col |
Horizontal gaze coordinate column. |
y_col |
Vertical gaze coordinate column. |
time_col |
Time column, in milliseconds by default. |
group_cols |
Optional columns defining independent recordings/trials. |
velocity_threshold |
Maximum velocity for a sample-to-sample interval to be treated as fixation-like. |
min_duration_ms |
Minimum fixation duration. |
distance_scale |
Multiplicative scale applied to coordinate distances. |
time_scale |
Multiplicative scale applied to time differences. |
A fixation-level data frame.
Converts sample-level gaze coordinates into fixation events using an
I-VT-style velocity threshold. The function is intended as a high-level
event-table companion to detect_gazepoint_fixations_ivt().
detect_gazepoint_fixations_velocity( all_gaze, id_col = "USER_ID", x_col = "FPOGX", y_col = "FPOGY", ts_col = "TIME", vmax = 10, min_duration = 50, group_cols = NULL, time_unit = c("auto", "seconds", "milliseconds"), x_scale = 1, y_scale = 1, return = c("events", "samples", "both"), keep_single_sample = FALSE )detect_gazepoint_fixations_velocity( all_gaze, id_col = "USER_ID", x_col = "FPOGX", y_col = "FPOGY", ts_col = "TIME", vmax = 10, min_duration = 50, group_cols = NULL, time_unit = c("auto", "seconds", "milliseconds"), x_scale = 1, y_scale = 1, return = c("events", "samples", "both"), keep_single_sample = FALSE )
all_gaze |
A data frame containing sample-level gaze data. |
id_col |
Participant identifier column. |
x_col |
Horizontal gaze-coordinate column. |
y_col |
Vertical gaze-coordinate column. |
ts_col |
Timestamp column. |
vmax |
Maximum velocity classified as fixation. The threshold is in scaled coordinate units per second. |
min_duration |
Minimum fixation duration in milliseconds. |
group_cols |
Optional additional grouping columns, such as stimulus or trial identifiers. |
time_unit |
Timestamp unit. |
x_scale, y_scale
|
Multipliers applied to coordinate differences before velocity is calculated. Use these to convert native coordinates to visual degrees when an appropriate conversion is available. |
return |
Return fixation |
keep_single_sample |
Retain single-sample events when they satisfy
|
A tibble of fixation events, a labelled sample table, or a list containing both.
gaze <- data.frame( USER_ID = "P01", TIME = seq(0, 0.19, by = 0.01), FPOGX = c(rep(0.25, 10), rep(0.75, 10)), FPOGY = 0.50 ) detect_gazepoint_fixations_velocity( gaze, vmax = 5, min_duration = 40 )gaze <- data.frame( USER_ID = "P01", TIME = seq(0, 0.19, by = 0.01), FPOGX = c(rep(0.25, 10), rep(0.75, 10)), FPOGY = 0.50 ) detect_gazepoint_fixations_velocity( gaze, vmax = 5, min_duration = 40 )
Quantifies binocular availability, monocular loss, left/right agreement, systematic offset, regression diagnostics, and temporal missingness runs before any model-based reconstruction is attempted. Source pupil columns are never modified.
diagnose_gazepoint_binocular_pupil( data, left_col, right_col, time_col = NULL, group_cols = NULL, time_unit = c("auto", "milliseconds", "seconds"), valid_min = NULL, valid_max = NULL, min_pairs = 30L, min_unique = 5L, disagreement_mad_k = 6 )diagnose_gazepoint_binocular_pupil( data, left_col, right_col, time_col = NULL, group_cols = NULL, time_unit = c("auto", "milliseconds", "seconds"), valid_min = NULL, valid_max = NULL, min_pairs = 30L, min_unique = 5L, disagreement_mad_k = 6 )
data |
A data frame containing left and right pupil measurements. |
left_col, right_col
|
Names of numeric pupil columns. |
time_col |
Optional numeric time column. When supplied, gap durations and time-order diagnostics are reported. |
group_cols |
Optional grouping columns, typically participant and/or session. |
time_unit |
Unit for |
valid_min, valid_max
|
Optional physiological or instrument-specific bounds. Values outside the declared bounds are treated as unavailable for diagnostics; the source data remain unchanged. |
min_pairs |
Minimum bilateral observations used to label a group as calibration-eligible. |
min_unique |
Minimum unique values required in each eye for eligibility. |
disagreement_mad_k |
Robust multiplier used to describe unusually large absolute between-eye differences. This is a diagnostic flag, not an exclusion threshold. |
The Bland-Altman-style limits returned here are descriptive
mean-difference +/- 1.96 SD limits. They do not establish interchangeability
of the two measurements. correlation is Pearson correlation and
rank_correlation is Spearman correlation on bilateral observations.
An object of class gp3_binocular_diagnostics containing summary,
gaps, and settings components.
fit_gazepoint_binocular_calibration(),
reconstruct_gazepoint_binocular_pupil()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 11) dat$pupil_left[25:28] <- NA_real_ diagnose_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", min_pairs = 20 )dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 11) dat$pupil_left[25:28] <- NA_real_ diagnose_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", min_pairs = 20 )
Provide a compact diagnostic summary for the conservative two-condition, within-subject, one-dimensional cluster-permutation workflow.
diagnose_gazepoint_cluster_design( data, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome" )diagnose_gazepoint_cluster_design( data, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome" )
data |
A prepared or raw long-format time-course data frame. |
subject_col |
Subject column. |
condition_col |
Condition column. |
time_col |
Time-bin column. |
outcome_col |
Outcome column. |
A data frame of design checks and cautious interpretations.
Run a compact diagnostics bundle for mgcv GAM/BAM models used in
gp3tools workflows. The function combines convergence, basis-dimension
checks, overdispersion checks, and optional DHARMa simulation-based residual
diagnostics.
diagnose_gazepoint_gamm( model, model_name = NULL, check_convergence = TRUE, check_basis = TRUE, check_overdispersion = TRUE, use_dharma = FALSE, dharma_simulations = 250, seed = 123 )diagnose_gazepoint_gamm( model, model_name = NULL, check_convergence = TRUE, check_basis = TRUE, check_overdispersion = TRUE, use_dharma = FALSE, dharma_simulations = 250, seed = 123 )
model |
A fitted GAM/BAM object, a |
model_name |
Optional model label used in returned tables. |
check_convergence |
Logical. If |
check_basis |
Logical. If |
check_overdispersion |
Logical. If |
use_dharma |
Logical. If |
dharma_simulations |
Number of DHARMa simulations. |
seed |
Random seed used before DHARMa simulation. |
The function accepts raw mgcv::gam() / mgcv::bam() model objects,
gp3tools fit objects containing a $model element, or a named list of
fitted model objects.
A list with overview, convergence, basis, overdispersion, DHARMa diagnostics, and settings.
Run a compact diagnostics bundle for model objects used in gp3tools
workflows. The function combines convergence, singularity, overdispersion,
and optional DHARMa simulation-based residual diagnostics.
diagnose_gazepoint_glmm( model, model_name = NULL, check_convergence = TRUE, check_singularity = TRUE, check_overdispersion = TRUE, use_dharma = TRUE, dharma_simulations = 250, seed = 123 )diagnose_gazepoint_glmm( model, model_name = NULL, check_convergence = TRUE, check_singularity = TRUE, check_overdispersion = TRUE, use_dharma = TRUE, dharma_simulations = 250, seed = 123 )
model |
A fitted model object, a |
model_name |
Optional model label used in returned tables. |
check_convergence |
Logical. If |
check_singularity |
Logical. If |
check_overdispersion |
Logical. If |
use_dharma |
Logical. If |
dharma_simulations |
Number of DHARMa simulations. |
seed |
Random seed used before DHARMa simulation. |
The function accepts raw fitted models, gp3tools fit objects containing a
$model element, or a named list of fitted models. DHARMa diagnostics are
optional and are skipped cleanly when DHARMa is not installed.
A list with overview, convergence, singularity, overdispersion, DHARMa diagnostics, and settings.
Aggregates consecutive samples within independent sequences. The default mean method is safer than simple decimation because it reduces aliasing and preserves a representative timestamp for each bin.
downsample_gazepoint_pupil( master_df, factor = 2, pupil_cols = NULL, id_col = "USER_ID", group_cols = NULL, ts_col = "TIME", method = c("mean", "first"), keep_bin = FALSE )downsample_gazepoint_pupil( master_df, factor = 2, pupil_cols = NULL, id_col = "USER_ID", group_cols = NULL, ts_col = "TIME", method = c("mean", "first"), keep_bin = FALSE )
master_df |
A sample-level data frame. |
factor |
Positive integer downsampling factor. |
pupil_cols |
Pupil columns to aggregate. When |
id_col |
Participant identifier. |
group_cols |
Optional additional independent-sequence columns. |
ts_col |
Optional timestamp column. Its bin value is the finite mean. |
method |
|
keep_bin |
Keep the generated downsample-bin identifier. |
A downsampled data frame.
pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.09, by = 0.01), mean_pupil = seq(3, 4, length.out = 10) ) downsample_gazepoint_pupil(pupil, factor = 2)pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.09, by = 0.01), mean_pupil = seq(3, 4, length.out = 10) ) downsample_gazepoint_pupil(pupil, factor = 2)
This function intentionally fails safely. Cluster-permutation results should not be used as exact effect-offset estimates.
estimate_gazepoint_cluster_offset(...)estimate_gazepoint_cluster_offset(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
This function intentionally fails safely. Cluster-permutation results should not be used as exact effect-onset estimates.
estimate_gazepoint_cluster_onset(...)estimate_gazepoint_cluster_onset(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
Estimate the earliest time point at which two condition-level time courses reliably diverge. The helper computes observed condition curves, bootstraps the condition difference, identifies the first time point where the bootstrap confidence interval excludes the null value for a requested number of consecutive time points, and returns a bootstrap uncertainty interval for the divergence onset.
estimate_gazepoint_divergence_point( data, outcome_col, time_col, condition_col, participant_col = NULL, trial_col = NULL, comparison = NULL, bootstrap_unit = c("participant", "trial", "row"), summary_function = c("mean", "median"), n_boot = 1000L, ci = 0.95, consecutive_points = 1L, null_value = 0, min_abs_difference = 0, direction = c("two_sided", "positive", "negative"), seed = NULL, keep_bootstrap = TRUE, name = "gazepoint_divergence_point" )estimate_gazepoint_divergence_point( data, outcome_col, time_col, condition_col, participant_col = NULL, trial_col = NULL, comparison = NULL, bootstrap_unit = c("participant", "trial", "row"), summary_function = c("mean", "median"), n_boot = 1000L, ci = 0.95, consecutive_points = 1L, null_value = 0, min_abs_difference = 0, direction = c("two_sided", "positive", "negative"), seed = NULL, keep_bootstrap = TRUE, name = "gazepoint_divergence_point" )
data |
A data frame containing time-course observations. |
outcome_col |
Outcome column, for example pupil size, fixation probability, gaze proportion, or AOI time-course value. |
time_col |
Time column. |
condition_col |
Condition column. Exactly two conditions are compared
unless |
participant_col |
Optional participant column used for participant-level bootstrap resampling. |
trial_col |
Optional trial column used for trial-level bootstrap resampling. |
comparison |
Optional character vector of two condition values. The
estimated difference is |
bootstrap_unit |
Resampling unit. Options are |
summary_function |
Function used to summarise observations within
condition-by-time cells. Options are |
n_boot |
Number of bootstrap resamples. |
ci |
Confidence level for bootstrap intervals. |
consecutive_points |
Number of consecutive time points required before declaring divergence. |
null_value |
Null difference value. Default is |
min_abs_difference |
Optional minimum absolute observed difference required at a time point. |
direction |
Direction of divergence. |
seed |
Optional random seed for reproducible bootstrap resampling. |
keep_bootstrap |
Logical. If |
name |
Character label stored in the returned object. |
This helper complements cluster-permutation analysis. Cluster permutation asks where a reliable time window exists; divergence-point analysis asks when the condition difference first emerges.
A list with class gp3_divergence_point_analysis.
Export cluster tables, optional null distributions, settings, and cautious report text to a folder of CSV/TXT files.
export_gazepoint_cluster_results(result, outdir, overwrite = FALSE)export_gazepoint_cluster_results(result, outdir, overwrite = FALSE)
result |
A result object returned by
|
outdir |
Output directory. |
overwrite |
Should an existing directory be reused? |
A data frame listing written files.
export_gazepoint_heatmap_png() saves a ggplot heatmap to a PNG file.
export_gazepoint_heatmap_png( plot, filename, width = 8, height = 5, units = "in", dpi = 300, create_dir = TRUE, ... )export_gazepoint_heatmap_png( plot, filename, width = 8, height = 5, units = "in", dpi = 300, create_dir = TRUE, ... )
plot |
A ggplot object, usually returned by
|
filename |
Output file path. |
width, height
|
Plot size passed to |
units |
Units passed to |
dpi |
Resolution passed to |
create_dir |
Logical. If |
... |
Additional arguments passed to |
Invisibly returns the output path.
gaze <- data.frame( x = c(0.20, 0.25, 0.70), y = c(0.30, 0.35, 0.60) ) p <- plot_gazepoint_heatmap( gaze, x_col = "x", y_col = "y", bins = 10 ) out <- tempfile(fileext = ".png") export_gazepoint_heatmap_png(p, out, width = 4, height = 3)gaze <- data.frame( x = c(0.20, 0.25, 0.70), y = c(0.30, 0.35, 0.60) ) p <- plot_gazepoint_heatmap( gaze, x_col = "x", y_col = "y", bins = 10 ) out <- tempfile(fileext = ".png") export_gazepoint_heatmap_png(p, out, width = 4, height = 3)
Exports a Gazepoint master sample-level table together with the output of
audit_gazepoint_master() and, optionally, validate_gazepoint_master().
This function is useful after creating a master table with
as_gazepoint_master() or create_gazepoint_master().
export_gazepoint_master_audit( master, audit = NULL, validation = NULL, output_dir = ".", prefix = "gazepoint", export_master = TRUE, export_audit = TRUE, export_validation = TRUE, overwrite = TRUE, na = "" )export_gazepoint_master_audit( master, audit = NULL, validation = NULL, output_dir = ".", prefix = "gazepoint", export_master = TRUE, export_audit = TRUE, export_validation = TRUE, overwrite = TRUE, na = "" )
master |
A Gazepoint master sample-level table. |
audit |
Optional audit list returned by |
validation |
Optional validation list returned by
|
output_dir |
Directory where CSV files should be written. |
prefix |
File prefix used for all exported CSV files. |
export_master |
Logical. If |
export_audit |
Logical. If |
export_validation |
Logical. If |
overwrite |
Logical. If |
na |
String used for missing values in CSV output. |
A tibble listing the exported files, table names, and dimensions.
## Not run: master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) audit <- audit_gazepoint_master(master) validation <- validate_gazepoint_master(master) exported <- export_gazepoint_master_audit( master = master, audit = audit, validation = validation, output_dir = "gazepoint_outputs", prefix = "study1" ) exported ## End(Not run)## Not run: master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) audit <- audit_gazepoint_master(master) validation <- validate_gazepoint_master(master) exported <- export_gazepoint_master_audit( master = master, audit = audit, validation = validation, output_dir = "gazepoint_outputs", prefix = "study1" ) exported ## End(Not run)
Write a conservative long-format CSV file and README for continuation in an external Python/MNE workflow. This helper prepares data only; it does not run MNE, construct adjacency matrices, validate exchangeability, or validate the external analysis.
export_gazepoint_mne_cluster_input( data, outdir, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome", overwrite = FALSE )export_gazepoint_mne_cluster_input( data, outdir, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome", overwrite = FALSE )
data |
A prepared or raw long-format time-course data frame. |
outdir |
Output directory. |
subject_col |
Subject column. |
condition_col |
Condition column. |
time_col |
Time-bin column. |
outcome_col |
Outcome column. |
overwrite |
Should an existing directory be reused? |
A data frame listing written files.
Export model-summary tables and optional estimated marginal means tables to
CSV files. The function is designed for objects returned by
tidy_gazepoint_model_summary() and summarise_gazepoint_emmeans().
export_gazepoint_model_tables( model_summary = NULL, emmeans_summary = NULL, output_dir, prefix = "gazepoint_model", overwrite = TRUE, include_diagnostics = TRUE )export_gazepoint_model_tables( model_summary = NULL, emmeans_summary = NULL, output_dir, prefix = "gazepoint_model", overwrite = TRUE, include_diagnostics = TRUE )
model_summary |
Optional object returned by
|
emmeans_summary |
Optional object returned by
|
output_dir |
Output directory. |
prefix |
File-name prefix. |
overwrite |
Logical. If |
include_diagnostics |
Logical. If |
A tibble indexing the written files.
Write a conservative long-format CSV file and README for continuation in an external R/permuco workflow. This helper prepares data only; it does not run permuco or validate the external model specification.
export_gazepoint_permuco_cluster_input( data, outdir, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome", overwrite = FALSE )export_gazepoint_permuco_cluster_input( data, outdir, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome", overwrite = FALSE )
data |
A prepared or raw long-format time-course data frame. |
outdir |
Output directory. |
subject_col |
Subject column. |
condition_col |
Condition column. |
time_col |
Time-bin column. |
outcome_col |
Outcome column. |
overwrite |
Should an existing directory be reused? |
A data frame listing written files.
Write a conservative long-format CSV file and README for continuation in an external R/permutes workflow. This helper prepares data only; it does not run permutes or validate the external model specification.
export_gazepoint_permutes_cluster_input( data, outdir, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome", overwrite = FALSE )export_gazepoint_permutes_cluster_input( data, outdir, subject_col = ".gp3_cluster_subject", condition_col = ".gp3_cluster_condition", time_col = ".gp3_cluster_time_bin", outcome_col = ".gp3_cluster_outcome", overwrite = FALSE )
data |
A prepared or raw long-format time-course data frame. |
outdir |
Output directory. |
subject_col |
Subject column. |
condition_col |
Condition column. |
time_col |
Time-bin column. |
outcome_col |
Outcome column. |
overwrite |
Should an existing directory be reused? |
A data frame listing written files.
Writes a named list of analysis tables to CSV files in an output folder.
export_gazepoint_tables( tables, output_dir, prefix = NULL, overwrite = TRUE, na = "" )export_gazepoint_tables( tables, output_dir, prefix = NULL, overwrite = TRUE, na = "" )
tables |
A named list of data frames or tibbles. |
output_dir |
Folder where CSV files should be written. |
prefix |
Optional filename prefix. |
overwrite |
Logical. If |
na |
Value used for missing values in the exported CSV files. |
A tibble with table names and written file paths.
Write a conservative BIDS-style eye-tracking folder from a Gazepoint-style data frame. This helper creates standard-looking TSV and JSON sidecar files for sharing and inspection, but it does not claim full validation against a specific evolving BIDS eye-tracking validator.
export_gazepoint_to_bids( data, outdir, subject_col, task = "gazepoint", session = NULL, time_col, x_col, y_col, pupil_col = NULL, trial_col = NULL, aoi_col = NULL, overwrite = FALSE )export_gazepoint_to_bids( data, outdir, subject_col, task = "gazepoint", session = NULL, time_col, x_col, y_col, pupil_col = NULL, trial_col = NULL, aoi_col = NULL, overwrite = FALSE )
data |
A gaze-sample data frame. |
outdir |
Output directory. |
subject_col |
Subject column. |
task |
Task label used in file names. |
session |
Optional session label. |
time_col |
Time column. |
x_col |
Horizontal gaze coordinate column. |
y_col |
Vertical gaze coordinate column. |
pupil_col |
Optional pupil column. |
trial_col |
Optional trial column. |
aoi_col |
Optional AOI column. |
overwrite |
Should an existing output directory be reused? |
A data frame listing written files.
Select representative observed scanpaths by minimizing mean distance to other members of the same fitted cluster.
extract_gazepoint_representative_scanpaths(x, n_per_cluster = 1L)extract_gazepoint_representative_scanpaths(x, n_per_cluster = 1L)
x |
An object returned by |
n_per_cluster |
Number of representatives to return per cluster. |
A data frame containing cluster, representative rank, sequence identifier, mean within-cluster distance, cluster size, and PAM medoid status.
d <- matrix( c( 0, 0.1, 1, 1, 0.1, 0, 1, 1, 1, 1, 0, 0.1, 1, 1, 0.1, 0 ), nrow = 4, byrow = TRUE, dimnames = list(LETTERS[1:4], LETTERS[1:4]) ) fit <- cluster_gazepoint_scanpaths(d, k = 2) extract_gazepoint_representative_scanpaths(fit)d <- matrix( c( 0, 0.1, 1, 1, 0.1, 0, 1, 1, 1, 1, 0, 0.1, 1, 1, 0.1, 0 ), nrow = 4, byrow = TRUE, dimnames = list(LETTERS[1:4], LETTERS[1:4]) ) fit <- cluster_gazepoint_scanpaths(d, k = 2) extract_gazepoint_representative_scanpaths(fit)
Provides a lightweight post-processing helper for externally generated webcam/CNN gaze predictions. The function does not train a CNN. It filters or down-weights frame-level gaze estimates using an uncertainty column.
filter_gazepoint_cnn_uncertainty( data, x, y, uncertainty = NULL, max_uncertainty = NULL, weight_output = "cnn_uncertainty_weight", valid_output = "cnn_valid_frame" )filter_gazepoint_cnn_uncertainty( data, x, y, uncertainty = NULL, max_uncertainty = NULL, weight_output = "cnn_uncertainty_weight", valid_output = "cnn_valid_frame" )
data |
A data frame containing frame-level gaze predictions. |
x |
Predicted x-coordinate column. |
y |
Predicted y-coordinate column. |
uncertainty |
Optional uncertainty column. |
max_uncertainty |
Optional maximum allowed uncertainty. |
weight_output |
Name of the output weight column. |
valid_output |
Name of the output validity column. |
Data frame with uncertainty weights and validity flags.
Prepare and optionally fit a Bayesian AOI model using brms. The
dependency is optional: the function checks for brms only when
dry_run = FALSE. Tests and lightweight workflows can use
dry_run = TRUE to inspect the formula and data without running Stan.
fit_gazepoint_aoi_brms( data, response, predictors, subject_col = NULL, family = "bernoulli", prior = NULL, dry_run = TRUE, ... )fit_gazepoint_aoi_brms( data, response, predictors, subject_col = NULL, family = "bernoulli", prior = NULL, dry_run = TRUE, ... )
data |
A data frame. |
response |
Response column. |
predictors |
Character vector of fixed-effect predictors. |
subject_col |
Optional grouping column for a random intercept. |
family |
brms family specification as a character string. |
prior |
Optional brms prior object. |
dry_run |
If TRUE, return the prepared call components without fitting. |
... |
Additional arguments passed to |
A dry-run specification list or a brmsfit object.
Fit binomial GAMMs for AOI target-looking time courses prepared by
prepare_gazepoint_aoi_gamm_data(). The model uses target-looking
successes and failures over time and can include condition effects,
condition-specific smooths, and subject random-effect smooths.
fit_gazepoint_aoi_gamm( data, include_condition = TRUE, condition_smooths = TRUE, random_subject = TRUE, random_subject_time = FALSE, time_k = 10, subject_time_k = 5, family = stats::binomial(), method = "fREML", discrete = FALSE, select = FALSE, drop_non_ok = TRUE, min_rows = 10, min_subjects = 2, min_time_bins = 4, ... )fit_gazepoint_aoi_gamm( data, include_condition = TRUE, condition_smooths = TRUE, random_subject = TRUE, random_subject_time = FALSE, time_k = 10, subject_time_k = 5, family = stats::binomial(), method = "fREML", discrete = FALSE, select = FALSE, drop_non_ok = TRUE, min_rows = 10, min_subjects = 2, min_time_bins = 4, ... )
data |
A data frame returned by |
include_condition |
Logical. If |
condition_smooths |
Logical. If |
random_subject |
Logical. If |
random_subject_time |
Logical. If |
time_k |
Basis dimension for the main time smooth. |
subject_time_k |
Basis dimension for subject-specific factor-smooth time deviations. |
family |
Model family. Defaults to |
method |
Smoothing-parameter estimation method passed to
|
discrete |
Logical passed to |
select |
Logical passed to |
drop_non_ok |
Logical. If |
min_rows |
Minimum number of rows required for model fitting. |
min_subjects |
Minimum number of subjects required for model fitting. |
min_time_bins |
Minimum number of time bins required for model fitting. |
... |
Additional arguments passed to |
This function is intended for AOI time-course modelling. It is separate from confirmatory AOI-window GLMMs and from cluster-based permutation tests.
A list containing the fitted model, formula, model status, diagnostics, parametric table, smooth table, and settings.
Fit a compact set of sensitivity models for AOI-window outcomes. The main model is a binomial GLMM. Additional checks can include an empirical-logit LMM, a weighted proportion LMM, and a fixed-effects quasibinomial GLM.
fit_gazepoint_aoi_model_sensitivity( data, success_col = "aoi_glmm_success", failure_col = "aoi_glmm_failure", denominator_col = "aoi_glmm_denominator", proportion_col = "aoi_glmm_prop", subject_col = "aoi_glmm_subject", condition_col = "aoi_glmm_condition", window_col = "aoi_glmm_window", model_types = c("binomial_glmm", "empirical_logit_lmm", "proportion_lmm", "quasibinomial_glm"), include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, optimizer = "bobyqa", maxfun = 2e+05, nAGQ = 0, empirical_logit_correction = 0.5, drop_missing = TRUE )fit_gazepoint_aoi_model_sensitivity( data, success_col = "aoi_glmm_success", failure_col = "aoi_glmm_failure", denominator_col = "aoi_glmm_denominator", proportion_col = "aoi_glmm_prop", subject_col = "aoi_glmm_subject", condition_col = "aoi_glmm_condition", window_col = "aoi_glmm_window", model_types = c("binomial_glmm", "empirical_logit_lmm", "proportion_lmm", "quasibinomial_glm"), include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, optimizer = "bobyqa", maxfun = 2e+05, nAGQ = 0, empirical_logit_correction = 0.5, drop_missing = TRUE )
data |
AOI GLMM data returned by |
success_col |
Success-count column. |
failure_col |
Failure-count column. |
denominator_col |
Denominator column. |
proportion_col |
Proportion column. |
subject_col |
Subject column. |
condition_col |
Condition column. |
window_col |
Window column. |
model_types |
Character vector of model types. Supported values are
|
include_condition |
Logical. Include condition fixed effect when possible. |
include_window |
Logical. Include window fixed effect when possible. |
include_interaction |
Logical. Include condition-by-window interaction when both condition and window are included. |
random_intercept |
Logical. Include subject random intercept in mixed sensitivity models. |
optimizer |
Optimizer for |
maxfun |
Maximum optimizer evaluations. |
nAGQ |
Number of adaptive Gauss-Hermite quadrature points for the binomial GLMM. |
empirical_logit_correction |
Small correction added to success and failure counts for empirical-logit models. |
drop_missing |
Logical. Drop rows with missing model variables. |
A list containing fitted models, formulas, comparison table, fixed effects table, settings, and status information.
Fit a confirmatory AOI-window mixed-effects logistic regression from data
prepared by prepare_gazepoint_aoi_glmm_data().
fit_gazepoint_aoi_window_glmm( data, success_col = "aoi_glmm_success", failure_col = "aoi_glmm_failure", subject_col = "aoi_glmm_subject", condition_col = "aoi_glmm_condition", window_col = "aoi_glmm_window", include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, random_window_slopes = FALSE, fallback_on_singular = TRUE, optimizer = "bobyqa", maxfun = 2e+05, nAGQ = 0, drop_missing = TRUE )fit_gazepoint_aoi_window_glmm( data, success_col = "aoi_glmm_success", failure_col = "aoi_glmm_failure", subject_col = "aoi_glmm_subject", condition_col = "aoi_glmm_condition", window_col = "aoi_glmm_window", include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, random_window_slopes = FALSE, fallback_on_singular = TRUE, optimizer = "bobyqa", maxfun = 2e+05, nAGQ = 0, drop_missing = TRUE )
data |
AOI GLMM data returned by |
success_col |
Success-count column. |
failure_col |
Failure-count column. |
subject_col |
Subject factor/column. |
condition_col |
Condition factor/column. |
window_col |
AOI-window factor/column. |
include_condition |
Logical. Include condition fixed effects when at least two conditions are available. |
include_window |
Logical. Include window fixed effects when at least two windows are available. |
include_interaction |
Logical. Include condition-by-window interaction when both condition and window fixed effects are included. |
random_intercept |
Logical. Include subject random intercept. |
random_window_slopes |
Logical. Attempt subject-level random slopes for AOI window. |
fallback_on_singular |
Logical. If |
optimizer |
Optimizer passed to |
maxfun |
Maximum optimizer evaluations. |
nAGQ |
Number of adaptive Gauss-Hermite quadrature points. |
drop_missing |
Logical. Drop rows with missing model variables before fitting. |
A list with fitted model, attempted model, formulas, comparison table, settings, status fields, and model data.
Fits separate left-from-right and right-from-left linear calibration models using only bilateral observations. Optional fallback levels permit transparent participant/session-to-pooled fallback without silently mixing calibration scopes.
fit_gazepoint_binocular_calibration( data, left_col, right_col, group_cols = NULL, fallback_group_cols = NULL, valid_min = NULL, valid_max = NULL, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, allow_negative_slope = FALSE, max_abs_slope = NULL )fit_gazepoint_binocular_calibration( data, left_col, right_col, group_cols = NULL, fallback_group_cols = NULL, valid_min = NULL, valid_max = NULL, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, allow_negative_slope = FALSE, max_abs_slope = NULL )
data |
A data frame containing pupil channels. |
left_col, right_col
|
Numeric pupil columns. |
group_cols |
Primary calibration grouping columns. |
fallback_group_cols |
Optional list of fallback grouping specifications.
By default a pooled fallback is added when |
valid_min, valid_max
|
Optional measurement bounds. |
min_pairs |
Minimum bilateral training observations per model. |
min_unique |
Minimum unique predictor and outcome values. |
min_r2 |
Optional minimum in-sample R-squared. |
allow_negative_slope |
Whether a non-positive cross-eye slope can be
eligible. The conservative default is |
max_abs_slope |
Optional absolute slope ceiling; use |
R-squared is a diagnostic, not evidence that reconstructed values are measured observations. Calibration eligibility is explicit and can be reviewed before reconstruction.
An object of class gp3_binocular_calibration with a flat models
table, per-level model tables, and settings.
Ong J, He W, Maglanque P, Jiang X, Gillman LM, Vergis A, Hardy K (2025). A Preprocessing Pipeline for Pupillometry Signal from Multimodal iMotion Data. Sensors, 25(15), 4737. doi:10.3390/s25154737
validate_gazepoint_binocular_reconstruction(),
reconstruct_gazepoint_binocular_pupil()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 12) fit_gazepoint_binocular_calibration( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 )dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 12) fit_gazepoint_binocular_calibration( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 )
Fits a Bayesian model using brms when brms is installed. brms is treated as an optional external backend; gp3tools does not import or require it.
fit_gazepoint_brms_model( data, formula, family = "gaussian", prior = NULL, chains = 4, iter = 2000, warmup = floor(iter/2), cores = 1, backend = NULL, ... )fit_gazepoint_brms_model( data, formula, family = "gaussian", prior = NULL, chains = 4, iter = 2000, warmup = floor(iter/2), cores = 1, backend = NULL, ... )
data |
A data frame. |
formula |
A model formula. |
family |
brms family specification as a character string or brms family object. |
prior |
Optional brms prior specification. |
chains |
Number of MCMC chains. |
iter |
Total iterations per chain. |
warmup |
Warmup iterations per chain. |
cores |
Number of cores. |
backend |
Optional brms backend, e.g. |
... |
Additional arguments passed to |
A fitted brms model.
Fits an explicit model to a face-window or multimodal analysis table. If
random_effects is supplied, the model is fitted with lme4::lmer();
otherwise stats::lm() is used. The helper is a modelling convenience wrapper
and does not interpret facial-behaviour variables as emotions.
fit_gazepoint_face_window_lmm( data, outcome, predictors, covariates = NULL, random_effects = NULL, na_action = c("na.omit", "na.exclude"), REML = FALSE )fit_gazepoint_face_window_lmm( data, outcome, predictors, covariates = NULL, random_effects = NULL, na_action = c("na.omit", "na.exclude"), REML = FALSE )
data |
A face-window or multimodal data frame. |
outcome |
Outcome column name. |
predictors |
Character vector of fixed-effect predictor columns. |
covariates |
Optional character vector of covariate columns. |
random_effects |
Optional random-effects formula component, for example
|
na_action |
Missing-data handling. One of |
REML |
Passed to |
A list with model, formula, data, and settings. The object has class
gp3_face_window_lmm.
dat <- data.frame( participant_id = c("P001", "P002", "P003"), AU12_r_mean = c(0.1, 0.2, 0.3), rating = c(3, 4, 5) ) fit_gazepoint_face_window_lmm( dat, outcome = "rating", predictors = "AU12_r_mean" )dat <- data.frame( participant_id = c("P001", "P002", "P003"), AU12_r_mean = c(0.1, 0.2, 0.3), rating = c(3, 4, 5) ) fit_gazepoint_face_window_lmm( dat, outcome = "rating", predictors = "AU12_r_mean" )
Fit a Growth Curve Analysis (GCA) mixed model to prepared pupil time-course data. The function first attempts a random-intercept plus random-time-slopes model and, if the model fails or is singular, falls back to a random-intercept model.
fit_gazepoint_gca( data, outcome_col = "gca_pupil", subject_col = "subject", condition_col = "condition", time_terms = NULL, degree = NULL, weights_col = "gca_weight", use_weights = TRUE, random_slopes = TRUE, fallback_on_singular = TRUE, REML = FALSE, optimizer = "bobyqa", maxfun = 2e+05, drop_missing = TRUE )fit_gazepoint_gca( data, outcome_col = "gca_pupil", subject_col = "subject", condition_col = "condition", time_terms = NULL, degree = NULL, weights_col = "gca_weight", use_weights = TRUE, random_slopes = TRUE, fallback_on_singular = TRUE, REML = FALSE, optimizer = "bobyqa", maxfun = 2e+05, drop_missing = TRUE )
data |
A data frame created by |
outcome_col |
Name of the GCA outcome column. |
subject_col |
Name of the subject column. |
condition_col |
Name of the condition column. |
time_terms |
Optional character vector of polynomial time-term columns.
If |
degree |
Optional number of polynomial terms to use. If supplied and
|
weights_col |
Optional weights column. Use |
use_weights |
Logical. If |
random_slopes |
Logical. If |
fallback_on_singular |
Logical. If |
REML |
Logical passed to |
optimizer |
Optimizer passed to |
maxfun |
Maximum optimizer function evaluations. |
drop_missing |
Logical. If |
A list of class gp3_gca_model containing the fitted model, attempted
and final formulas, model comparison information, settings, and status.
Fits an explicit response model using multimodal predictors. Linear models,
generalised linear models, and mixed-effects models are supported depending on
family and random_effects. The helper prepares and fits the model only; it
does not make causal, diagnostic, or emotion-inference claims.
fit_gazepoint_multimodal_response_model( data, outcome, predictors, covariates = NULL, random_effects = NULL, family = NULL, na_action = c("na.omit", "na.exclude"), REML = FALSE, ... )fit_gazepoint_multimodal_response_model( data, outcome, predictors, covariates = NULL, random_effects = NULL, family = NULL, na_action = c("na.omit", "na.exclude"), REML = FALSE, ... )
data |
A multimodal analysis data frame, usually returned by
|
outcome |
Outcome column name. |
predictors |
Character vector of fixed-effect predictor columns. |
covariates |
Optional character vector of covariate columns. |
random_effects |
Optional random-effects formula component, for example
|
family |
Optional model family. If |
na_action |
Missing-data handling. One of |
REML |
Passed to |
... |
Additional arguments passed to the model-fitting function. |
A list with model, formula, data, and settings. The object has class
gp3_multimodal_response_model.
dat <- data.frame( participant_id = c("P001", "P002", "P003"), AU12_r_mean = c(0.1, 0.2, 0.3), dwell_time = c(1.2, 1.4, 1.1), rating = c(3, 4, 5) ) fit_gazepoint_multimodal_response_model( dat, outcome = "rating", predictors = c("AU12_r_mean", "dwell_time") )dat <- data.frame( participant_id = c("P001", "P002", "P003"), AU12_r_mean = c(0.1, 0.2, 0.3), dwell_time = c(1.2, 1.4, 1.1), rating = c(3, 4, 5) ) fit_gazepoint_multimodal_response_model( dat, outcome = "rating", predictors = c("AU12_r_mean", "dwell_time") )
Fit a generalized additive mixed model for binned pupil time-course data using
mgcv::bam(). The function is designed to work with data prepared by
prepare_gazepoint_pupil_gamm_data().
fit_gazepoint_pupil_gamm( data, pupil_col = "mean_pupil", time_col = "time_bin_center_ms", subject_col = "subject", condition_col = "condition", n_time_basis = 10, use_condition_smooths = TRUE, include_subject_random_effect = TRUE, family = c("gaussian", "scat"), method = "fREML", discrete = TRUE, rho = NULL, ar_start_col = "AR.start", weights_col = NULL, drop_missing = TRUE )fit_gazepoint_pupil_gamm( data, pupil_col = "mean_pupil", time_col = "time_bin_center_ms", subject_col = "subject", condition_col = "condition", n_time_basis = 10, use_condition_smooths = TRUE, include_subject_random_effect = TRUE, family = c("gaussian", "scat"), method = "fREML", discrete = TRUE, rho = NULL, ar_start_col = "AR.start", weights_col = NULL, drop_missing = TRUE )
data |
A binned pupil time-course data frame. |
pupil_col |
Name of the dependent pupil column. |
time_col |
Name of the time-bin centre column. |
subject_col |
Name of the subject column. |
condition_col |
Name of the condition column. |
n_time_basis |
Basis dimension for smooth time terms. |
use_condition_smooths |
Logical. If |
include_subject_random_effect |
Logical. If |
family |
Model family. Use |
method |
Smoothing-parameter estimation method passed to |
discrete |
Logical passed to |
rho |
Optional AR(1) correlation parameter passed to |
ar_start_col |
Optional AR-start column. If present and |
weights_col |
Optional weights column. |
drop_missing |
Logical. If |
A list of class gp3_pupil_gamm containing the fitted model,
formula, data, settings, and status information.
Fit and compare a main pupil GAMM with a gaze-position-adjusted sensitivity
model. The adjusted model adds a two-dimensional tensor-product smooth over
mean gaze x/y position using te(mean_x, mean_y).
fit_gazepoint_pupil_pfe_gamm( data, pupil_col = "mean_pupil", time_col = "time_bin_center_ms", subject_col = "subject", condition_col = "condition", x_col = "mean_x", y_col = "mean_y", n_time_basis = 10, n_position_basis = 8, use_condition_smooths = TRUE, include_subject_random_effect = TRUE, family = c("gaussian", "scat"), method = "fREML", discrete = TRUE, rho = NULL, ar_start_col = "AR.start", weights_col = NULL, drop_missing = TRUE )fit_gazepoint_pupil_pfe_gamm( data, pupil_col = "mean_pupil", time_col = "time_bin_center_ms", subject_col = "subject", condition_col = "condition", x_col = "mean_x", y_col = "mean_y", n_time_basis = 10, n_position_basis = 8, use_condition_smooths = TRUE, include_subject_random_effect = TRUE, family = c("gaussian", "scat"), method = "fREML", discrete = TRUE, rho = NULL, ar_start_col = "AR.start", weights_col = NULL, drop_missing = TRUE )
data |
A binned pupil time-course data frame, usually created by
|
pupil_col |
Name of the dependent pupil column. |
time_col |
Name of the time-bin centre column. |
subject_col |
Name of the subject column. |
condition_col |
Name of the condition column. |
x_col |
Name of the mean gaze x-position column. |
y_col |
Name of the mean gaze y-position column. |
n_time_basis |
Basis dimension for time smooths. |
n_position_basis |
Basis dimension for gaze-position smooths. |
use_condition_smooths |
Logical. If |
include_subject_random_effect |
Logical. If |
family |
Model family. Use |
method |
Smoothing-parameter estimation method passed to |
discrete |
Logical passed to |
rho |
Optional AR(1) correlation parameter passed to |
ar_start_col |
Optional AR-start column. |
weights_col |
Optional weights column. |
drop_missing |
Logical. If |
A list of class gp3_pupil_pfe_gamm containing the main model, the
gaze-position-adjusted model, formulas, comparison table, settings, and
status information.
Fit the main confirmatory trial/window-level pupil model from data prepared
with prepare_gazepoint_pupil_window_model_data(). The default model is a
linear mixed model with pupil outcome as the continuous dependent variable,
condition and/or window fixed effects when available, and a subject random
intercept when feasible.
fit_gazepoint_pupil_window_lmm( data, formula = NULL, outcome_col = "pupil_model_outcome", subject_col = "pupil_model_subject", condition_col = "pupil_model_condition", window_col = "pupil_model_window", weights_col = "pupil_model_weight", use_weights = FALSE, include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, random_window_slopes = FALSE, fallback_on_singular = TRUE, REML = FALSE, optimizer = "bobyqa", maxfun = 2e+05, drop_missing = TRUE, ... )fit_gazepoint_pupil_window_lmm( data, formula = NULL, outcome_col = "pupil_model_outcome", subject_col = "pupil_model_subject", condition_col = "pupil_model_condition", window_col = "pupil_model_window", weights_col = "pupil_model_weight", use_weights = FALSE, include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, random_window_slopes = FALSE, fallback_on_singular = TRUE, REML = FALSE, optimizer = "bobyqa", maxfun = 2e+05, drop_missing = TRUE, ... )
data |
Pupil-window model data, usually produced by
|
formula |
Optional model formula. If |
outcome_col |
Outcome column. |
subject_col |
Subject column. |
condition_col |
Condition column. |
window_col |
Window column. |
weights_col |
Optional weights column. |
use_weights |
Logical. If |
include_condition |
Logical. Include condition fixed effects when more than one condition level is available. |
include_window |
Logical. Include window fixed effects when more than one window level is available. |
include_interaction |
Logical. Include the condition-by-window interaction when both condition and window are used. |
random_intercept |
Logical. Include a subject random intercept when feasible. |
random_window_slopes |
Logical. Attempt subject-level random window slopes when feasible. |
fallback_on_singular |
Logical. If |
REML |
Logical. Passed to |
optimizer |
Optimizer passed to |
maxfun |
Maximum optimizer iterations passed to |
drop_missing |
Logical. If |
... |
Additional arguments passed to |
A list containing the fitted model, formula, attempted model, fallback information, fixed effects, comparison table, settings, and model diagnostics.
Run a compact set of sensitivity models for confirmatory pupil-window analyses. Supported model families are the main linear mixed model, a weighted linear mixed model, a fixed-effects linear model, and a weighted fixed-effects linear model. Weighted models use the prepared valid-sample count column as weights by default.
fit_gazepoint_pupil_window_sensitivity( data, outcome_col = "pupil_model_outcome", subject_col = "pupil_model_subject", condition_col = "pupil_model_condition", window_col = "pupil_model_window", weights_col = "pupil_model_weight", model_types = c("lmm", "weighted_lmm", "lm", "weighted_lm"), include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, random_window_slopes = FALSE, fallback_on_singular = TRUE, REML = FALSE, optimizer = "bobyqa", maxfun = 2e+05, drop_missing = TRUE, ... )fit_gazepoint_pupil_window_sensitivity( data, outcome_col = "pupil_model_outcome", subject_col = "pupil_model_subject", condition_col = "pupil_model_condition", window_col = "pupil_model_window", weights_col = "pupil_model_weight", model_types = c("lmm", "weighted_lmm", "lm", "weighted_lm"), include_condition = TRUE, include_window = TRUE, include_interaction = TRUE, random_intercept = TRUE, random_window_slopes = FALSE, fallback_on_singular = TRUE, REML = FALSE, optimizer = "bobyqa", maxfun = 2e+05, drop_missing = TRUE, ... )
data |
Pupil-window model data, usually produced by
|
outcome_col |
Outcome column. |
subject_col |
Subject column. |
condition_col |
Condition column. |
window_col |
Window column. |
weights_col |
Optional weights column. |
model_types |
Character vector of model types to fit. Supported values
are |
include_condition |
Logical. Include condition fixed effects when more than one condition level is available. |
include_window |
Logical. Include window fixed effects when more than one window level is available. |
include_interaction |
Logical. Include the condition-by-window interaction when both condition and window are used. |
random_intercept |
Logical. Include a subject random intercept for LMM model types when feasible. |
random_window_slopes |
Logical. Attempt subject-level random window slopes for LMM model types when feasible. |
fallback_on_singular |
Logical. If |
REML |
Logical. Passed to |
optimizer |
Optimizer passed to |
maxfun |
Maximum optimizer iterations passed to |
drop_missing |
Logical. If |
... |
Additional arguments passed to
|
A list containing fitted models, formulas, fixed effects, a comparison table, settings, and model-status information.
Fit an optional negative-binomial sensitivity model for AOI/state transition
counts using glmmTMB when it is installed. This helper is intended as a
publication sensitivity branch for overdispersed transition-count outcomes.
fit_gazepoint_transition_count_nb_sensitivity( data, count_col = NULL, from_col = NULL, to_col = NULL, condition_cols = NULL, random_effect_cols = NULL, exposure_col = NULL, offset_col = NULL, formula = NULL, family = c("nbinom2", "nbinom1"), zero_inflation = FALSE, ziformula = NULL, dispformula = NULL, control = NULL, name = "gazepoint_transition_count_nb_sensitivity" )fit_gazepoint_transition_count_nb_sensitivity( data, count_col = NULL, from_col = NULL, to_col = NULL, condition_cols = NULL, random_effect_cols = NULL, exposure_col = NULL, offset_col = NULL, formula = NULL, family = c("nbinom2", "nbinom1"), zero_inflation = FALSE, ziformula = NULL, dispformula = NULL, control = NULL, name = "gazepoint_transition_count_nb_sensitivity" )
data |
A data frame containing transition-count rows. |
count_col |
Transition-count outcome column. If |
from_col |
Transition origin column. If |
to_col |
Transition destination column. If |
condition_cols |
Optional fixed-effect condition columns. |
random_effect_cols |
Optional random-intercept grouping columns. |
exposure_col |
Optional positive exposure column. If supplied, the model
includes |
offset_col |
Optional numeric offset column. Use either |
formula |
Optional model formula. If |
family |
Negative-binomial family. Options are |
zero_inflation |
Logical. If |
ziformula |
Optional zero-inflation formula passed to |
dispformula |
Optional dispersion formula passed to |
control |
Optional control object passed to |
name |
Character label stored in the returned object. |
The helper keeps glmmTMB optional. If glmmTMB is not installed, it returns
a structured skipped object rather than failing.
A list with class gp3_transition_count_nb_sensitivity.
Adds pupil-quality flags to a Gazepoint master sample-level table created by
as_gazepoint_master() or create_gazepoint_master(). This function is
intended as a preprocessing step before interpolation, filtering, baseline
correction, or pupil-based modelling.
flag_gazepoint_pupil( master, pupil_col = NULL, time_col = NULL, missing_pupil_col = NULL, group_cols = c("subject", "media_id"), min_pupil = 0, max_pupil = Inf, outlier_k = 1.5, flag_iqr_outliers = TRUE )flag_gazepoint_pupil( master, pupil_col = NULL, time_col = NULL, missing_pupil_col = NULL, group_cols = c("subject", "media_id"), min_pupil = 0, max_pupil = Inf, outlier_k = 1.5, flag_iqr_outliers = TRUE )
master |
A Gazepoint master sample-level table. |
pupil_col |
Optional name of the pupil column to flag. If |
time_col |
Optional name of the time column. If |
missing_pupil_col |
Optional name of the missing-pupil flag column. If
|
group_cols |
Character vector of grouping columns used for IQR-based
outlier detection. Defaults to |
min_pupil |
Minimum plausible pupil value. Defaults to |
max_pupil |
Maximum plausible pupil value. Defaults to |
outlier_k |
Multiplier for IQR-based outlier detection. Defaults to
|
flag_iqr_outliers |
Logical. If |
A tibble containing the original master table plus pupil-flagging columns.
## Not run: flagged <- flag_gazepoint_pupil(master) dplyr::count(flagged, pupil_flag_reason) ## End(Not run)## Not run: flagged <- flag_gazepoint_pupil(master) dplyr::count(flagged, pupil_flag_reason) ## End(Not run)
Adds pupil-specific artifact flags for blink/trackloss contamination,
physiological implausibility when pupil units are millimetres, pupil-speed
outliers, left-right binocular pupil disagreement, and temporal padding
around bad samples. The function preserves raw pupil columns and creates
pupil_clean, which can be used as input for interpolation.
flag_gazepoint_pupil_artifacts( data, pupil_col = NULL, left_pupil_col = NULL, right_pupil_col = NULL, time_col = NULL, blink_col = NULL, trackloss_col = NULL, missing_pupil_col = NULL, pupil_unit_col = NULL, group_cols = c("subject", "media_id"), registry = NULL, blink_padding_pre_ms = NULL, blink_padding_post_ms = NULL, pupil_min_mm = NULL, pupil_max_mm = NULL, pupil_speed_mad_k = NULL, binocular_mad_k = NULL, max_physio_outlier_prop = 0.8, flag_speed_outliers = TRUE, flag_binocular_disagreement = TRUE, flag_physiological_outliers = TRUE )flag_gazepoint_pupil_artifacts( data, pupil_col = NULL, left_pupil_col = NULL, right_pupil_col = NULL, time_col = NULL, blink_col = NULL, trackloss_col = NULL, missing_pupil_col = NULL, pupil_unit_col = NULL, group_cols = c("subject", "media_id"), registry = NULL, blink_padding_pre_ms = NULL, blink_padding_post_ms = NULL, pupil_min_mm = NULL, pupil_max_mm = NULL, pupil_speed_mad_k = NULL, binocular_mad_k = NULL, max_physio_outlier_prop = 0.8, flag_speed_outliers = TRUE, flag_binocular_disagreement = TRUE, flag_physiological_outliers = TRUE )
data |
A Gazepoint master table or pupil-processing table. |
pupil_col |
Optional name of the pupil column to clean. If |
left_pupil_col |
Optional left-pupil column. If |
right_pupil_col |
Optional right-pupil column. If |
time_col |
Optional time column. If |
blink_col |
Optional blink column. If |
trackloss_col |
Optional trackloss column. If |
missing_pupil_col |
Optional missing-pupil column. If |
pupil_unit_col |
Optional pupil-unit column. If |
group_cols |
Character vector of grouping columns used for speed
outlier detection and artifact-padding windows. Defaults to
|
registry |
Optional preprocessing registry created by
|
blink_padding_pre_ms |
Padding before bad samples, in milliseconds. If
|
blink_padding_post_ms |
Padding after bad samples, in milliseconds. If
|
pupil_min_mm |
Minimum plausible pupil value when units are millimetres.
If |
pupil_max_mm |
Maximum plausible pupil value when units are millimetres.
If |
pupil_speed_mad_k |
MAD multiplier for pupil-speed outlier detection. If
|
binocular_mad_k |
MAD multiplier for binocular-disagreement detection.
If |
max_physio_outlier_prop |
Maximum allowed proportion of non-missing
millimetre-labelled pupil samples that may be rejected by the physiological
rule before the rule is automatically suppressed. Defaults to |
flag_speed_outliers |
Logical. If |
flag_binocular_disagreement |
Logical. If |
flag_physiological_outliers |
Logical. If |
A tibble containing the original data plus pupil-artifact columns.
## Not run: registry <- create_gazepoint_preprocessing_registry() artifact_pupil <- flag_gazepoint_pupil_artifacts( master, registry = registry ) dplyr::count(artifact_pupil, pupil_artifact_reason) ## End(Not run)## Not run: registry <- create_gazepoint_preprocessing_registry() artifact_pupil <- flag_gazepoint_pupil_artifacts( master, registry = registry ) dplyr::count(artifact_pupil, pupil_artifact_reason) ## End(Not run)
Apply a rolling Hampel filter to a Gazepoint pupil column. The helper computes
a rolling median and median absolute deviation (MAD) within a centred sample
window, then flags pupil samples whose absolute deviation from the local
median exceeds k * MAD.
flag_gazepoint_pupil_hampel( data, pupil_col, time_col = NULL, grouping_cols = NULL, window_size_samples = 7L, k = 3, min_valid_samples = 3L, scale_mad = 1.4826, flag_col = "pupil_hampel_outlier", median_col = "pupil_hampel_median", mad_col = "pupil_hampel_mad", threshold_col = "pupil_hampel_threshold", corrected_col = NULL, status_col = "pupil_hampel_status", overwrite = FALSE, name = "gazepoint_pupil_hampel" )flag_gazepoint_pupil_hampel( data, pupil_col, time_col = NULL, grouping_cols = NULL, window_size_samples = 7L, k = 3, min_valid_samples = 3L, scale_mad = 1.4826, flag_col = "pupil_hampel_outlier", median_col = "pupil_hampel_median", mad_col = "pupil_hampel_mad", threshold_col = "pupil_hampel_threshold", corrected_col = NULL, status_col = "pupil_hampel_status", overwrite = FALSE, name = "gazepoint_pupil_hampel" )
data |
A data frame containing pupil observations. |
pupil_col |
Pupil column to screen. |
time_col |
Optional time column used to order samples within groups. |
grouping_cols |
Optional grouping columns, for example participant and trial. |
window_size_samples |
Odd integer rolling-window size in samples. |
k |
Hampel threshold multiplier. |
min_valid_samples |
Minimum finite pupil samples required inside a rolling window. |
scale_mad |
Scaling factor applied to MAD. The default |
flag_col |
Name of the logical Hampel-flag output column. |
median_col |
Name of the rolling median output column. |
mad_col |
Name of the rolling MAD output column. |
threshold_col |
Name of the rolling threshold output column. |
corrected_col |
Optional name of a corrected pupil column. If supplied, flagged samples are replaced with the local rolling median. |
status_col |
Name of the row-level Hampel status column. |
overwrite |
Logical. If |
name |
Character label stored in object attributes. |
This helper is intended as an optional sensitivity/artifact-flagging branch. It complements existing pupil artifact checks and should not automatically replace confirmatory preprocessing decisions.
A tibble with Hampel-filter columns added. The object has class
gp3_pupil_hampel_flags.
Identify grouped AOI sequences that are unusually short, unusually long, have high missingness, or contain very few unique AOI states. The function is intended as a lightweight quality-control helper rather than a definitive exclusion rule.
flag_gazepoint_sequence_anomalies( data, aoi_col, group_cols, time_col = NULL, min_length = 2, max_length = NULL, max_missing_prop = 0.5, z_threshold = 3, min_unique_aoi = 1 )flag_gazepoint_sequence_anomalies( data, aoi_col, group_cols, time_col = NULL, min_length = 2, max_length = NULL, max_missing_prop = 0.5, z_threshold = 3, min_unique_aoi = 1 )
data |
A data frame containing AOI observations. |
aoi_col |
Name of the AOI column. |
group_cols |
Columns defining each sequence. |
time_col |
Optional time/order column. |
min_length |
Minimum acceptable non-missing sequence length. |
max_length |
Optional maximum acceptable non-missing sequence length. |
max_missing_prop |
Maximum acceptable missing AOI proportion. |
z_threshold |
Absolute z-score threshold for unusual sequence length. |
min_unique_aoi |
Minimum number of unique AOI labels expected. |
A data frame with sequence diagnostics and anomaly flags.
Combines tracking-quality and sampling-rate summaries and flags rows with low gaze validity, low pupil validity, abnormal sampling rate, or short duration.
flag_tracking_quality( quality, sampling, by = c("USER_FILE", "MEDIA_ID"), min_gaze_valid_pct = 70, min_pupil_valid_pct = 70, expected_hz = 60, hz_tolerance = 5, min_duration_sec = NULL )flag_tracking_quality( quality, sampling, by = c("USER_FILE", "MEDIA_ID"), min_gaze_valid_pct = 70, min_pupil_valid_pct = 70, expected_hz = 60, hz_tolerance = 5, min_duration_sec = NULL )
quality |
Tracking-quality table from |
sampling |
Sampling-rate table from |
by |
Columns used to join |
min_gaze_valid_pct |
Minimum acceptable FPOGV validity percentage. |
min_pupil_valid_pct |
Minimum acceptable pupil validity percentage. |
expected_hz |
Expected sampling rate. |
hz_tolerance |
Allowed deviation from the expected sampling rate. |
min_duration_sec |
Minimum acceptable recording duration in seconds. |
A tibble with quality, sampling, flag columns, and an overall review flag.
Thin Gazepoint-specific convenience wrappers around the vendor-neutral eyeprocess survival engine. Scientific event/censoring logic, model fitting, diagnostics, sensitivity semantics, and reporting are not duplicated in gp3tools.
prepare_gazepoint_survival_data(trials, events = NULL, ...) run_gazepoint_latency_analysis( trials, events = NULL, target_aoi, formula, participant_col = "participant_id", cox_structure = NULL, aft_distribution = NULL, km_group = NULL, ... )prepare_gazepoint_survival_data(trials, events = NULL, ...) run_gazepoint_latency_analysis( trials, events = NULL, target_aoi, formula, participant_col = "participant_id", cox_structure = NULL, aft_distribution = NULL, km_group = NULL, ... )
trials |
Trial-window table accepted by eyeprocess. |
events |
Fixation/AOI-visit/event table accepted by eyeprocess. |
target_aoi |
Target AOI identifier. |
formula |
Model right-hand-side formula/string accepted by eyeprocess. |
participant_col |
Participant identifier column. |
cox_structure |
Required repeated-participant Cox estimator: |
aft_distribution |
Required AFT family: |
km_group |
Optional grouping column for Kaplan-Meier estimation. |
... |
Preparation arguments forwarded unchanged to eyeprocess::prepare_gaze_survival_data(). |
A target event absent from a complete usable trial can be right-censored. Missing or unusable gaze is not automatically converted to censoring. The end-to-end wrapper requires the Cox repeated-observation structure and the AFT family to be chosen explicitly and records both choices in the returned specification.
prepare_gazepoint_survival_data() returns the canonical survival-ready data.frame from eyeprocess. run_gazepoint_latency_analysis() returns a gazepoint_survival_analysis list with data, validation, censoring, Kaplan-Meier output, Cox/AFT models, diagnostics, comparison, reporting, and the explicit specification.
Thin Gazepoint convenience adapters for the vendor-neutral AOI perturbation and uncertainty framework in eyeprocess. The adapters standardize Gazepoint coordinate columns and explicit coordinate units, preserve adapter provenance, and delegate geometry validation, perturbation, reassignment, feature recomputation, model propagation, summaries, and plotting to eyeprocess.
audit_gazepoint_aoi_uncertainty( data, aoi_geometry, gaze_x_col = NULL, gaze_y_col = NULL, geometry_aoi_col = NULL, coordinate_unit = c("px", "normalized"), screen_width_px = NULL, screen_height_px = NULL ) run_gazepoint_aoi_sensitivity( data, aoi_geometry, grid = NULL, gaze_x_col = NULL, gaze_y_col = NULL, geometry_aoi_col = NULL, coordinate_unit = c("px", "normalized"), perturbation_unit = c("px", "deg"), dilations = NULL, erosions = NULL, translations_x = NULL, translations_y = NULL, translations_xy = NULL, jitters = NULL, anisotropic = NULL, screen_width_px = NULL, screen_height_px = NULL, viewing_distance = NULL, physical_screen_size = NULL, observation_id_col = NULL, participant_col = NULL, trial_col = NULL, duration_col = NULL, time_col = NULL, observation_level = c("fixation", "sample"), overlap_policy = c("ambiguous", "all", "error"), model_callback = NULL, preprocessing_specification = NULL, event_detector = NULL, quality_rules = NULL, model_specification = NULL, seed = 20260918L, boundary_policy = c("warn", "clip", "error", "allow") ) plot_gazepoint_aoi_sensitivity( x, type = c("perturbations", "assignment", "coefficient", "surface"), ... )audit_gazepoint_aoi_uncertainty( data, aoi_geometry, gaze_x_col = NULL, gaze_y_col = NULL, geometry_aoi_col = NULL, coordinate_unit = c("px", "normalized"), screen_width_px = NULL, screen_height_px = NULL ) run_gazepoint_aoi_sensitivity( data, aoi_geometry, grid = NULL, gaze_x_col = NULL, gaze_y_col = NULL, geometry_aoi_col = NULL, coordinate_unit = c("px", "normalized"), perturbation_unit = c("px", "deg"), dilations = NULL, erosions = NULL, translations_x = NULL, translations_y = NULL, translations_xy = NULL, jitters = NULL, anisotropic = NULL, screen_width_px = NULL, screen_height_px = NULL, viewing_distance = NULL, physical_screen_size = NULL, observation_id_col = NULL, participant_col = NULL, trial_col = NULL, duration_col = NULL, time_col = NULL, observation_level = c("fixation", "sample"), overlap_policy = c("ambiguous", "all", "error"), model_callback = NULL, preprocessing_specification = NULL, event_detector = NULL, quality_rules = NULL, model_specification = NULL, seed = 20260918L, boundary_policy = c("warn", "clip", "error", "allow") ) plot_gazepoint_aoi_sensitivity( x, type = c("perturbations", "assignment", "coefficient", "surface"), ... )
data |
Gazepoint sample- or fixation-level data. |
aoi_geometry |
Gazepoint rectangular geometry or an eyeprocess-compatible AOI table. |
grid |
Optional AOI perturbation grid created by eyeprocess. |
gaze_x_col, gaze_y_col
|
Optional source gaze coordinate columns. |
geometry_aoi_col |
Optional AOI identifier column for Gazepoint geometry. |
coordinate_unit |
Explicit source coordinate unit, either pixels or normalized coordinates. |
perturbation_unit |
Unit used for perturbation values, either pixels or degrees of visual angle. |
dilations, erosions, translations_x, translations_y, translations_xy, jitters, anisotropic
|
Perturbation values forwarded unchanged to eyeprocess when a grid is not supplied. 'translations_xy' contains explicit horizontal/vertical translation pairs. |
screen_width_px, screen_height_px
|
Display dimensions in pixels. Required for conversion of normalized coordinates. |
viewing_distance |
Viewing distance required for degree-based perturbations unless the supplied core grid already contains conversion metadata. |
physical_screen_size |
Physical screen width and height in the same unit as viewing distance. |
observation_id_col, participant_col, trial_col, duration_col, time_col
|
Optional columns forwarded to the core sensitivity workflow. |
observation_level |
Explicit source level, fixation or sample, forwarded unchanged to eyeprocess. |
overlap_policy |
Explicit overlap handling. The default preserves ambiguity. |
model_callback |
Optional fixed statistical-model callback forwarded unchanged to eyeprocess. |
preprocessing_specification, event_detector, quality_rules, model_specification
|
Provenance fields forwarded to eyeprocess. |
seed |
Reproducible seed for jitter branches. |
boundary_policy |
Explicit screen-boundary policy. |
x |
A gp3_aoi_sensitivity object. |
type |
Delegated plot family. |
... |
Arguments passed to the selected eyeprocess plotting function. |
The wrappers do not contain the scientific AOI perturbation or stability
algorithms. They resolve the corresponding exported eyeprocess functions at
runtime and preserve the returned core result unchanged inside
core_result.
Normalized Gazepoint coordinates are never treated as pixels implicitly. Positive screen dimensions must be supplied before conversion. Degree-based perturbations additionally require viewing geometry through the eyeprocess core.
The adapter deliberately does not provide a first-match default for overlap; the default core policy is explicit ambiguity.
audit_gazepoint_aoi_uncertainty() returns a
gp3_aoi_uncertainty_audit. run_gazepoint_aoi_sensitivity()
returns a gp3_aoi_sensitivity containing the untouched eyeprocess core
result plus Gazepoint adapter settings. The plotting helper returns its input
invisibly after delegating the plot.
## Not run: # Requires a current eyeprocess development/release build with # AOI perturbation functions. result <- run_gazepoint_aoi_sensitivity( data = gaze, aoi_geometry = aois, gaze_x_col = "FPOGX", gaze_y_col = "FPOGY", coordinate_unit = "normalized", perturbation_unit = "deg", observation_level = "sample", dilations = c(0.25, 0.5, 1), erosions = 0.25, translations_xy = list(c(0.25, -0.25)), screen_width_px = 1920, screen_height_px = 1080, viewing_distance = 60, physical_screen_size = c(53.1, 29.9) ) plot_gazepoint_aoi_sensitivity(result, "assignment") ## End(Not run)## Not run: # Requires a current eyeprocess development/release build with # AOI perturbation functions. result <- run_gazepoint_aoi_sensitivity( data = gaze, aoi_geometry = aois, gaze_x_col = "FPOGX", gaze_y_col = "FPOGY", coordinate_unit = "normalized", perturbation_unit = "deg", observation_level = "sample", dilations = c(0.25, 0.5, 1), erosions = 0.25, translations_xy = list(c(0.25, -0.25)), screen_width_px = 1920, screen_height_px = 1080, viewing_distance = 60, physical_screen_size = c(53.1, 29.9) ) plot_gazepoint_aoi_sensitivity(result, "assignment") ## End(Not run)
A lightweight synthetic AOI geometry table for AOI-verification examples. Coordinates are normalised to a 0–1 screen coordinate system.
gazepoint_example_aoi_geometrygazepoint_example_aoi_geometry
A tibble with one row per stimulus and AOI, including:
Synthetic stimulus identifier.
Synthetic AOI label.
Normalised rectangular AOI boundaries.
data(gazepoint_example_aoi_geometry) gazepoint_example_aoi_geometrydata(gazepoint_example_aoi_geometry) gazepoint_example_aoi_geometry
A lightweight synthetic AOI-window summary table created from
gazepoint_example_master. It can be used in examples for AOI-window
denominator checks, GLMM preparation, and AOI-window modelling.
gazepoint_example_aoi_windowsgazepoint_example_aoi_windows
A tibble with one row per participant, stimulus/trial, and AOI time window.
data(gazepoint_example_aoi_windows) head(gazepoint_example_aoi_windows)data(gazepoint_example_aoi_windows) head(gazepoint_example_aoi_windows)
A lightweight synthetic Gazepoint-style fixation table for examples, tests, README workflows, and vignettes. The data are artificial and are not from a real participant study.
gazepoint_example_fixationsgazepoint_example_fixations
A tibble with fixation-level rows and columns including:
Synthetic participant/file identifier.
Synthetic participant identifier.
Synthetic stimulus identifier.
Synthetic trial identifier.
Synthetic experimental condition.
Synthetic fixation identifier.
Synthetic fixation start time.
Synthetic fixation duration.
Synthetic fixation coordinates.
Synthetic fixation validity flag.
Synthetic AOI label.
data(gazepoint_example_fixations) head(gazepoint_example_fixations)data(gazepoint_example_fixations) head(gazepoint_example_fixations)
A lightweight synthetic Gazepoint-style sample-level master table for examples, tests, README workflows, and vignettes. The data are artificial and are not from a real participant study.
gazepoint_example_mastergazepoint_example_master
A tibble with sample-level rows and columns including:
Synthetic participant identifier.
Gazepoint-style participant/file identifier.
Synthetic stimulus identifier.
Synthetic trial identifier.
Synthetic experimental condition.
Sample time in milliseconds.
Normalised gaze coordinates.
Synthetic pupil value.
Logical gaze/pupil validity flag.
Logical synthetic pupil-artifact flag.
Synthetic AOI state.
Synthetic fixation and saccade indicators.
Synthetic event marker.
data(gazepoint_example_master) head(gazepoint_example_master)data(gazepoint_example_master) head(gazepoint_example_master)
A lightweight synthetic pupil-window summary table created from
gazepoint_example_master. It can be used in examples for pupil-window
model-data preparation and confirmatory pupil-window modelling.
gazepoint_example_pupil_windowsgazepoint_example_pupil_windows
A tibble with one row per participant, stimulus/trial, condition, and pupil time window.
data(gazepoint_example_pupil_windows) head(gazepoint_example_pupil_windows)data(gazepoint_example_pupil_windows) head(gazepoint_example_pupil_windows)
Thin Gazepoint-facing convenience wrappers for the vendor-neutral spatial and sampling quality implementation in the suggested eyeprocess package. gp3tools resolves source columns and available geometry/metadata but does not duplicate accuracy, precision, BCEA, sampling, jitter, or data-loss formulas.
summarise_gazepoint_spatial_quality( data, x_col = NULL, y_col = NULL, time_col = NULL, target_x_col = NULL, target_y_col = NULL, coordinate_unit = c("auto", "normalized", "pixels", "degrees"), output_unit = NULL, geometry = NULL, time_unit = c("auto", "ms", "s", "us", "ns"), level = c("dataset", "sample", "participant", "session", "trial", "file"), by = NULL, probability = 0.68, max_gap_ms = NULL ) create_gazepoint_quality_report( data, x_col = NULL, y_col = NULL, time_col = NULL, target_x_col = NULL, target_y_col = NULL, valid_col = NULL, missing_reason_col = NULL, participant_col = NULL, session_col = NULL, trial_col = NULL, file_col = NULL, coordinate_unit = c("auto", "normalized", "pixels", "degrees"), output_unit = NULL, geometry = NULL, time_unit = c("auto", "ms", "s", "us", "ns"), level = c("dataset", "sample", "participant", "session", "trial", "file"), by = NULL, nominal_sampling_hz = 60, bcea_probability = 0.68, max_gap_ms = NULL, thresholds = NULL, preprocessing_spec = NULL, event_detector = NULL, aoi_specification = NULL, quality_rules = NULL, model_specification = NULL ) plot_gazepoint_quality_dashboard(x, ...) report_gazepoint_quality(x, digits = 3L, ...)summarise_gazepoint_spatial_quality( data, x_col = NULL, y_col = NULL, time_col = NULL, target_x_col = NULL, target_y_col = NULL, coordinate_unit = c("auto", "normalized", "pixels", "degrees"), output_unit = NULL, geometry = NULL, time_unit = c("auto", "ms", "s", "us", "ns"), level = c("dataset", "sample", "participant", "session", "trial", "file"), by = NULL, probability = 0.68, max_gap_ms = NULL ) create_gazepoint_quality_report( data, x_col = NULL, y_col = NULL, time_col = NULL, target_x_col = NULL, target_y_col = NULL, valid_col = NULL, missing_reason_col = NULL, participant_col = NULL, session_col = NULL, trial_col = NULL, file_col = NULL, coordinate_unit = c("auto", "normalized", "pixels", "degrees"), output_unit = NULL, geometry = NULL, time_unit = c("auto", "ms", "s", "us", "ns"), level = c("dataset", "sample", "participant", "session", "trial", "file"), by = NULL, nominal_sampling_hz = 60, bcea_probability = 0.68, max_gap_ms = NULL, thresholds = NULL, preprocessing_spec = NULL, event_detector = NULL, aoi_specification = NULL, quality_rules = NULL, model_specification = NULL ) plot_gazepoint_quality_dashboard(x, ...) report_gazepoint_quality(x, digits = 3L, ...)
data |
A non-empty sample-level Gazepoint data frame. |
x_col, y_col, time_col
|
Optional explicit source gaze/timestamp columns. |
target_x_col, target_y_col
|
Known validation-target coordinate columns. |
valid_col |
Optional gaze-validity column. |
missing_reason_col |
Optional reason-specific loss column. |
participant_col, session_col, trial_col, file_col
|
Optional source identifier columns. |
coordinate_unit |
Input coordinate unit. Auto inference is restricted to explicit metadata and recognized vendor-native coordinate columns. |
output_unit |
Optional explicit output unit. |
geometry |
Optional screen/viewing geometry. |
time_unit |
Timestamp unit. |
level |
Requested aggregation level when by is not supplied. |
by |
Optional explicit grouping columns. |
probability, bcea_probability
|
Explicit BCEA probability level. |
max_gap_ms |
Optional maximum interval for adjacent RMS-S2S pairs. |
nominal_sampling_hz |
Optional nominal hardware frequency. |
thresholds |
Study-specific review thresholds; never automatic exclusions. |
preprocessing_spec, event_detector, aoi_specification, quality_rules, model_specification
|
Optional provenance fields forwarded to eyeprocess. |
x |
A gaze_quality_report or raw Gazepoint data. |
digits |
Digits in compact reporting text. |
... |
Arguments forwarded to create_gazepoint_quality_report() when raw data are supplied. |
Gazepoint BPOG/FPOG/LPOG/RPOG coordinates are recognized as normalized coordinates. TIME is recognized as seconds and MSTIMER as milliseconds. Generic coordinate columns do not trigger range-based unit guessing: users must declare the unit explicitly unless an unambiguous coordinate_unit column is available.
When complete screen pixel dimensions, physical dimensions, and viewing distance are available, they can be forwarded to eyeprocess for an explicitly requested coordinate conversion. Incomplete geometry is never silently completed.
For sample-level grouping, gp3tools creates a deterministic source-row identifier. Single-sample rows can be useful for availability or target-error auditing, but single-sample SD/BCEA and successive-sample precision should not be interpreted as stable-target precision evidence.
The wrappers require a compatible development version of eyeprocess. The scientific formulas remain implemented only in that vendor-neutral core.
The summary and report wrappers return the corresponding eyeprocess data frames with a gazepoint_quality_adapter provenance attribute. The plotting wrapper returns the eyeprocess dashboard object. The reporting wrapper returns character text.
## Not run: q <- create_gazepoint_quality_report( gazepoint_samples, target_x_col = "target_x", target_y_col = "target_y", level = "trial", nominal_sampling_hz = 60 ) report_gazepoint_quality(q) ## End(Not run)## Not run: q <- create_gazepoint_quality_report( gazepoint_samples, target_x_col = "target_x", target_y_col = "target_y", level = "trial", nominal_sampling_hz = 60 ) report_gazepoint_quality(q) ## End(Not run)
Documents the package policy that British English summarise_* names are
canonical for new summary helpers. Existing American English
summarize_* exports remain available for backward compatibility.
gp3tools_naming_policy()gp3tools_naming_policy()
A list describing the policy and migration rules.
Returns conservative, explicit limits for elapsed time, approximate R-heap growth, and scaling behaviour. The limits are intended as regression gates, not as hardware-independent claims about absolute package speed.
gp3tools_performance_limits()gp3tools_performance_limits()
A data frame with one row per benchmarked operation.
Rescales gaze coordinates from one screen or stimulus resolution to another. This is a deterministic coordinate transformation for harmonizing exports before plotting, AOI checks, or descriptive summaries. It does not recalibrate gaze data or correct measurement error.
harmonize_gazepoint_screen_coordinates( data, x_col, y_col, from_width, from_height, to_width, to_height, output_x_col = "gaze_x_harmonized", output_y_col = "gaze_y_harmonized", keep_original = TRUE )harmonize_gazepoint_screen_coordinates( data, x_col, y_col, from_width, from_height, to_width, to_height, output_x_col = "gaze_x_harmonized", output_y_col = "gaze_y_harmonized", keep_original = TRUE )
data |
A data frame. |
x_col, y_col
|
Character names of source coordinate columns. |
from_width, from_height
|
Original screen or stimulus dimensions. |
to_width, to_height
|
Target screen or stimulus dimensions. |
output_x_col, output_y_col
|
Names of the rescaled output columns. |
keep_original |
If |
A copy of data with harmonized coordinate columns.
x <- data.frame(gaze_x = c(0, 960, 1920), gaze_y = c(0, 540, 1080)) harmonize_gazepoint_screen_coordinates( x, x_col = "gaze_x", y_col = "gaze_y", from_width = 1920, from_height = 1080, to_width = 1280, to_height = 720 )x <- data.frame(gaze_x = c(0, 960, 1920), gaze_y = c(0, 540, 1080)) harmonize_gazepoint_screen_coordinates( x, x_col = "gaze_x", y_col = "gaze_y", from_width = 1920, from_height = 1080, to_width = 1280, to_height = 720 )
Performs within-subject/trial Gaussian-process interpolation using a squared exponential kernel. This helper is intended for short missing segments after blink detection, not for reconstructing long unusable trials.
impute_gazepoint_pupil_gp( data, pupil, time, subject = NULL, trial = NULL, length_scale = NULL, noise = 1e-04, max_train = 300, output = "pupil_gp_imputed", flag = "pupil_was_gp_imputed" )impute_gazepoint_pupil_gp( data, pupil, time, subject = NULL, trial = NULL, length_scale = NULL, noise = 1e-04, max_train = 300, output = "pupil_gp_imputed", flag = "pupil_was_gp_imputed" )
data |
A data frame. |
pupil |
Pupil column. |
time |
Time column. |
subject |
Optional subject column. |
trial |
Optional trial column. |
length_scale |
Kernel length scale in the same unit as |
noise |
Observation noise variance. |
max_train |
Maximum number of observed samples used per sequence. |
output |
Name of the imputed output column. |
flag |
Name of the logical imputation flag column. |
Data frame with imputed pupil values and an imputation flag.
Inspect Gazepoint columns
inspect_gazepoint_columns(x)inspect_gazepoint_columns(x)
x |
A data frame or path to a Gazepoint CSV export. |
A tibble describing column names, semantic groups, and missingness.
Masks samples inside blink intervals and interpolates only bounded internal gaps. Long or edge gaps remain missing.
interpolate_gazepoint_blinks( master_df, blink_df, pupil_cols = NULL, id_col = "USER_ID", group_cols = NULL, ts_col = "TIME", start_col = "start_time", end_col = "end_time", method = c("linear", "spline"), max_gap_ms = 500, suffix = "_blink_interp", keep_mask = TRUE, time_unit = c("auto", "seconds", "milliseconds") )interpolate_gazepoint_blinks( master_df, blink_df, pupil_cols = NULL, id_col = "USER_ID", group_cols = NULL, ts_col = "TIME", start_col = "start_time", end_col = "end_time", method = c("linear", "spline"), max_gap_ms = 500, suffix = "_blink_interp", keep_mask = TRUE, time_unit = c("auto", "seconds", "milliseconds") )
master_df |
A sample-level data frame. |
blink_df |
Blink intervals returned by |
pupil_cols |
Pupil columns to interpolate. When |
id_col |
Participant identifier shared by both inputs. |
group_cols |
Optional additional grouping columns shared by both inputs. |
ts_col |
Timestamp column in |
start_col, end_col
|
Blink interval boundaries. |
method |
Interpolation method. |
max_gap_ms |
Maximum blink duration eligible for interpolation. |
suffix |
Suffix used for interpolated columns. |
keep_mask |
Add |
time_unit |
Timestamp unit. |
The sample table with interpolated pupil columns.
pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.09, by = 0.01), mean_pupil = c(3, 3.1, 3.2, NA, NA, 3.3, 3.4, 3.5, 3.6, 3.7) ) blinks <- detect_gazepoint_blinks( pupil, min_duration = 10 ) interpolate_gazepoint_blinks(pupil, blinks)pupil <- data.frame( USER_ID = "P01", TIME = seq(0, 0.09, by = 0.01), mean_pupil = c(3, 3.1, 3.2, NA, NA, 3.3, 3.4, 3.5, 3.6, 3.7) ) blinks <- detect_gazepoint_blinks( pupil, min_duration = 10 ) interpolate_gazepoint_blinks(pupil, blinks)
Performs linear interpolation over short internal gaps in Gazepoint pupil
data. This function is intended to be used after flag_gazepoint_pupil() or
flag_gazepoint_pupil_artifacts(). When available, pupil_clean is used as
the preferred default input column, followed by pupil_for_preprocessing.
Leading gaps, trailing gaps, long gaps, non-finite time values, and groups
with too few valid pupil samples are not interpolated.
interpolate_gazepoint_pupil( data, pupil_col = NULL, time_col = NULL, group_cols = c("subject", "media_id"), max_gap_ms = 150, max_gap_samples = Inf, min_valid_points = 2 )interpolate_gazepoint_pupil( data, pupil_col = NULL, time_col = NULL, group_cols = c("subject", "media_id"), max_gap_ms = 150, max_gap_samples = Inf, min_valid_points = 2 )
data |
A Gazepoint master table, preferably after |
pupil_col |
Optional name of the pupil column to interpolate. If |
time_col |
Optional name of the time column. If |
group_cols |
Character vector of grouping columns used to keep
interpolation within independent time series. Defaults to
|
max_gap_ms |
Maximum duration, in milliseconds, of a gap that may be
interpolated. The duration is measured between the valid samples immediately
before and after the gap. Defaults to |
max_gap_samples |
Maximum number of consecutive missing samples that may
be interpolated. Defaults to |
min_valid_points |
Minimum number of valid samples required within a
group before interpolation is attempted. Defaults to |
A tibble containing the original data plus interpolation columns.
## Not run: flagged <- flag_gazepoint_pupil(master) interpolated <- interpolate_gazepoint_pupil(flagged) dplyr::count(interpolated, pupil_interpolation_status) artifact_flagged <- flag_gazepoint_pupil_artifacts(master) artifact_interpolated <- interpolate_gazepoint_pupil(artifact_flagged) dplyr::count(artifact_interpolated, pupil_interpolation_status) ## End(Not run)## Not run: flagged <- flag_gazepoint_pupil(master) interpolated <- interpolate_gazepoint_pupil(flagged) dplyr::count(interpolated, pupil_interpolation_status) artifact_flagged <- flag_gazepoint_pupil_artifacts(master) artifact_interpolated <- interpolate_gazepoint_pupil(artifact_flagged) dplyr::count(artifact_interpolated, pupil_interpolation_status) ## End(Not run)
Apply shape-preserving piecewise cubic Hermite interpolation to short internal gaps in Gazepoint pupil time series. This helper is intended as a sensitivity branch alongside the default linear interpolation workflow. It does not overwrite the original pupil column.
interpolate_gazepoint_pupil_pchip( data, pupil_col = NULL, time_col = NULL, grouping_cols = NULL, max_gap_ms = 500, max_gap_samples = NULL, min_valid_points = 3, output_col = "pupil_interpolated_pchip", flag_col = "interpolated_pupil_pchip", status_col = "pchip_interpolation_status" )interpolate_gazepoint_pupil_pchip( data, pupil_col = NULL, time_col = NULL, grouping_cols = NULL, max_gap_ms = 500, max_gap_samples = NULL, min_valid_points = 3, output_col = "pupil_interpolated_pchip", flag_col = "interpolated_pupil_pchip", status_col = "pchip_interpolation_status" )
data |
A data frame containing pupil time-series data. |
pupil_col |
Name of the pupil column to interpolate. If |
time_col |
Name of the time column. If |
grouping_cols |
Optional character vector of grouping columns. If |
max_gap_ms |
Maximum internal gap duration, in milliseconds, eligible for
interpolation. If both |
max_gap_samples |
Maximum number of consecutive missing samples eligible for interpolation. |
min_valid_points |
Minimum number of valid non-missing points required within a group before PCHIP interpolation is attempted. |
output_col |
Name of the interpolated pupil output column. |
flag_col |
Name of the logical flag column indicating samples filled by PCHIP interpolation. |
status_col |
Name of the interpolation-status column. |
A tibble with PCHIP interpolation columns added.
Provide a minimal optional Shiny dashboard launcher for inspecting a data
frame. With launch = FALSE, the function returns a dashboard
specification without requiring Shiny.
launch_gazepoint_qc_dashboard( data = NULL, title = "gp3tools QC dashboard", launch = FALSE )launch_gazepoint_qc_dashboard( data = NULL, title = "gp3tools QC dashboard", launch = FALSE )
data |
Optional data frame to inspect. |
title |
Dashboard title. |
launch |
Should a Shiny app be launched? |
A dashboard specification, or a Shiny app object when launched.
Calculate mean binocular pupil size
mean_gazepoint_pupil( master_df, lp_col = "LPupil", rp_col = "RPupil", output_col = "mean_pupil", min_eyes = 1 )mean_gazepoint_pupil( master_df, lp_col = "LPupil", rp_col = "RPupil", output_col = "mean_pupil", min_eyes = 1 )
master_df |
A sample-level pupil data frame. |
lp_col, rp_col
|
Left- and right-pupil columns. |
output_col |
Name of the generated column. |
min_eyes |
Minimum number of finite eye measurements required. |
The input data with a binocular mean-pupil column.
pupil <- data.frame( LPupil = c(3, NA, 4), RPupil = c(3.2, 3.5, NA) ) mean_gazepoint_pupil(pupil)pupil <- data.frame( LPupil = c(3, NA, 4), RPupil = c(3.2, 3.5, NA) ) mean_gazepoint_pupil(pupil)
Plot observed AOI target-looking proportions and fitted GAMM trajectories
from a model returned by fit_gazepoint_aoi_gamm().
plot_gazepoint_aoi_gamm( fit, n_time_points = 100, include_observed = TRUE, include_fitted = TRUE, show_ci = TRUE, ci_level = 0.95, exclude_random_effects = TRUE, observed_summary = c("pooled"), point_size = 1.8, point_alpha = 0.65, line_width = 0.8, ribbon_alpha = 0.15, title = NULL, subtitle = NULL, x_label = "Time (ms)", y_label = "Target AOI looking probability", y_limits = c(0, 1) )plot_gazepoint_aoi_gamm( fit, n_time_points = 100, include_observed = TRUE, include_fitted = TRUE, show_ci = TRUE, ci_level = 0.95, exclude_random_effects = TRUE, observed_summary = c("pooled"), point_size = 1.8, point_alpha = 0.65, line_width = 0.8, ribbon_alpha = 0.15, title = NULL, subtitle = NULL, x_label = "Time (ms)", y_label = "Target AOI looking probability", y_limits = c(0, 1) )
fit |
A result object returned by |
n_time_points |
Number of time points used for the fitted prediction
grid. If |
include_observed |
Logical. If |
include_fitted |
Logical. If |
show_ci |
Logical. If |
ci_level |
Confidence level for fitted intervals. |
exclude_random_effects |
Logical. If |
observed_summary |
Character. Currently |
point_size |
Size of observed points. |
point_alpha |
Transparency for observed points. |
line_width |
Width of fitted trajectory lines. |
ribbon_alpha |
Transparency for fitted confidence ribbons. |
title |
Optional plot title. |
subtitle |
Optional plot subtitle. |
x_label |
X-axis label. |
y_label |
Y-axis label. |
y_limits |
Optional numeric vector of length 2 for y-axis limits. |
The plot supports single-condition fallback models and multi-condition AOI time-course GAMMs. By default, fitted trajectories are population-level predictions with subject random-effect smooths excluded.
A ggplot object with prediction and observed data stored as
attributes.
Creates a scarf-style timeline plot showing the current AOI over time for each subject, trial, or user-defined row grouping.
plot_gazepoint_aoi_timeline( data, aoi_col, time_col, y_col = NULL, subject_col = NULL, trial_col = NULL, group_cols = NULL, include_missing = FALSE, missing_label = "missing", sample_width = NULL, title = NULL, x_label = "Time", y_label = NULL, aoi_label = "AOI" )plot_gazepoint_aoi_timeline( data, aoi_col, time_col, y_col = NULL, subject_col = NULL, trial_col = NULL, group_cols = NULL, include_missing = FALSE, missing_label = "missing", sample_width = NULL, title = NULL, x_label = "Time", y_label = NULL, aoi_label = "AOI" )
data |
A data frame containing AOI observations. |
aoi_col |
Character scalar. Column containing AOI labels. |
time_col |
Character scalar. Column containing time values. |
y_col |
Optional character scalar used directly as the y-axis row. |
subject_col |
Optional subject column used to construct the y-axis row. |
trial_col |
Optional trial column used to construct the y-axis row. |
group_cols |
Optional character vector used to construct the y-axis row
when |
include_missing |
Logical. If |
missing_label |
Character scalar used when |
sample_width |
Optional numeric tile width. If omitted, a median time difference is estimated. |
title |
Optional plot title. |
x_label |
X-axis label. |
y_label |
Optional y-axis label. |
aoi_label |
Fill legend label. |
A ggplot object.
dat <- data.frame( subject = rep(c("S01", "S02"), each = 4), trial = "T01", time = rep(1:4, 2), AOI = c("A", "A", "B", "C", "A", "B", "B", "C") ) plot_gazepoint_aoi_timeline( dat, aoi_col = "AOI", time_col = "time", subject_col = "subject", trial_col = "trial" )dat <- data.frame( subject = rep(c("S01", "S02"), each = 4), trial = "T01", time = rep(1:4, 2), AOI = c("A", "A", "B", "C", "A", "B", "B", "C") ) plot_gazepoint_aoi_timeline( dat, aoi_col = "AOI", time_col = "time", subject_col = "subject", trial_col = "trial" )
Plot a heatmap of AOI transition counts or probabilities from the output of
compute_gazepoint_aoi_transition_matrix() or from a compatible long-form
transition table.
plot_gazepoint_aoi_transition_matrix( transitions, value = c("prob", "n"), state_order = NULL, by_cols = NULL, include_zero = TRUE, show_labels = TRUE, label_digits = 2, label_size = 3, facet = TRUE, title = NULL )plot_gazepoint_aoi_transition_matrix( transitions, value = c("prob", "n"), state_order = NULL, by_cols = NULL, include_zero = TRUE, show_labels = TRUE, label_digits = 2, label_size = 3, facet = TRUE, title = NULL )
transitions |
A |
value |
Which value to plot: |
state_order |
Optional character vector defining the AOI order on the heatmap axes. |
by_cols |
Optional character vector of grouping columns to facet by. If
|
include_zero |
Logical. If |
show_labels |
Logical. If |
label_digits |
Number of digits used when labelling probabilities. |
label_size |
Text size for cell labels. |
facet |
Logical. If |
title |
Optional plot title. |
A ggplot2 plot object.
Create a visual verification plot of AOI rectangles, with optional gaze samples overlaid.
plot_gazepoint_aoi_verification( aoi_geometry, gaze_data = NULL, geometry_aoi_col = NULL, geometry_stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, gaze_x_col = NULL, gaze_y_col = NULL, gaze_stimulus_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), facet_by_stimulus = TRUE, show_labels = TRUE, show_gaze = TRUE, invert_y = TRUE, point_alpha = 0.35, point_size = 1.2, line_width = 0.8, label_size = 3 )plot_gazepoint_aoi_verification( aoi_geometry, gaze_data = NULL, geometry_aoi_col = NULL, geometry_stimulus_col = NULL, x_min_col = NULL, y_min_col = NULL, x_max_col = NULL, y_max_col = NULL, x_col = NULL, y_col = NULL, width_col = NULL, height_col = NULL, gaze_x_col = NULL, gaze_y_col = NULL, gaze_stimulus_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), facet_by_stimulus = TRUE, show_labels = TRUE, show_gaze = TRUE, invert_y = TRUE, point_alpha = 0.35, point_size = 1.2, line_width = 0.8, label_size = 3 )
aoi_geometry |
A data frame containing AOI geometry definitions. |
gaze_data |
Optional data frame containing gaze samples to overlay. |
geometry_aoi_col |
AOI label/name column in |
geometry_stimulus_col |
Optional stimulus/media column in
|
x_min_col |
Optional AOI left/x-min column. |
y_min_col |
Optional AOI top/y-min column. |
x_max_col |
Optional AOI right/x-max column. |
y_max_col |
Optional AOI bottom/y-max column. |
x_col |
Optional AOI left/x column used with |
y_col |
Optional AOI top/y column used with |
width_col |
Optional AOI width column. |
height_col |
Optional AOI height column. |
gaze_x_col |
Optional gaze x-coordinate column. |
gaze_y_col |
Optional gaze y-coordinate column. |
gaze_stimulus_col |
Optional gaze stimulus/media column. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
facet_by_stimulus |
Logical. If |
show_labels |
Logical. If |
show_gaze |
Logical. If |
invert_y |
Logical. If |
point_alpha |
Alpha transparency for gaze points. |
point_size |
Size of gaze points. |
line_width |
Width of AOI rectangle borders. |
label_size |
Size of AOI labels. |
A ggplot object.
Provides a compact plotting interface for binocular traces, agreement, Bland-Altman-style differences, artificial-missingness validation, validation residuals, provenance timelines, reconstruction burden, sensitivity summaries, and reconstructed gap durations. Every non-dashboard call returns a ggplot object that can be further customised.
plot_gazepoint_binocular_diagnostics( x, type = c("trace", "agreement", "bland_altman", "validation", "residuals", "timeline", "burden", "sensitivity", "gaps", "dashboard"), left_col = NULL, right_col = NULL, time_col = NULL, prefix = "gp3_binocular", point_alpha = 0.35, bins = 30L )plot_gazepoint_binocular_diagnostics( x, type = c("trace", "agreement", "bland_altman", "validation", "residuals", "timeline", "burden", "sensitivity", "gaps", "dashboard"), left_col = NULL, right_col = NULL, time_col = NULL, prefix = "gp3_binocular", point_alpha = 0.35, bins = 30L )
x |
A data frame/reconstruction result, or an object produced by
|
type |
Plot type: |
left_col, right_col, time_col
|
Column names for data-frame plots. For reconstruction outputs these are inferred from metadata when omitted. |
prefix |
Reconstruction prefix. |
point_alpha |
Point transparency for dense scatterplots. |
bins |
Histogram bins for |
A ggplot2 object. type = "dashboard" returns a named list of
ggplot objects rather than introducing a layout dependency.
reconstruct_gazepoint_binocular_pupil(),
validate_gazepoint_binocular_reconstruction()
dat <- simulate_gazepoint_pupil_data(n_subjects = 3, n_trials = 2, seed = 31) dat$pupil_left[20:24] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", min_pairs = 20 ) plot_gazepoint_binocular_diagnostics(rec, type = "agreement")dat <- simulate_gazepoint_pupil_data(n_subjects = 3, n_trials = 2, seed = 31) dat$pupil_left[20:24] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", min_pairs = 20 ) plot_gazepoint_binocular_diagnostics(rec, type = "agreement")
Plot the null distribution of maximum cluster statistics from a cluster-permutation result when available.
plot_gazepoint_cluster_null_distribution( result, observed_line = TRUE, title = NULL )plot_gazepoint_cluster_null_distribution( result, observed_line = TRUE, title = NULL )
result |
A result object returned by
|
observed_line |
Should observed cluster statistics be added when available? |
title |
Optional plot title. |
A ggplot object.
plot_gazepoint_cluster_permutation() is a compatibility wrapper around
plot_gazepoint_cluster_results(). It uses the existing validated gp3tools
plotting engine while providing a name aligned with the cluster-permutation
workflow.
plot_gazepoint_cluster_permutation(result, ...)plot_gazepoint_cluster_permutation(result, ...)
result |
A result object returned by
|
... |
Additional arguments passed to
|
A ggplot object.
Create a publication-ready time-course plot from the output of
run_gazepoint_cluster_permutation(). The plot can show the mean condition
difference, the time-wise test statistic, or both. Candidate time bins and
cluster-level significant windows can be highlighted.
plot_gazepoint_cluster_results( result, plot_type = c("both", "difference", "statistic"), alpha = 0.05, significant_only = TRUE, show_clusters = TRUE, show_candidates = TRUE, show_threshold = TRUE, show_zero_line = TRUE, title = NULL, subtitle = NULL, x_label = "Time (ms)", y_label = NULL, line_width = 0.7, point_size = 1.8, cluster_alpha = 0.12 )plot_gazepoint_cluster_results( result, plot_type = c("both", "difference", "statistic"), alpha = 0.05, significant_only = TRUE, show_clusters = TRUE, show_candidates = TRUE, show_threshold = TRUE, show_zero_line = TRUE, title = NULL, subtitle = NULL, x_label = "Time (ms)", y_label = NULL, line_width = 0.7, point_size = 1.8, cluster_alpha = 0.12 )
result |
A result object returned by
|
plot_type |
Character. One of |
alpha |
Cluster-level significance threshold used to decide which clusters are significant for plotting. |
significant_only |
Logical. If |
show_clusters |
Logical. If |
show_candidates |
Logical. If |
show_threshold |
Logical. If |
show_zero_line |
Logical. If |
title |
Optional plot title. |
subtitle |
Optional plot subtitle. |
x_label |
X-axis label. |
y_label |
Optional y-axis label. If |
line_width |
Width of the time-course line. |
point_size |
Size of candidate-bin points. |
cluster_alpha |
Transparency for shaded cluster windows. |
Cluster-based permutation tests are intended for time-course inference. They should not be used to discover a confirmatory time window and then test that same window again in a second confirmatory model.
A ggplot object.
Plot event-detector comparison diagnostics
plot_gazepoint_event_detector_agreement( x, plot = c("counts", "durations", "agreement"), main = NULL, ylab = NULL, las = 2 )plot_gazepoint_event_detector_agreement( x, plot = c("counts", "durations", "agreement"), main = NULL, ylab = NULL, las = 2 )
x |
An object returned by |
plot |
Plot type: |
main |
Optional plot title. |
ylab |
Optional vertical-axis label. |
las |
Axis-label orientation passed to base graphics. |
Invisibly returns the plotted data.
Plot event-detector benchmark diagnostics
plot_gazepoint_event_detector_benchmark( x, plot = c("f1", "precision_recall", "overlap", "timing_error", "counts"), main = NULL, ylab = NULL, las = 2 )plot_gazepoint_event_detector_benchmark( x, plot = c("f1", "precision_recall", "overlap", "timing_error", "counts"), main = NULL, ylab = NULL, las = 2 )
x |
An object returned by |
plot |
Plot type: |
main |
Optional plot title. |
ylab |
Optional vertical-axis label. |
las |
Axis-label orientation passed to base graphics. |
Invisibly returns the detector-level data used by the plot.
Creates descriptive quality-control plots from
audit_gazepoint_face_quality() output. The plots summarise face-data
validity, confidence, status, or timing gaps. They do not infer facial
expressions or emotional states.
plot_gazepoint_face_quality( data, plot_type = c("status", "validity", "confidence", "time_gaps"), group_col = NULL, title = NULL, ... )plot_gazepoint_face_quality( data, plot_type = c("status", "validity", "confidence", "time_gaps"), group_col = NULL, title = NULL, ... )
data |
A |
plot_type |
One of |
group_col |
Optional grouping column to use on the y-axis for
group-level plots. Defaults to |
title |
Optional plot title. |
... |
Additional arguments passed to |
A ggplot object.
face <- data.frame( frame = 1:3, timestamp = c(0, 0.033, 0.066), confidence = c(0.95, 0.90, 0.40), success = c(1, 1, 1) ) plot_gazepoint_face_quality(face)face <- data.frame( frame = 1:3, timestamp = c(0, 0.033, 0.066), confidence = c(0.95, 0.90, 0.40), success = c(1, 1, 1) ) plot_gazepoint_face_quality(face)
Plot observed and fitted pupil trajectories from a gp3_gca_model object.
The function aggregates observed and fitted values by condition and time, and
returns a ggplot2 object.
plot_gazepoint_gca( model, data = NULL, time_col = "gca_time", observed_col = "gca_pupil", fitted_col = "gca_fitted", condition_col = "condition", subject_col = "subject", summarise = TRUE, show_observed = TRUE, show_fitted = TRUE, show_subjects = FALSE, interval = TRUE, title = NULL, point_size = 1.6, line_width = 0.8, alpha = 0.75 )plot_gazepoint_gca( model, data = NULL, time_col = "gca_time", observed_col = "gca_pupil", fitted_col = "gca_fitted", condition_col = "condition", subject_col = "subject", summarise = TRUE, show_observed = TRUE, show_fitted = TRUE, show_subjects = FALSE, interval = TRUE, title = NULL, point_size = 1.6, line_width = 0.8, alpha = 0.75 )
model |
A fitted object returned by |
data |
Optional data frame. If |
time_col |
Name of the time column. |
observed_col |
Name of the observed outcome column. |
fitted_col |
Name of the fitted-value column. If unavailable and
|
condition_col |
Name of the condition column. |
subject_col |
Optional subject column, used only when |
summarise |
Logical. If |
show_observed |
Logical. If |
show_fitted |
Logical. If |
show_subjects |
Logical. If |
interval |
Logical. If |
title |
Optional plot title. |
point_size |
Point size for observed means. |
line_width |
Line width for trajectories. |
alpha |
Alpha value for observed points/lines. |
A ggplot2 object.
plot_gazepoint_heatmap() creates a binned spatial heatmap from gaze or
fixation coordinates. Points may optionally be weighted by duration.
plot_gazepoint_heatmap( data, x_col = NULL, y_col = NULL, weight_col = NULL, display_width = NULL, display_height = NULL, coordinate_space = c("auto", "normalized", "pixel"), bins = 60, alpha = 0.85, normalize = TRUE, show_points = FALSE, show_legend = TRUE )plot_gazepoint_heatmap( data, x_col = NULL, y_col = NULL, weight_col = NULL, display_width = NULL, display_height = NULL, coordinate_space = c("auto", "normalized", "pixel"), bins = 60, alpha = 0.85, normalize = TRUE, show_points = FALSE, show_legend = TRUE )
data |
A data frame or an object returned by
|
x_col, y_col
|
Character strings giving x and y coordinate columns. These
may be omitted when |
weight_col |
Optional non-negative weight column, such as fixation duration. |
display_width, display_height
|
Display width and height in pixels. |
coordinate_space |
One of |
bins |
Number of bins. Either one integer or two integers for x and y. |
alpha |
Heatmap layer transparency. |
normalize |
Logical. If |
show_points |
Logical. If |
show_legend |
Logical. If |
A ggplot object.
gaze <- data.frame( x = c(0.20, 0.25, 0.27, 0.70, 0.75), y = c(0.30, 0.32, 0.34, 0.55, 0.60), duration = c(120, 180, 160, 90, 100) ) plot_gazepoint_heatmap( gaze, x_col = "x", y_col = "y", weight_col = "duration", display_width = 1920, display_height = 1080, bins = 20 )gaze <- data.frame( x = c(0.20, 0.25, 0.27, 0.70, 0.75), y = c(0.30, 0.32, 0.34, 0.55, 0.60), duration = c(120, 180, 160, 90, 100) ) plot_gazepoint_heatmap( gaze, x_col = "x", y_col = "y", weight_col = "duration", display_width = 1920, display_height = 1080, bins = 20 )
plot_gazepoint_heatmap_overlay() overlays a binned gaze or fixation
heatmap on a PNG background image, such as a stimulus screenshot. The png
package is used only when this helper is called.
plot_gazepoint_heatmap_overlay( data, background_image, x_col = NULL, y_col = NULL, weight_col = NULL, display_width = NULL, display_height = NULL, coordinate_space = c("auto", "normalized", "pixel"), bins = 60, heatmap_alpha = 0.7, background_alpha = 1, normalize = TRUE, show_legend = TRUE )plot_gazepoint_heatmap_overlay( data, background_image, x_col = NULL, y_col = NULL, weight_col = NULL, display_width = NULL, display_height = NULL, coordinate_space = c("auto", "normalized", "pixel"), bins = 60, heatmap_alpha = 0.7, background_alpha = 1, normalize = TRUE, show_legend = TRUE )
data |
A data frame or prepared heatmap data. |
background_image |
Path to a PNG background image. |
x_col, y_col
|
Character strings giving x and y coordinate columns. |
weight_col |
Optional non-negative weight column. |
display_width, display_height
|
Display width and height in pixels. If omitted, the PNG image dimensions are used. |
coordinate_space |
One of |
bins |
Number of heatmap bins. Either one integer or two integers. |
heatmap_alpha |
Heatmap layer transparency. |
background_alpha |
Background image transparency. |
normalize |
Logical. If |
show_legend |
Logical. If |
A ggplot object.
gaze <- data.frame( x = c(0.20, 0.25, 0.70), y = c(0.30, 0.35, 0.60), duration = c(120, 200, 80) ) if (requireNamespace("png", quietly = TRUE)) { bg <- tempfile(fileext = ".png") img <- array(1, dim = c(200, 300, 3)) png::writePNG(img, bg) plot_gazepoint_heatmap_overlay( gaze, background_image = bg, x_col = "x", y_col = "y", weight_col = "duration" ) }gaze <- data.frame( x = c(0.20, 0.25, 0.70), y = c(0.30, 0.35, 0.60), duration = c(120, 200, 80) ) if (requireNamespace("png", quietly = TRUE)) { bg <- tempfile(fileext = ".png") img <- array(1, dim = c(200, 300, 3)) png::writePNG(img, bg) plot_gazepoint_heatmap_overlay( gaze, background_image = bg, x_col = "x", y_col = "y", weight_col = "duration" ) }
Creates a descriptive plot of missingness rates from raw data or from the
output of summarize_gazepoint_missingness(). The plot is intended for
quality-control review and reporting.
plot_gazepoint_missingness_profile( data, cols = NULL, group_cols = NULL, plot_type = c("bar", "tile"), title = NULL, y_label = "Missingness rate" )plot_gazepoint_missingness_profile( data, cols = NULL, group_cols = NULL, plot_type = c("bar", "tile"), title = NULL, y_label = "Missingness rate" )
data |
A data frame or a missingness summary produced by
|
cols |
Optional columns to summarize when |
group_cols |
Optional grouping columns when |
plot_type |
Either |
title |
Optional plot title. |
y_label |
Optional y-axis label for bar plots. |
A ggplot object.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) plot_gazepoint_missingness_profile( x, cols = c("pupil_left", "pupil_right", "pupil"), group_cols = "condition" )x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) plot_gazepoint_missingness_profile( x, cols = c("pupil_left", "pupil_right", "pupil"), group_cols = "condition" )
Create a reporting plot that overlays observed outcome summaries with
fitted/model-predicted trajectories. The helper is intentionally generic and
can be used with linear models, GLMs, mixed models, GAMMs, GCA-style models,
AOI GLMMs, and pupil LMMs when the fitted object supports predict().
plot_gazepoint_model_predictions( data, model = NULL, x_col, outcome_col, condition_col = NULL, group_cols = NULL, facet_cols = NULL, newdata = NULL, prediction_type = c("response", "link"), include_random_effects = FALSE, observed_summary_function = c("mean", "median"), ci = 0.95, show_observed = TRUE, show_observed_ci = TRUE, show_predictions = TRUE, show_prediction_ci = TRUE, point_alpha = 0.55, line_width = 1, name = "gazepoint_model_predictions" )plot_gazepoint_model_predictions( data, model = NULL, x_col, outcome_col, condition_col = NULL, group_cols = NULL, facet_cols = NULL, newdata = NULL, prediction_type = c("response", "link"), include_random_effects = FALSE, observed_summary_function = c("mean", "median"), ci = 0.95, show_observed = TRUE, show_observed_ci = TRUE, show_predictions = TRUE, show_prediction_ci = TRUE, point_alpha = 0.55, line_width = 1, name = "gazepoint_model_predictions" )
data |
A data frame containing the observed data. |
model |
Optional fitted model object. If supplied, predictions are
computed using |
x_col |
Column used on the x-axis, usually time or time bin. |
outcome_col |
Observed outcome column. |
condition_col |
Optional condition column used for colour/grouping. |
group_cols |
Optional additional grouping columns for observed and predicted trajectories. |
facet_cols |
Optional columns used for faceting. |
newdata |
Optional prediction grid. If |
prediction_type |
Prediction scale passed to |
include_random_effects |
Logical. For |
observed_summary_function |
Summary for observed outcomes. Options are
|
ci |
Confidence level for observed and prediction intervals when standard errors are available. |
show_observed |
Logical. Plot observed summaries. |
show_observed_ci |
Logical. Plot observed normal-approximation intervals. |
show_predictions |
Logical. Plot model predictions when |
show_prediction_ci |
Logical. Plot prediction intervals when standard
errors are available from |
point_alpha |
Alpha value for observed points. |
line_width |
Line width for prediction trajectories. |
name |
Character label stored in plot attributes. |
A ggplot object with attributes containing the observed summary,
prediction summary, overview, and settings.
Create a compact residual diagnostic plot from either a fitted model object
with residuals() and fitted() methods, or a data frame that
already contains fitted values and residuals.
plot_gazepoint_model_residuals( model = NULL, data = NULL, fitted_col = NULL, residual_col = NULL, type = c("residuals_fitted", "qq"), title = NULL )plot_gazepoint_model_residuals( model = NULL, data = NULL, fitted_col = NULL, residual_col = NULL, type = c("residuals_fitted", "qq"), title = NULL )
model |
Optional fitted model object. |
data |
Optional data frame containing fitted and residual columns. |
fitted_col |
Fitted-value column when |
residual_col |
Residual column when |
type |
Diagnostic plot type: residuals-versus-fitted or QQ plot. |
title |
Optional plot title. |
A ggplot object.
Create diagnostic plots from preprocessing multiverse summaries or from pupil/AOI multiverse result objects.
plot_gazepoint_multiverse_results( x, plot = c("status", "rows", "pupil_parameters", "aoi_denominators"), family = c("all", "pupil", "aoi"), title = NULL, show_labels = TRUE )plot_gazepoint_multiverse_results( x, plot = c("status", "rows", "pupil_parameters", "aoi_denominators"), family = c("all", "pupil", "aoi"), title = NULL, show_labels = TRUE )
x |
A |
plot |
Character. Plot type. One of |
family |
Character. Which family to show. One of |
title |
Optional plot title. |
show_labels |
Logical. If |
A ggplot object.
Creates a descriptive timeline plot from segmented Gazepoint-style data or from a phase-coverage summary. The plot is intended for visual inspection of task-phase coverage and timing, not for inferential analysis.
plot_gazepoint_phase_timeline( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, title = NULL )plot_gazepoint_phase_timeline( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, title = NULL )
data |
A segmented data frame or a summary produced by
|
phase_col |
Character name of the phase column when |
group_cols |
Optional grouping columns when |
time_col |
Optional time column when |
title |
Optional plot title. |
A ggplot object.
x <- data.frame(time_ms = c(0, 250, 750, 1250)) windows <- data.frame( phase = c("baseline", "stimulus"), start = c(0, 500), end = c(500, 1500) ) segmented <- segment_gazepoint_task_phases(x, "time_ms", windows) plot_gazepoint_phase_timeline(segmented, time_col = "time_ms")x <- data.frame(time_ms = c(0, 250, 750, 1250)) windows <- data.frame( phase = c("baseline", "stimulus"), start = c(0, 500), end = c(500, 1500) ) segmented <- segment_gazepoint_task_phases(x, "time_ms", windows) plot_gazepoint_phase_timeline(segmented, time_col = "time_ms")
Create a visual audit plot for one selected subject, media item, trial, or trial-global identifier. The plot can show raw pupil, cleaned pupil, interpolated pupil, baseline-corrected pupil, smoothed pupil, and artifact flags.
plot_gazepoint_pupil_preprocessing( data, subject = NULL, media_id = NULL, trial = NULL, trial_global = NULL, condition = NULL, subject_col = "subject", media_col = "MEDIA_ID", trial_col = "trial", trial_global_col = "trial_global", condition_col = "condition", time_col = "time", raw_pupil_col = "pupil", clean_pupil_col = "pupil_clean", interpolated_pupil_col = "pupil_interpolated", baseline_pupil_col = "pupil_baseline_corrected", smoothed_pupil_col = "pupil_smoothed", artifact_col = NULL, artifact_reason_col = NULL, status_col = "pupil_interpolation_status", plot_style = c("faceted", "overlaid"), bin_width_ms = 50, max_event_marks = 150, point_size = 0.8, line_width = 0.35, alpha = 0.95 )plot_gazepoint_pupil_preprocessing( data, subject = NULL, media_id = NULL, trial = NULL, trial_global = NULL, condition = NULL, subject_col = "subject", media_col = "MEDIA_ID", trial_col = "trial", trial_global_col = "trial_global", condition_col = "condition", time_col = "time", raw_pupil_col = "pupil", clean_pupil_col = "pupil_clean", interpolated_pupil_col = "pupil_interpolated", baseline_pupil_col = "pupil_baseline_corrected", smoothed_pupil_col = "pupil_smoothed", artifact_col = NULL, artifact_reason_col = NULL, status_col = "pupil_interpolation_status", plot_style = c("faceted", "overlaid"), bin_width_ms = 50, max_event_marks = 150, point_size = 0.8, line_width = 0.35, alpha = 0.95 )
data |
A Gazepoint pupil data frame. |
subject |
Optional subject value to filter. |
media_id |
Optional media identifier value to filter. |
trial |
Optional trial value to filter. |
trial_global |
Optional global trial identifier value to filter. |
condition |
Optional condition value to filter. |
subject_col |
Name of the subject column. |
media_col |
Name of the media identifier column. |
trial_col |
Name of the trial column. |
trial_global_col |
Name of the global trial identifier column. |
condition_col |
Name of the condition column. |
time_col |
Name of the time column. |
raw_pupil_col |
Optional raw pupil column. |
clean_pupil_col |
Optional cleaned pupil column. |
interpolated_pupil_col |
Optional interpolated pupil column. |
baseline_pupil_col |
Optional baseline-corrected pupil column. |
smoothed_pupil_col |
Optional smoothed pupil column. |
artifact_col |
Optional artifact flag column. If |
artifact_reason_col |
Optional artifact-reason column. If |
status_col |
Optional interpolation-status column. |
plot_style |
Either |
bin_width_ms |
Width of time bins in milliseconds. This is used only for visual smoothing of dense sample-level traces. |
max_event_marks |
Maximum number of artifact/interpolation rug marks to draw. Event marks are evenly thinned if there are more events. |
point_size |
Size control for artifact/interpolation rug marks. |
line_width |
Line width for pupil series. |
alpha |
Line and marker transparency. |
A ggplot2 plot object.
Visualise observed, interpolated, missing, artifact, and other pupil-sample statuses over time or as grouped percentages.
plot_gazepoint_pupil_status( data, time_col = "time", pupil_col = NULL, status_col = "pupil_interpolation_status", interpolated_col = "pupil_was_interpolated", artifact_col = NULL, artifact_reason_col = NULL, group_cols = c("subject", "trial_global"), facet_cols = NULL, plot_type = c("timeline", "summary"), point_size = 0.7, alpha = 0.8, max_points = 50000 )plot_gazepoint_pupil_status( data, time_col = "time", pupil_col = NULL, status_col = "pupil_interpolation_status", interpolated_col = "pupil_was_interpolated", artifact_col = NULL, artifact_reason_col = NULL, group_cols = c("subject", "trial_global"), facet_cols = NULL, plot_type = c("timeline", "summary"), point_size = 0.7, alpha = 0.8, max_points = 50000 )
data |
A Gazepoint pupil data frame. |
time_col |
Name of the time column. |
pupil_col |
Optional pupil column used to detect remaining missing
samples. If |
status_col |
Optional interpolation-status column. |
interpolated_col |
Optional logical interpolation flag column. |
artifact_col |
Optional artifact flag column. If |
artifact_reason_col |
Optional artifact-reason column. If |
group_cols |
Character vector used to define timeline rows or summary groups. |
facet_cols |
Optional character vector of columns used for faceting. |
plot_type |
Either |
point_size |
Point size for timeline plots. |
alpha |
Point/column transparency. |
max_points |
Maximum number of rows to plot in timeline mode. If the input has more rows, rows are evenly thinned for plotting only. |
A ggplot2 plot object.
Plot a binned pupil time course with a mean line and confidence band. The function can plot one overall time course or condition-wise time courses, with optional faceting by variables such as condition, media, AOI, subject, or trial.
plot_gazepoint_pupil_timecourse( data, pupil_col = NULL, time_col = "time", condition_col = "condition", facet_cols = NULL, bin_width_ms = 100, ci_level = 0.95, min_samples = 1, band_alpha = 0.2, line_width = 0.8 )plot_gazepoint_pupil_timecourse( data, pupil_col = NULL, time_col = "time", condition_col = "condition", facet_cols = NULL, bin_width_ms = 100, ci_level = 0.95, min_samples = 1, band_alpha = 0.2, line_width = 0.8 )
data |
A Gazepoint pupil data frame. |
pupil_col |
Name of the pupil column to plot. If |
time_col |
Name of the time column. |
condition_col |
Optional condition column used for separate lines.
If the column is missing or contains only missing values, the function
plots a single |
facet_cols |
Optional character vector of columns used for faceting. |
bin_width_ms |
Width of time bins in milliseconds. |
ci_level |
Confidence level for the band. |
min_samples |
Minimum number of valid pupil samples required per time bin. |
band_alpha |
Transparency of the confidence band. |
line_width |
Width of the mean time-course line. |
A ggplot2 plot object.
Creates a descriptive QC-status plot from a QC bundle, QC status summary, or
object-summary table produced by collect_gazepoint_qc_summaries(). The plot
is intended for quick review and reporting support; it does not replace the
underlying audit outputs.
plot_gazepoint_qc_overview( qc_bundle, plot_type = c("status_counts", "objects"), title = NULL )plot_gazepoint_qc_overview( qc_bundle, plot_type = c("status_counts", "objects"), title = NULL )
qc_bundle |
A |
plot_type |
Either |
title |
Optional plot title. |
A ggplot object.
x <- list( pass = list(overview = data.frame(audit_status = "ok")), warn = list(overview = data.frame(audit_status = "review")) ) plot_gazepoint_qc_overview(x)x <- list( pass = list(overview = data.frame(audit_status = "ok")), warn = list(overview = data.frame(audit_status = "review")) ) plot_gazepoint_qc_overview(x)
Plot fixation coordinates connected in temporal order. This is a static ggplot2 scanpath helper for fixation-level Gazepoint exports. It does not require a stimulus image, but the returned plot can be extended by users with additional ggplot2 layers.
plot_gazepoint_scanpath( data, x_col, y_col, group_cols = NULL, time_col = NULL, fixation_index_col = NULL, label_col = NULL, point_size = 2, line_width = 0.4, show_order = TRUE, add_arrows = TRUE, reverse_y = FALSE, title = NULL )plot_gazepoint_scanpath( data, x_col, y_col, group_cols = NULL, time_col = NULL, fixation_index_col = NULL, label_col = NULL, point_size = 2, line_width = 0.4, show_order = TRUE, add_arrows = TRUE, reverse_y = FALSE, title = NULL )
data |
A fixation-level data frame. |
x_col |
Name of the horizontal fixation-coordinate column. |
y_col |
Name of the vertical fixation-coordinate column. |
group_cols |
Optional columns defining scanpaths. |
time_col |
Optional column used to order fixations. |
fixation_index_col |
Optional fixation index column used for labels. |
label_col |
Optional label column. If supplied, labels use this column. |
point_size |
Size of fixation points. |
line_width |
Width of connecting path lines. |
show_order |
Should fixation order labels be drawn? |
add_arrows |
Should arrows be added to scanpath lines? |
reverse_y |
Should the y-axis be reversed for screen-coordinate plots? |
title |
Optional plot title. |
A ggplot object.
Create base-R diagnostics for co-clustering probabilities, iteration-level adjusted Rand indices, or sequence-level stability.
plot_gazepoint_scanpath_cluster_stability( x, plot = c("coclustering", "ari", "sequence"), specification = NULL, min_pair_coverage = 0.5, stable_threshold = 0.75, main = NULL, label_cex = 0.8 )plot_gazepoint_scanpath_cluster_stability( x, plot = c("coclustering", "ari", "sequence"), specification = NULL, min_pair_coverage = 0.5, stable_threshold = 0.75, main = NULL, label_cex = 0.8 )
x |
An object returned by
|
plot |
Plot type: |
specification |
Optional specification name. The first specification is used by default. |
min_pair_coverage |
Pair-coverage threshold used in sequence summaries. |
stable_threshold |
Stability threshold used in sequence summaries. |
main |
Optional plot title. |
label_cex |
Axis-label size multiplier. |
Invisibly returns a list containing the plot type, specification, and plotted data.
latent <- rep(1:3, each = 2) d <- outer( latent, latent, FUN = function(x, y) ifelse(x == y, 0.1, 1) ) diag(d) <- 0 dimnames(d) <- list(LETTERS[1:6], LETTERS[1:6]) stability <- bootstrap_gazepoint_scanpath_clusters( d, k = 3, n_boot = 10, seed = 1 ) plot_gazepoint_scanpath_cluster_stability( stability, plot = "coclustering" )latent <- rep(1:3, each = 2) d <- outer( latent, latent, FUN = function(x, y) ifelse(x == y, 0.1, 1) ) diag(d) <- 0 dimnames(d) <- list(LETTERS[1:6], LETTERS[1:6]) stability <- bootstrap_gazepoint_scanpath_clusters( d, k = 3, n_boot = 10, seed = 1 ) plot_gazepoint_scanpath_cluster_stability( stability, plot = "coclustering" )
Create base-R MDS, dendrogram, or silhouette diagnostics for an
object returned by cluster_gazepoint_scanpaths().
plot_gazepoint_scanpath_clusters( x, plot = c("mds", "dendrogram", "silhouette"), labels = TRUE, main = NULL, xlab = NULL, ylab = NULL, point_cex = 1.2, label_cex = 0.8 )plot_gazepoint_scanpath_clusters( x, plot = c("mds", "dendrogram", "silhouette"), labels = TRUE, main = NULL, xlab = NULL, ylab = NULL, point_cex = 1.2, label_cex = 0.8 )
x |
An object returned by |
plot |
Plot type: |
labels |
Should scanpath identifiers be displayed? |
main |
Optional plot title. |
xlab |
Optional horizontal-axis label. |
ylab |
Optional vertical-axis label. |
point_cex |
Point-size multiplier for the MDS display. |
label_cex |
Label-size multiplier. |
These displays describe distance structure and cluster separation. They do not establish distinct cognitive or psychological strategies.
Invisibly returns a list containing the plot type, plot data, clustering method, and number of clusters.
d <- matrix( c( 0, 0.1, 1, 1, 0.1, 0, 1, 1, 1, 1, 0, 0.1, 1, 1, 0.1, 0 ), nrow = 4, byrow = TRUE, dimnames = list(LETTERS[1:4], LETTERS[1:4]) ) fit <- cluster_gazepoint_scanpaths(d, k = 2) plot_gazepoint_scanpath_clusters(fit, plot = "mds")d <- matrix( c( 0, 0.1, 1, 1, 0.1, 0, 1, 1, 1, 1, 0, 0.1, 1, 1, 0.1, 0 ), nrow = 4, byrow = TRUE, dimnames = list(LETTERS[1:4], LETTERS[1:4]) ) fit <- cluster_gazepoint_scanpaths(d, k = 2) plot_gazepoint_scanpath_clusters(fit, plot = "mds")
Creates a descriptive multi-scanpath plot from gaze coordinates. This helper is intended for visual quality review, participant/trial inspection, and documentation examples. It should not be interpreted as an inferential scanpath-comparison method.
plot_gazepoint_scanpaths( data, x_col, y_col, order_col = NULL, group_cols = NULL, colour_col = NULL, facet_col = NULL, screen_width = NULL, screen_height = NULL, reverse_y = TRUE, show_points = TRUE, alpha = 0.45, linewidth = 0.4, point_size = 0.7, title = NULL )plot_gazepoint_scanpaths( data, x_col, y_col, order_col = NULL, group_cols = NULL, colour_col = NULL, facet_col = NULL, screen_width = NULL, screen_height = NULL, reverse_y = TRUE, show_points = TRUE, alpha = 0.45, linewidth = 0.4, point_size = 0.7, title = NULL )
data |
A data frame. |
x_col, y_col
|
Character names of gaze coordinate columns. |
order_col |
Optional column used to order gaze samples before plotting. |
group_cols |
Optional character vector used to define separate paths. |
colour_col |
Optional column used for colour. |
facet_col |
Optional column used for faceting. |
screen_width, screen_height
|
Optional screen dimensions. If supplied, axis limits are set to the screen bounds. |
reverse_y |
If |
show_points |
If |
alpha |
Line opacity. |
linewidth |
Line width. |
point_size |
Point size when |
title |
Optional plot title. |
A ggplot object.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) plot_gazepoint_scanpaths( x, x_col = "gaze_x", y_col = "gaze_y", order_col = "time_bin", group_cols = c("subject", "trial"), colour_col = "condition" )x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) plot_gazepoint_scanpaths( x, x_col = "gaze_x", y_col = "gaze_y", order_col = "time_bin", group_cols = c("subject", "trial"), colour_col = "condition" )
Draws screen/stimulus bounds, rectangular AOIs, and optional gaze coordinates. The plot is intended for visual quality review of coordinate systems, AOI placement, and gaze coverage. It is descriptive and should not be interpreted as an inferential attention analysis.
plot_gazepoint_stimulus_layout_qc( aoi_data, screen_width, screen_height, aoi_col = NULL, x_min_col = "x_min", x_max_col = "x_max", y_min_col = "y_min", y_max_col = "y_max", gaze_data = NULL, gaze_x_col = NULL, gaze_y_col = NULL, reverse_y = TRUE, show_aoi_labels = TRUE, show_gaze = TRUE, gaze_alpha = 0.25, gaze_point_size = 0.7, title = NULL )plot_gazepoint_stimulus_layout_qc( aoi_data, screen_width, screen_height, aoi_col = NULL, x_min_col = "x_min", x_max_col = "x_max", y_min_col = "y_min", y_max_col = "y_max", gaze_data = NULL, gaze_x_col = NULL, gaze_y_col = NULL, reverse_y = TRUE, show_aoi_labels = TRUE, show_gaze = TRUE, gaze_alpha = 0.25, gaze_point_size = 0.7, title = NULL )
aoi_data |
A data frame containing rectangular AOI geometry. |
screen_width, screen_height
|
Numeric screen or stimulus dimensions. |
aoi_col |
Optional AOI identifier column. |
x_min_col, x_max_col, y_min_col, y_max_col
|
Character names of AOI rectangle boundary columns. |
gaze_data |
Optional data frame containing gaze coordinates. |
gaze_x_col, gaze_y_col
|
Character names of gaze-coordinate columns in
|
reverse_y |
If |
show_aoi_labels |
If |
show_gaze |
If |
gaze_alpha |
Opacity of gaze points. |
gaze_point_size |
Size of gaze points. |
title |
Optional plot title. |
A ggplot object.
aoi <- data.frame( aoi = c("left", "right"), x_min = c(100, 1200), x_max = c(500, 1700), y_min = c(100, 100), y_max = c(400, 400) ) gaze <- simulate_gazepoint_pupil_data(n_subjects = 1, n_trials = 1, n_time_bins = 10, seed = 1) plot_gazepoint_stimulus_layout_qc( aoi, screen_width = 1920, screen_height = 1080, aoi_col = "aoi", gaze_data = gaze, gaze_x_col = "gaze_x", gaze_y_col = "gaze_y" )aoi <- data.frame( aoi = c("left", "right"), x_min = c(100, 1200), x_max = c(500, 1700), y_min = c(100, 100), y_max = c(400, 400) ) gaze <- simulate_gazepoint_pupil_data(n_subjects = 1, n_trials = 1, n_time_bins = 10, seed = 1) plot_gazepoint_stimulus_layout_qc( aoi, screen_width = 1920, screen_height = 1080, aoi_col = "aoi", gaze_data = gaze, gaze_x_col = "gaze_x", gaze_y_col = "gaze_y" )
Creates a compact line plot for pupil, gaze, AOI, or other time-varying Gazepoint-derived measures. The helper is intentionally descriptive: it does not smooth, model, or infer effects unless the user has already prepared the plotted values.
plot_gazepoint_time_series( data, time_col, value_col, group_cols = NULL, colour_col = NULL, facet_col = NULL, alpha = 0.55, linewidth = 0.4, title = NULL, x_label = NULL, y_label = NULL )plot_gazepoint_time_series( data, time_col, value_col, group_cols = NULL, colour_col = NULL, facet_col = NULL, alpha = 0.55, linewidth = 0.4, title = NULL, x_label = NULL, y_label = NULL )
data |
A data frame. |
time_col |
Character name of the time column. |
value_col |
Character name of the value column. |
group_cols |
Optional character vector of grouping columns used to draw separate trajectories. |
colour_col |
Optional character name of a column used for colour. |
facet_col |
Optional character name of a column used for faceting. |
alpha |
Line opacity. |
linewidth |
Line width. |
title |
Optional plot title. |
x_label, y_label
|
Optional axis labels. |
A ggplot object.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) plot_gazepoint_time_series( x, time_col = "time_bin", value_col = "pupil", group_cols = c("subject", "trial"), colour_col = "condition" )x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) plot_gazepoint_time_series( x, time_col = "time_bin", value_col = "pupil", group_cols = c("subject", "trial"), colour_col = "condition" )
Plot a time-varying effect, difference curve, or model-prediction contrast from a tidy data frame. This helper is intentionally lightweight: it does not refit a model, but visualises already computed estimates and optional interval bounds from GAMM, GCA, cluster, bootstrap, or prediction workflows.
plot_gazepoint_time_varying_effect( data, time_col, estimate_col, lower_col = NULL, upper_col = NULL, group_col = NULL, zero_line = TRUE, title = NULL, x_label = NULL, y_label = NULL )plot_gazepoint_time_varying_effect( data, time_col, estimate_col, lower_col = NULL, upper_col = NULL, group_col = NULL, zero_line = TRUE, title = NULL, x_label = NULL, y_label = NULL )
data |
A data frame containing time-varying estimates. |
time_col |
Name of the time column. |
estimate_col |
Name of the estimate/effect column. |
lower_col |
Optional lower interval column. |
upper_col |
Optional upper interval column. |
group_col |
Optional grouping/contrast column. |
zero_line |
Should a horizontal zero reference line be shown? |
title |
Optional plot title. |
x_label |
Optional x-axis label. |
y_label |
Optional y-axis label. |
A ggplot object.
Creates a diagnostic plot of estimated sampling rate by participant/file and media stimulus.
plot_sampling_rate( sampling, user_col = "USER_FILE", media_col = "MEDIA_ID", expected_hz = 60, hz_tolerance = 5 )plot_sampling_rate( sampling, user_col = "USER_FILE", media_col = "MEDIA_ID", expected_hz = 60, hz_tolerance = 5 )
sampling |
Sampling-rate table, usually from |
user_col |
Column identifying the source/user file. |
media_col |
Column identifying the media/stimulus. |
expected_hz |
Expected sampling rate. |
hz_tolerance |
Allowed deviation from the expected sampling rate. |
A ggplot object.
Creates a readable diagnostic plot of selected gaze and pupil validity percentages by participant/file and media stimulus.
plot_tracking_quality( data, metric_cols = NULL, user_col = "USER_FILE", media_col = "MEDIA_ID", review_col = "review_required", min_valid_pct = 70 )plot_tracking_quality( data, metric_cols = NULL, user_col = "USER_FILE", media_col = "MEDIA_ID", review_col = "review_required", min_valid_pct = 70 )
data |
A tracking-quality or flagged-quality table, usually from
|
metric_cols |
Validity percentage columns to plot. If |
user_col |
Column identifying the source/user file. |
media_col |
Column identifying the media/stimulus. |
review_col |
Optional column indicating whether a row requires review. |
min_valid_pct |
Vertical threshold line for acceptable validity. |
A ggplot object.
Plot an AOI transition heatmap
plot_transition_heatmap(transitions)plot_transition_heatmap(transitions)
transitions |
Output of |
A ggplot object.
Prepare sample-level or binned Gazepoint AOI data for AOI time-course GAMM analysis. The function creates binned subject-by-condition-by-time summaries with binomial success/failure counts for target-AOI looking over time.
prepare_gazepoint_aoi_gamm_data( data, aoi_col = "aoi_current", target_aoi_values = NULL, outcome_col = NULL, subject_col = "subject", condition_col = "condition", time_col = "time", trial_col = NULL, time_bin_col = NULL, conditions = NULL, time_window = NULL, bin_size_ms = 50, denominator = c("valid", "all", "aoi_only"), valid_aoi_values = NULL, non_aoi_values = c("non_aoi"), missing_aoi_values = c("missing", ""), min_denominator_samples = 1, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "target_aoi" )prepare_gazepoint_aoi_gamm_data( data, aoi_col = "aoi_current", target_aoi_values = NULL, outcome_col = NULL, subject_col = "subject", condition_col = "condition", time_col = "time", trial_col = NULL, time_bin_col = NULL, conditions = NULL, time_window = NULL, bin_size_ms = 50, denominator = c("valid", "all", "aoi_only"), valid_aoi_values = NULL, non_aoi_values = c("non_aoi"), missing_aoi_values = c("missing", ""), min_denominator_samples = 1, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "target_aoi" )
data |
A data frame containing sample-level or binned AOI data. |
aoi_col |
Name of the AOI-state column. Used when |
target_aoi_values |
Character vector identifying target AOI values.
Required when |
outcome_col |
Optional logical or 0/1 numeric column indicating target
AOI looking at the sample level. If supplied, this takes priority over
|
subject_col |
Name of the subject/participant column. |
condition_col |
Name of the condition column. If unavailable, a single fallback condition is created. |
time_col |
Name of the time column, in milliseconds. |
trial_col |
Optional trial identifier column. |
time_bin_col |
Optional existing time-bin column. If |
conditions |
Optional character vector of condition levels to retain and order. |
time_window |
Optional numeric vector of length 2 defining the retained time window in milliseconds. |
bin_size_ms |
Time-bin width in milliseconds when |
denominator |
Denominator definition. |
valid_aoi_values |
Optional character vector defining explicit AOI
values for |
non_aoi_values |
Character vector identifying non-AOI/background states. |
missing_aoi_values |
Character vector identifying missing AOI-state labels. |
min_denominator_samples |
Minimum number of denominator samples required per subject-condition-time bin. |
drop_invalid |
Logical. If |
missing_condition_label |
Fallback condition label when no usable condition column is available. |
outcome_label |
Descriptive label for the AOI-GAMM outcome. |
This helper is intended for modelling AOI time-course trajectories, such as target-AOI looking probability over time. It is separate from confirmatory AOI-window GLMMs and from cluster-based permutation tests.
A tibble with standardised AOI-GAMM columns.
Prepare AOI-window summaries for confirmatory binomial mixed-effects
modelling. The function creates success, failure, denominator, proportion,
subject, condition, and window columns from output produced by
summarise_gazepoint_aoi_windows().
prepare_gazepoint_aoi_glmm_data( data, success_col = "n_target_samples", denominator = c("valid", "all", "aoi", "custom"), denominator_col = NULL, valid_denominator_col = "n_valid_denominator_samples", all_denominator_col = "n_window_samples", aoi_denominator_col = "n_aoi_samples", subject_col = "subject", condition_col = "condition", window_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", group_cols = NULL, min_denominator_samples = 1, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "target" )prepare_gazepoint_aoi_glmm_data( data, success_col = "n_target_samples", denominator = c("valid", "all", "aoi", "custom"), denominator_col = NULL, valid_denominator_col = "n_valid_denominator_samples", all_denominator_col = "n_window_samples", aoi_denominator_col = "n_aoi_samples", subject_col = "subject", condition_col = "condition", window_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", group_cols = NULL, min_denominator_samples = 1, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "target" )
data |
AOI-window summary data. |
success_col |
Column containing the success count. For target-looking
models this is usually |
denominator |
Denominator definition. Use |
denominator_col |
Custom denominator column when |
valid_denominator_col |
Column used when |
all_denominator_col |
Column used when |
aoi_denominator_col |
Column used when |
subject_col |
Subject/participant column. |
condition_col |
Optional condition column. |
window_col |
AOI-window label column. |
window_start_col |
Optional window-start column. |
window_end_col |
Optional window-end column. |
group_cols |
Optional extra grouping columns to keep/check. |
min_denominator_samples |
Minimum acceptable denominator. |
drop_invalid |
Logical. If |
missing_condition_label |
Label used when condition is missing. |
outcome_label |
Label stored in the output to identify the modelled AOI outcome. |
A tibble of GLMM-ready AOI-window rows.
Create ordered AOI-state sequences from sample-level Gazepoint AOI data or
from the output of summarise_gazepoint_aoi_entries(). The output is
transition-ready and includes the current AOI state, previous state, next
state, dwell time before transition, and self-transition flags.
prepare_gazepoint_aoi_sequences( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi", include_terminal = TRUE )prepare_gazepoint_aoi_sequences( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi", include_terminal = TRUE )
data |
A Gazepoint sample-level data frame or an AOI-entry table created
by |
aoi_col |
Name of the AOI-state column. Used only when |
time_col |
Name of the time column, in milliseconds. Used only when
|
group_cols |
Character vector of columns defining independent AOI sequences, usually subject/media/trial. |
include_non_aoi |
Logical. If |
non_aoi_values |
Character vector of AOI labels treated as background or non-AOI states. |
missing_aoi_label |
Label used when the AOI value is missing. |
include_terminal |
Logical. If |
A tibble with ordered AOI sequence and transition fields.
Prepare sample-level or already binned Gazepoint time-course data for cluster-based permutation testing. The function standardises subject, condition, time-bin, outcome, sample-count, trial-count, and status columns. It can be used for AOI proportions, pupil time-course outcomes, or other continuous time-varying measures.
prepare_gazepoint_cluster_data( data, outcome_col, subject_col = "subject", condition_col = "condition", time_col = "time", trial_col = NULL, time_bin_col = NULL, conditions = NULL, time_window = NULL, bin_size_ms = 50, aggregation = c("mean", "proportion", "sum", "median"), min_samples_per_bin = 1, paired = TRUE, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "outcome" )prepare_gazepoint_cluster_data( data, outcome_col, subject_col = "subject", condition_col = "condition", time_col = "time", trial_col = NULL, time_bin_col = NULL, conditions = NULL, time_window = NULL, bin_size_ms = 50, aggregation = c("mean", "proportion", "sum", "median"), min_samples_per_bin = 1, paired = TRUE, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "outcome" )
data |
A data frame containing sample-level or binned time-course data. |
outcome_col |
Column containing the outcome to test. For AOI analyses this is often a 0/1 or logical AOI column. For pupil analyses this is often a processed pupil column. |
subject_col |
Subject/participant column. |
condition_col |
Optional condition column. |
time_col |
Time column in milliseconds. |
trial_col |
Optional trial identifier column. |
time_bin_col |
Optional existing time-bin column. If |
conditions |
Optional character vector of condition levels to keep. Cluster tests are usually pairwise, so this is typically length 2. |
time_window |
Optional numeric vector of length 2 giving the time range to retain, in milliseconds. |
bin_size_ms |
Bin size in milliseconds when |
aggregation |
How to aggregate samples within subject-condition-time
bins. Supported values are |
min_samples_per_bin |
Minimum number of samples required per subject-condition-time bin. |
paired |
Logical. If |
drop_invalid |
Logical. If |
missing_condition_label |
Label used when condition is missing or
|
outcome_label |
Label stored in the output to identify the outcome. |
Cluster-based permutation tests are intended for time-course inference. They should not be used to discover a time window and then test that same window again as a confirmatory analysis.
A tibble with standardised cluster-test preparation columns.
Convert a gp3tools master table into a dependency-free, eyetools-friendly
sample-level table. The returned data frame keeps one row per sample and
creates standard participant, trial, time, gaze-coordinate, binocular
coordinate, pupil, AOI, fixation, event, validity, trackloss, and status
columns.
prepare_gazepoint_eyetools_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, x_col = NULL, y_col = NULL, left_x_col = NULL, left_y_col = NULL, right_x_col = NULL, right_y_col = NULL, pupil_col = NULL, left_pupil_col = NULL, right_pupil_col = NULL, media_col = NULL, condition_col = NULL, aoi_col = NULL, fixation_col = NULL, event_col = NULL, validity_cols = NULL, trackloss_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), missing_aoi_label = "missing_aoi", keep_original_cols = TRUE )prepare_gazepoint_eyetools_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, x_col = NULL, y_col = NULL, left_x_col = NULL, left_y_col = NULL, right_x_col = NULL, right_y_col = NULL, pupil_col = NULL, left_pupil_col = NULL, right_pupil_col = NULL, media_col = NULL, condition_col = NULL, aoi_col = NULL, fixation_col = NULL, event_col = NULL, validity_cols = NULL, trackloss_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), missing_aoi_label = "missing_aoi", keep_original_cols = TRUE )
data |
A Gazepoint master table or sample-level gaze data frame. |
participant_col |
Participant/subject identifier column. |
trial_col |
Trial identifier column. If |
time_col |
Sample time column. |
x_col |
Optional primary gaze x-coordinate column. |
y_col |
Optional primary gaze y-coordinate column. |
left_x_col |
Optional left-eye x-coordinate column. |
left_y_col |
Optional left-eye y-coordinate column. |
right_x_col |
Optional right-eye x-coordinate column. |
right_y_col |
Optional right-eye y-coordinate column. |
pupil_col |
Optional primary pupil column. |
left_pupil_col |
Optional left-eye pupil column. |
right_pupil_col |
Optional right-eye pupil column. |
media_col |
Optional media/stimulus identifier column. |
condition_col |
Optional condition/grouping column. |
aoi_col |
Optional AOI label/state column. |
fixation_col |
Optional fixation identifier column. |
event_col |
Optional event/marker column. |
validity_cols |
Optional validity columns used to define trackloss. |
trackloss_col |
Optional existing trackloss column. If supplied, it is used directly after coercion to logical. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
missing_aoi_label |
Label used for missing AOI values. |
keep_original_cols |
Logical. If |
A tibble with class gp3_eyetools_data.
Convert a gp3tools master table into a dependency-free, eyetrackingR-friendly
sample-level table. The returned data frame keeps one row per gaze sample and
creates standard participant, trial, time, gaze-coordinate, AOI, trackloss, and
AOI-indicator columns.
prepare_gazepoint_eyetrackingr_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, aoi_col = NULL, x_col = NULL, y_col = NULL, media_col = NULL, condition_col = NULL, validity_cols = NULL, aoi_values = NULL, aoi_prefix = "aoi_", missing_aoi_label = "missing_aoi", non_aoi_values = c("outside", "none", "no_aoi", "non_aoi", "background", "off_aoi", "missing", "NA"), trackloss_col = NULL, keep_original_cols = TRUE )prepare_gazepoint_eyetrackingr_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, aoi_col = NULL, x_col = NULL, y_col = NULL, media_col = NULL, condition_col = NULL, validity_cols = NULL, aoi_values = NULL, aoi_prefix = "aoi_", missing_aoi_label = "missing_aoi", non_aoi_values = c("outside", "none", "no_aoi", "non_aoi", "background", "off_aoi", "missing", "NA"), trackloss_col = NULL, keep_original_cols = TRUE )
data |
A Gazepoint master table or sample-level gaze data frame. |
participant_col |
Participant/subject identifier column. |
trial_col |
Trial identifier column. If |
time_col |
Sample time column. |
aoi_col |
AOI label/state column. |
x_col |
Optional gaze x-coordinate column. |
y_col |
Optional gaze y-coordinate column. |
media_col |
Optional media/stimulus identifier column. |
condition_col |
Optional condition/grouping column. |
validity_cols |
Optional validity columns used to define trackloss. |
aoi_values |
Optional AOI values for which logical indicator columns
should be created. If |
aoi_prefix |
Prefix for generated AOI indicator columns. |
missing_aoi_label |
Label used for missing AOI values. |
non_aoi_values |
Character values treated as non-AOI/background states. |
trackloss_col |
Optional existing trackloss column. If supplied, it is used directly after coercion to logical. |
keep_original_cols |
Logical. If |
A tibble with class gp3_eyetrackingr_data.
Align Gazepoint observations to a within-trial event such as first fixation, first target-AOI entry, first fixation to a target AOI, first saccade to a target AOI, or a custom event marker. The helper returns the original data with event-aligned time, event metadata, pre-event/post-event flags, and trial-level summaries that help separate event-driven looking from looks that were already present before the event.
prepare_gazepoint_fixation_aligned_data( data, time_col, participant_col = NULL, trial_col = NULL, aoi_col = NULL, target_aoi = NULL, fixation_col = NULL, saccade_col = NULL, event_col = NULL, event_value = NULL, alignment_event = c("first_target_entry", "first_fixation_to_target", "first_saccade_to_aoi", "first_fixation", "custom"), baseline_window = NULL, analysis_window = NULL, keep_unaligned = FALSE, name = "gazepoint_fixation_aligned_data" )prepare_gazepoint_fixation_aligned_data( data, time_col, participant_col = NULL, trial_col = NULL, aoi_col = NULL, target_aoi = NULL, fixation_col = NULL, saccade_col = NULL, event_col = NULL, event_value = NULL, alignment_event = c("first_target_entry", "first_fixation_to_target", "first_saccade_to_aoi", "first_fixation", "custom"), baseline_window = NULL, analysis_window = NULL, keep_unaligned = FALSE, name = "gazepoint_fixation_aligned_data" )
data |
A data frame containing Gazepoint samples, fixation rows, or trial-level time-course rows. |
time_col |
Time column. |
participant_col |
Optional participant column. |
trial_col |
Optional trial column. |
aoi_col |
Optional AOI column. |
target_aoi |
Optional character vector identifying the target AOI(s). |
fixation_col |
Optional fixation indicator column. |
saccade_col |
Optional saccade indicator column. |
event_col |
Optional custom event indicator column. |
event_value |
Optional value(s) in |
alignment_event |
Alignment event. Options are |
baseline_window |
Optional numeric vector of length two giving the
aligned-time baseline window, for example |
analysis_window |
Optional numeric vector of length two giving the
aligned-time analysis window, for example |
keep_unaligned |
Logical. If |
name |
Character label stored in the returned object. |
A list with class gp3_fixation_aligned_data.
Convert a gp3tools master table into a dependency-free, gazer-friendly
sample-level table. The returned data frame keeps one row per gaze sample and
creates standard participant, trial, time, gaze-coordinate, pupil, AOI,
fixation, validity, trackloss, and screen-bound status columns.
prepare_gazepoint_gazer_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, x_col = NULL, y_col = NULL, pupil_col = NULL, media_col = NULL, condition_col = NULL, aoi_col = NULL, fixation_col = NULL, validity_cols = NULL, trackloss_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), missing_aoi_label = "missing_aoi", keep_original_cols = TRUE )prepare_gazepoint_gazer_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, x_col = NULL, y_col = NULL, pupil_col = NULL, media_col = NULL, condition_col = NULL, aoi_col = NULL, fixation_col = NULL, validity_cols = NULL, trackloss_col = NULL, screen_x_range = c(0, 1), screen_y_range = c(0, 1), missing_aoi_label = "missing_aoi", keep_original_cols = TRUE )
data |
A Gazepoint master table or sample-level gaze data frame. |
participant_col |
Participant/subject identifier column. |
trial_col |
Trial identifier column. If |
time_col |
Sample time column. |
x_col |
Gaze x-coordinate column. |
y_col |
Gaze y-coordinate column. |
pupil_col |
Optional pupil column. |
media_col |
Optional media/stimulus identifier column. |
condition_col |
Optional condition/grouping column. |
aoi_col |
Optional AOI label/state column. |
fixation_col |
Optional fixation identifier column. |
validity_cols |
Optional validity columns used to define trackloss. |
trackloss_col |
Optional existing trackloss column. If supplied, it is used directly after coercion to logical. |
screen_x_range |
Numeric length-2 vector defining the screen x range. |
screen_y_range |
Numeric length-2 vector defining the screen y range. |
missing_aoi_label |
Label used for missing AOI values. |
keep_original_cols |
Logical. If |
A tibble with class gp3_gazer_data.
Prepare binned pupil time-course data for Growth Curve Analysis (GCA). The function creates orthogonal polynomial time terms, preserves subject and condition information, and standardises key columns for later mixed-model fitting.
prepare_gazepoint_gca_data( data, pupil_col = "mean_pupil", time_col = "time_bin_center_ms", subject_col = "subject", condition_col = "condition", degree = 3, orthogonal = TRUE, time_window = NULL, valid_samples_col = "n_valid_samples", min_valid_samples = 1, weights_col = NULL, missing_condition_label = "all_data", drop_missing = TRUE )prepare_gazepoint_gca_data( data, pupil_col = "mean_pupil", time_col = "time_bin_center_ms", subject_col = "subject", condition_col = "condition", degree = 3, orthogonal = TRUE, time_window = NULL, valid_samples_col = "n_valid_samples", min_valid_samples = 1, weights_col = NULL, missing_condition_label = "all_data", drop_missing = TRUE )
data |
A binned pupil time-course data frame, usually created by
|
pupil_col |
Name of the pupil outcome column. |
time_col |
Name of the time column. |
subject_col |
Name of the subject column. |
condition_col |
Name of the condition column. If unavailable or entirely missing, a single condition label is used. |
degree |
Number of polynomial time terms to create. |
orthogonal |
Logical. If |
time_window |
Optional numeric vector of length 2 giving the time window to retain. |
valid_samples_col |
Optional column containing valid sample counts. |
min_valid_samples |
Minimum valid samples required per row when
|
weights_col |
Optional weights column to preserve for later modelling. |
missing_condition_label |
Label used when condition values are missing. |
drop_missing |
Logical. If |
A tibble of class gp3_gca_data with standard GCA columns and
polynomial time terms.
Standardises participant, trial, time, gaze, AOI, pupil, and validity fields without changing the underlying measurements.
prepare_gazepoint_gpbiometrics_bridge( gaze_data, participant_col = NULL, trial_col = NULL, time_col = NULL, time_unit = c("auto", "seconds", "milliseconds"), x_col = NULL, y_col = NULL, aoi_col = NULL, pupil_col = NULL, validity_col = NULL, keep_cols = NULL )prepare_gazepoint_gpbiometrics_bridge( gaze_data, participant_col = NULL, trial_col = NULL, time_col = NULL, time_unit = c("auto", "seconds", "milliseconds"), x_col = NULL, y_col = NULL, aoi_col = NULL, pupil_col = NULL, validity_col = NULL, keep_cols = NULL )
gaze_data |
Sample-level gp3tools gaze/master data. |
participant_col, trial_col, time_col
|
Explicit source columns. |
time_unit |
Time unit for the source time column. |
x_col, y_col, aoi_col, pupil_col, validity_col
|
Optional source columns. |
keep_cols |
Additional source columns to retain. |
A data frame of class "gazepoint_gpbiometrics_bridge".
Prepares a clean trial-level CSV-compatible data frame for Python HDDM or related drift-diffusion modelling workflows. This function does not fit HDDM.
prepare_gazepoint_hddm_export( data, subject, rt, response, predictors = NULL, zscore_within_subject = TRUE, drop_missing = TRUE, file = NULL )prepare_gazepoint_hddm_export( data, subject, rt, response, predictors = NULL, zscore_within_subject = TRUE, drop_missing = TRUE, file = NULL )
data |
Trial-level data frame. |
subject |
Subject identifier column. |
rt |
Response-time column. |
response |
Binary response column coded as 0/1. |
predictors |
Optional continuous predictors to include. |
zscore_within_subject |
Logical; z-score predictors within subject. |
drop_missing |
Logical; drop rows with missing required values. |
file |
Optional CSV path. If supplied, the export is written to disk. |
A data frame ready for HDDM-style workflows.
prepare_gazepoint_heatmap_data() standardises gaze or fixation
coordinates for spatial heatmap visualisation. It supports normalised
Gazepoint-style coordinates in the range 0–1 and pixel coordinates.
prepare_gazepoint_heatmap_data( data, x_col, y_col, weight_col = NULL, display_width = NULL, display_height = NULL, coordinate_space = c("auto", "normalized", "pixel") )prepare_gazepoint_heatmap_data( data, x_col, y_col, weight_col = NULL, display_width = NULL, display_height = NULL, coordinate_space = c("auto", "normalized", "pixel") )
data |
A data frame containing gaze or fixation coordinates. |
x_col, y_col
|
Character strings giving the x and y coordinate columns. |
weight_col |
Optional character string giving a non-negative weight
column, such as fixation duration. If |
display_width, display_height
|
Display width and height in pixels. For normalised coordinates, these values are used to convert coordinates to pixel space. If omitted for normalised coordinates, a unit display is used. If omitted for pixel coordinates, bounds are inferred from the observed coordinates. |
coordinate_space |
One of |
A data frame with the original retained rows and standardised
columns .gp3_x_px, .gp3_y_px, and .gp3_weight.
gaze <- data.frame( x = c(0.20, 0.25, 0.75), y = c(0.30, 0.35, 0.60), duration = c(120, 200, 80) ) prepare_gazepoint_heatmap_data( gaze, x_col = "x", y_col = "y", weight_col = "duration", display_width = 1920, display_height = 1080 )gaze <- data.frame( x = c(0.20, 0.25, 0.75), y = c(0.30, 0.35, 0.60), duration = c(120, 200, 80) ) prepare_gazepoint_heatmap_data( gaze, x_col = "x", y_col = "y", weight_col = "duration", display_width = 1920, display_height = 1080 )
Convert ordered Gazepoint AOI/state observations into a dependency-free hidden-Markov-model-ready structure. The helper creates ordered sequence data, transition tables, initial-state probabilities, transition-probability matrices, and observation/emission summaries. It does not fit an HMM and does not import external HMM packages.
prepare_gazepoint_hmm_data( data, state_col = NULL, participant_col = NULL, trial_col = NULL, time_col = NULL, observation_cols = NULL, sequence_id_cols = NULL, covariate_cols = NULL, state_order = NULL, exclude_states = c("missing", "missing_aoi", "missing_coordinate", "trackloss", "track_loss"), missing_state_label = NULL, scale_numeric_observations = FALSE, include_terminal_state = FALSE, terminal_state_label = "END", name = "gazepoint_hmm_data" )prepare_gazepoint_hmm_data( data, state_col = NULL, participant_col = NULL, trial_col = NULL, time_col = NULL, observation_cols = NULL, sequence_id_cols = NULL, covariate_cols = NULL, state_order = NULL, exclude_states = c("missing", "missing_aoi", "missing_coordinate", "trackloss", "track_loss"), missing_state_label = NULL, scale_numeric_observations = FALSE, include_terminal_state = FALSE, terminal_state_label = "END", name = "gazepoint_hmm_data" )
data |
A data frame containing ordered AOI/state observations. |
state_col |
AOI/state column. If |
participant_col |
Optional participant/subject column. |
trial_col |
Optional trial/sequence column. |
time_col |
Optional time/order column. |
observation_cols |
Optional observation columns to carry into the HMM
data. If |
sequence_id_cols |
Optional character vector of columns defining separate
sequences. If |
covariate_cols |
Optional covariate columns to carry into the HMM data. |
state_order |
Optional preferred hidden-state order. |
exclude_states |
Character vector of states to exclude before sequence construction. |
missing_state_label |
Optional label used to retain missing states. If
|
scale_numeric_observations |
Logical. If |
include_terminal_state |
Logical. If |
terminal_state_label |
Terminal-state label. |
name |
Character label stored in the returned object. |
A list with class gp3_hmm_data.
Joins facial-behaviour window summaries with optional Gazepoint-derived summaries, response variables, or covariates. The helper is intentionally conservative: it prepares transparent analysis tables and optional scaled predictors, but it does not infer emotional states or causal effects.
prepare_gazepoint_multimodal_data( face_windows, gaze_data = NULL, response_data = NULL, by = NULL, gaze_by = NULL, response_by = NULL, predictor_cols = NULL, outcome_cols = NULL, covariate_cols = NULL, scale_predictors = TRUE, scaled_suffix = "_z", drop_missing_outcomes = FALSE, keep_all = TRUE )prepare_gazepoint_multimodal_data( face_windows, gaze_data = NULL, response_data = NULL, by = NULL, gaze_by = NULL, response_by = NULL, predictor_cols = NULL, outcome_cols = NULL, covariate_cols = NULL, scale_predictors = TRUE, scaled_suffix = "_z", drop_missing_outcomes = FALSE, keep_all = TRUE )
face_windows |
A data frame, usually returned by
|
gaze_data |
Optional Gazepoint-derived data frame to join. |
response_data |
Optional response/outcome data frame to join. |
by |
Character vector of join columns shared across tables. If |
gaze_by |
Optional named join mapping passed to |
response_by |
Optional named join mapping passed to |
predictor_cols |
Optional predictor columns to mark for modelling.
If |
outcome_cols |
Optional outcome columns to mark for modelling. |
covariate_cols |
Optional covariate columns to mark for modelling. |
scale_predictors |
Should numeric predictor columns be z-scaled? |
scaled_suffix |
Suffix for scaled predictor columns. |
drop_missing_outcomes |
Should rows with missing values in any
|
keep_all |
Should all rows from |
A tibble with class gp3_multimodal_data. Attributes contain join
settings, selected predictors, outcomes, covariates, and scaling metadata.
face_windows <- data.frame( participant_id = c("P001", "P002"), trial_id = c(1, 1), AU12_r_mean = c(0.2, 0.3), face_confidence_mean = c(0.95, 0.94) ) responses <- data.frame( participant_id = c("P001", "P002"), trial_id = c(1, 1), rating = c(4, 5) ) prepare_gazepoint_multimodal_data( face_windows, response_data = responses, by = c("participant_id", "trial_id"), outcome_cols = "rating", predictor_cols = "AU12_r_mean" )face_windows <- data.frame( participant_id = c("P001", "P002"), trial_id = c(1, 1), AU12_r_mean = c(0.2, 0.3), face_confidence_mean = c(0.95, 0.94) ) responses <- data.frame( participant_id = c("P001", "P002"), trial_id = c(1, 1), rating = c(4, 5) ) prepare_gazepoint_multimodal_data( face_windows, response_data = responses, by = c("participant_id", "trial_id"), outcome_cols = "rating", predictor_cols = "AU12_r_mean" )
Prepare binned pupil time-course data for GAMM modelling with mgcv::bam().
The function aggregates processed sample-level pupil data into subject-by-
condition-by-time-bin rows and creates an AR.start indicator for
autoregressive GAMM models.
prepare_gazepoint_pupil_gamm_data( data, pupil_col = NULL, time_col = "time", subject_col = "subject", condition_col = "condition", x_col = NULL, y_col = NULL, group_cols = c("subject", "condition"), bin_width_ms = 50, time_window = NULL, min_valid_samples = 1, missing_condition_label = "all_data" )prepare_gazepoint_pupil_gamm_data( data, pupil_col = NULL, time_col = "time", subject_col = "subject", condition_col = "condition", x_col = NULL, y_col = NULL, group_cols = c("subject", "condition"), bin_width_ms = 50, time_window = NULL, min_valid_samples = 1, missing_condition_label = "all_data" )
data |
A Gazepoint sample-level data frame, usually after pupil preprocessing, interpolation, baseline correction, and optional smoothing. |
pupil_col |
Name of the pupil column to aggregate. If |
time_col |
Name of the time column in milliseconds. If the requested column is not available, the function tries common alternatives. |
subject_col |
Name of the subject column. If unavailable, the function tries common participant identifiers. |
condition_col |
Name of the condition column. If unavailable or entirely missing, a single condition label is used. |
x_col |
Optional gaze x-coordinate column. If |
y_col |
Optional gaze y-coordinate column. If |
group_cols |
Columns defining independent time series before binning.
Defaults to |
bin_width_ms |
Width of time bins in milliseconds. |
time_window |
Optional numeric vector of length 2 giving the time window to retain before binning. |
min_valid_samples |
Minimum number of valid pupil samples required for a bin to be retained. |
missing_condition_label |
Label used when condition values are missing or when no usable condition column is available. |
A tibble with binned pupil time-course data for GAMM modelling.
Prepare pupil-window summaries or pupil trial-feature tables for confirmatory window-level modelling. The function standardises subject, condition, window, trial/media identifiers, outcome, valid-sample counts, total-sample counts, valid-sample proportions, weights, and model-readiness status columns.
prepare_gazepoint_pupil_window_model_data( data, outcome_col = "mean_pupil", subject_col = "subject", condition_col = "condition", window_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", trial_col = NULL, media_col = "media_id", valid_samples_col = "n_valid_pupil", total_samples_col = "n_samples", min_valid_samples = 5, min_valid_prop = 0.7, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "pupil" )prepare_gazepoint_pupil_window_model_data( data, outcome_col = "mean_pupil", subject_col = "subject", condition_col = "condition", window_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", trial_col = NULL, media_col = "media_id", valid_samples_col = "n_valid_pupil", total_samples_col = "n_samples", min_valid_samples = 5, min_valid_prop = 0.7, drop_invalid = TRUE, missing_condition_label = "all_data", outcome_label = "pupil" )
data |
Pupil-window summary data. |
outcome_col |
Column containing the pupil outcome to model. The default
is |
subject_col |
Subject/participant column. |
condition_col |
Optional condition column. Common aliases such as
|
window_col |
Pupil-window label column. |
window_start_col |
Optional window-start column. |
window_end_col |
Optional window-end column. |
trial_col |
Optional trial identifier column. |
media_col |
Optional media/stimulus identifier column. Common aliases
such as |
valid_samples_col |
Optional column containing the number of valid
pupil samples in the window. Common aliases such as |
total_samples_col |
Optional column containing the total number of
samples in the window. Common aliases such as |
min_valid_samples |
Minimum acceptable number of valid pupil samples. |
min_valid_prop |
Minimum acceptable valid-sample proportion. |
drop_invalid |
Logical. If |
missing_condition_label |
Label used when condition is missing. |
outcome_label |
Label stored in the output to identify the modelled pupil outcome. |
A tibble of pupil-window rows prepared for confirmatory modelling.
Convert a gp3tools master table into a dependency-free,
pupillometryR-friendly sample-level pupil table. The returned data frame keeps
one row per sample and creates standard participant, trial, time, pupil,
condition, event, baseline, validity, trackloss, and status columns.
prepare_gazepoint_pupillometryr_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, pupil_col = NULL, media_col = NULL, condition_col = NULL, event_col = NULL, baseline_col = NULL, validity_cols = NULL, pupil_status_col = NULL, trackloss_col = NULL, invalid_pupil_status = c("missing", "artifact", "blink", "trackloss", "track_loss", "invalid", "excluded", "bad", "outlier"), keep_original_cols = TRUE )prepare_gazepoint_pupillometryr_data( data, participant_col = NULL, trial_col = NULL, time_col = NULL, pupil_col = NULL, media_col = NULL, condition_col = NULL, event_col = NULL, baseline_col = NULL, validity_cols = NULL, pupil_status_col = NULL, trackloss_col = NULL, invalid_pupil_status = c("missing", "artifact", "blink", "trackloss", "track_loss", "invalid", "excluded", "bad", "outlier"), keep_original_cols = TRUE )
data |
A Gazepoint master table or sample-level gaze/pupil data frame. |
participant_col |
Participant/subject identifier column. |
trial_col |
Trial identifier column. If |
time_col |
Sample time column. |
pupil_col |
Pupil column to export. |
media_col |
Optional media/stimulus identifier column. |
condition_col |
Optional condition/grouping column. |
event_col |
Optional event/marker column. |
baseline_col |
Optional baseline-period indicator column. |
validity_cols |
Optional validity columns used to define trackloss. |
pupil_status_col |
Optional pupil-status column used to mark invalid pupil samples. |
trackloss_col |
Optional existing trackloss column. If supplied, it is used directly after coercion to logical. |
invalid_pupil_status |
Character values in |
keep_original_cols |
Logical. If |
A tibble with class gp3_pupillometryr_data.
Convert ordered AOI/state observations into state-visit and transition-level semi-Markov data. Consecutive repeated states can be collapsed into dwell episodes, producing one row per state visit with dwell duration and next-state information.
prepare_gazepoint_semimarkov_data( data, state_col = NULL, participant_col = NULL, trial_col = NULL, time_col = NULL, duration_col = NULL, sequence_id_cols = NULL, covariate_cols = NULL, exclude_states = c("missing", "missing_aoi", "missing_coordinate", "trackloss", "track_loss"), missing_state_label = NULL, collapse_repeated_states = TRUE, include_terminal_states = TRUE, terminal_next_state_label = "END", name = "gazepoint_semimarkov_data" )prepare_gazepoint_semimarkov_data( data, state_col = NULL, participant_col = NULL, trial_col = NULL, time_col = NULL, duration_col = NULL, sequence_id_cols = NULL, covariate_cols = NULL, exclude_states = c("missing", "missing_aoi", "missing_coordinate", "trackloss", "track_loss"), missing_state_label = NULL, collapse_repeated_states = TRUE, include_terminal_states = TRUE, terminal_next_state_label = "END", name = "gazepoint_semimarkov_data" )
data |
A data frame containing ordered AOI/state observations. |
state_col |
AOI/state column. If |
participant_col |
Optional participant/subject column. |
trial_col |
Optional trial/sequence column. |
time_col |
Optional time/order column. |
duration_col |
Optional sample-duration column. If supplied, dwell durations are computed by summing this column within each state visit. |
sequence_id_cols |
Optional character vector of columns defining separate
sequences. If |
covariate_cols |
Optional character vector of covariate columns to carry into the state-visit and transition tables using the first value within each state visit. |
exclude_states |
Character vector of states to exclude before creating state visits. |
missing_state_label |
Optional label used to retain missing states. If
|
collapse_repeated_states |
Logical. If |
include_terminal_states |
Logical. If |
terminal_next_state_label |
Label used for the terminal next state. |
name |
Character label stored in the returned object. |
A list with class gp3_semimarkov_data.
prepare_gazepoint_timecourse_test_data() converts a long-format
subject-by-condition-by-time data frame into the internal column contract used
by run_gazepoint_cluster_permutation(). It is intended for conservative
two-condition, within-subject, one-dimensional time-course workflows.
prepare_gazepoint_timecourse_test_data( data, subject_col, condition_col, time_col, outcome_col, condition_order = NULL, aggregate_fun = mean, complete_only = TRUE )prepare_gazepoint_timecourse_test_data( data, subject_col, condition_col, time_col, outcome_col, condition_order = NULL, aggregate_fun = mean, complete_only = TRUE )
data |
A long-format data frame. |
subject_col |
Column identifying participants or paired units. |
condition_col |
Column identifying the two within-subject conditions. |
time_col |
Numeric time or time-bin column. |
outcome_col |
Numeric outcome column. |
condition_order |
Optional character vector of length two giving the condition order used for contrasts. |
aggregate_fun |
Function used when duplicate subject-condition-time rows
are present. Defaults to |
complete_only |
If |
A data frame with internal cluster columns:
.gp3_cluster_subject, .gp3_cluster_condition,
.gp3_cluster_time_bin, and .gp3_cluster_outcome.
d <- data.frame( subject = rep(1:4, each = 6), condition = rep(rep(c("A", "B"), each = 3), 4), time = rep(1:3, 8), value = rnorm(24) ) prepare_gazepoint_timecourse_test_data( d, subject_col = "subject", condition_col = "condition", time_col = "time", outcome_col = "value" )d <- data.frame( subject = rep(1:4, each = 6), condition = rep(rep(c("A", "B"), each = 3), 4), time = rep(1:3, 8), value = rnorm(24) ) prepare_gazepoint_timecourse_test_data( d, subject_col = "subject", condition_col = "condition", time_col = "time", outcome_col = "value" )
Convert long AOI observations into one row per sequence and one column per
ordered state position. If TraMineR is installed and
as_traminer = TRUE, the function also returns a TraMineR sequence
object.
prepare_gazepoint_traminer_data( data, aoi_col, sequence_cols, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, state_prefix = "state_", as_traminer = FALSE )prepare_gazepoint_traminer_data( data, aoi_col, sequence_cols, time_col = NULL, include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, state_prefix = "state_", as_traminer = FALSE )
data |
Long-format AOI data. |
aoi_col |
AOI/state column. |
sequence_cols |
Columns defining each sequence. |
time_col |
Optional ordering column. |
include_missing |
Should missing AOIs be kept as a state? |
missing_label |
Label used for retained missing AOIs. |
collapse_repeats |
Should consecutive repeated states be collapsed? |
state_prefix |
Prefix for wide state columns. |
as_traminer |
Should TraMineR::seqdef() be called if available? |
A list containing wide data, state columns, alphabet, and optionally a TraMineR sequence object.
Orchestrate transparent blink, pupil, coordinate, downsampling, and velocity-based fixation-processing steps while preserving the original input columns. Every requested operation is recorded in a decision log.
preprocess_gazepoint_signals( data, id_col = "USER_ID", group_cols = NULL, time_col = "TIME", x_col = "FPOGX", y_col = "FPOGY", left_pupil_col = NULL, right_pupil_col = NULL, pupil_col = NULL, pupil_mode = c("mean", "regression", "none"), detect_blinks = TRUE, interpolate_blinks = TRUE, smooth_pupil = TRUE, smooth_coordinates = TRUE, downsample_factor = 1L, detect_fixations = TRUE, blink_args = list(), interpolation_args = list(), pupil_args = list(), pupil_smoothing_args = list(), coordinate_smoothing_args = list(), downsampling_args = list(), fixation_args = list() )preprocess_gazepoint_signals( data, id_col = "USER_ID", group_cols = NULL, time_col = "TIME", x_col = "FPOGX", y_col = "FPOGY", left_pupil_col = NULL, right_pupil_col = NULL, pupil_col = NULL, pupil_mode = c("mean", "regression", "none"), detect_blinks = TRUE, interpolate_blinks = TRUE, smooth_pupil = TRUE, smooth_coordinates = TRUE, downsample_factor = 1L, detect_fixations = TRUE, blink_args = list(), interpolation_args = list(), pupil_args = list(), pupil_smoothing_args = list(), coordinate_smoothing_args = list(), downsampling_args = list(), fixation_args = list() )
data |
A sample-level Gazepoint or gp3tools data frame. |
id_col |
Participant identifier column. |
group_cols |
Optional additional columns defining independent time series, such as trial or stimulus. |
time_col |
Timestamp column. |
x_col, y_col
|
Gaze-coordinate columns. |
left_pupil_col, right_pupil_col
|
Optional binocular pupil columns.
When |
pupil_col |
Optional existing monocular or fused pupil column used when
|
pupil_mode |
Binocular fusion mode: |
detect_blinks |
Should |
interpolate_blinks |
Should detected blink intervals be interpolated? |
smooth_pupil |
Should |
smooth_coordinates |
Should |
downsample_factor |
Positive integer downsampling factor. Use |
detect_fixations |
Should |
blink_args |
Named list overriding blink-detection defaults. |
interpolation_args |
Named list overriding blink-interpolation defaults. |
pupil_args |
Named list overriding binocular fusion defaults. |
pupil_smoothing_args |
Named list overriding pupil-smoothing defaults. |
coordinate_smoothing_args |
Named list overriding coordinate-smoothing defaults. |
downsampling_args |
Named list overriding downsampling defaults. |
fixation_args |
Named list overriding fixation-detection defaults. |
An object of class "gp3_signal_preprocessing_result" containing
processed data, detected blinks, detected fixations, diagnostic
tables, a decision_log, and resolved settings.
pupil <- data.frame( USER_ID = rep("P01", 30), trial = rep("T01", 30), TIME = seq(0, 0.29, by = 0.01), FPOGX = c(rep(0.25, 15), rep(0.75, 15)), FPOGY = 0.50, LPupil = c(rep(3.2, 10), NA, NA, rep(3.2, 18)), RPupil = c(rep(3.1, 10), NA, NA, rep(3.1, 18)) ) result <- preprocess_gazepoint_signals( pupil, group_cols = "trial", downsample_factor = 2 ) result$decision_logpupil <- data.frame( USER_ID = rep("P01", 30), trial = rep("T01", 30), TIME = seq(0, 0.29, by = 0.01), FPOGX = c(rep(0.25, 15), rep(0.75, 15)), FPOGY = 0.50, LPupil = c(rep(3.2, 10), NA, NA, rep(3.2, 18)), RPupil = c(rep(3.1, 10), NA, NA, rep(3.1, 18)) ) result <- preprocess_gazepoint_signals( pupil, group_cols = "trial", downsample_factor = 2 ) result$decision_log
Reads Gazepoint all-gaze and fixation CSV exports, standardises timestamped column names, and removes empty trailing columns produced by Gazepoint exports.
read_gazepoint(path, standardise_names = TRUE, drop_empty_cols = TRUE)read_gazepoint(path, standardise_names = TRUE, drop_empty_cols = TRUE)
path |
Path to a Gazepoint CSV export. |
standardise_names |
Logical. If |
drop_empty_cols |
Logical. If |
A tibble with attributes gp3_file_type and gp3_source_file.
Reads one or more external facial-analysis CSV files into a single tidy table. The helper is designed for outputs produced outside Gazepoint, such as OpenFace-, py-feat-, MediaPipe-, FaceReader-, or generic frame-level facial behaviour exports. It does not infer facial expressions from Gazepoint CSV files.
read_gazepoint_face_export( path, source = c("auto", "openface", "pyfeat", "mediapipe", "facereader", "generic"), participant_id = NULL, session_id = NULL, recursive = TRUE, trim_names = TRUE, encoding = "UTF-8", na = c("", "NA", "NaN"), ... )read_gazepoint_face_export( path, source = c("auto", "openface", "pyfeat", "mediapipe", "facereader", "generic"), participant_id = NULL, session_id = NULL, recursive = TRUE, trim_names = TRUE, encoding = "UTF-8", na = c("", "NA", "NaN"), ... )
path |
Path to one CSV file, several CSV files, or a directory containing CSV files. |
source |
Facial-analysis source. Use |
participant_id |
Optional participant identifier. Either length one or the same length as the number of files read. |
session_id |
Optional session identifier. Either length one or the same length as the number of files read. |
recursive |
If |
trim_names |
Should leading and trailing whitespace be removed from column names? |
encoding |
File encoding passed to |
na |
Character values treated as missing. |
... |
Additional arguments passed to |
A tibble with metadata columns identifying the source file and
detected source. The returned object has class gp3_face_export.
tmp <- tempfile(fileext = ".csv") write.csv( data.frame( frame = 1:2, timestamp = c(0, 0.033), confidence = c(0.98, 0.97), success = c(1, 1), AU12_r = c(0.1, 0.2) ), tmp, row.names = FALSE ) read_gazepoint_face_export(tmp)tmp <- tempfile(fileext = ".csv") write.csv( data.frame( frame = 1:2, timestamp = c(0, 0.033), confidence = c(0.98, 0.97), success = c(1, 1), AU12_r = c(0.1, 0.2) ), tmp, row.names = FALSE ) read_gazepoint_face_export(tmp)
Reads all Gazepoint all-gaze or fixation CSV exports in a folder that match a filename pattern and combines them into one tibble.
read_gazepoint_folder( folder, pattern = "\\.csv$", source_col = "USER_FILE", recursive = FALSE, ... )read_gazepoint_folder( folder, pattern = "\\.csv$", source_col = "USER_FILE", recursive = FALSE, ... )
folder |
Path to the folder containing Gazepoint CSV exports. |
pattern |
Regular expression used to select files. For example,
|
source_col |
Name of the column storing the source filename. |
recursive |
Logical. If |
... |
Additional arguments passed to |
A tibble containing all matching files combined row-wise.
Parses the multi-section Data_Summary_export_*.csv file into metadata,
aoi_summary, and aoi_by_user tables.
read_gazepoint_summary(path)read_gazepoint_summary(path)
path |
Path to |
A list with metadata, aoi_summary, and aoi_by_user.
Apply an offline drift-correction shift to Gazepoint gaze coordinates using known fixation/check-target coordinates. For each group, the helper estimates the horizontal and vertical gaze offset from valid target samples and applies the correction to all gaze samples in the same group.
recalibrate_gazepoint_gaze( data, x_col, y_col, target_x_col, target_y_col, time_col = NULL, grouping_cols = NULL, calibration_col = NULL, calibration_value = NULL, method = c("median_shift", "mean_shift"), min_valid_points = 3L, max_shift = NULL, output_x_col = "gaze_x_recalibrated", output_y_col = "gaze_y_recalibrated", dx_col = "gaze_recalibration_dx", dy_col = "gaze_recalibration_dy", shift_col = "gaze_recalibration_shift", error_before_col = "gaze_error_before_recalibration", error_after_col = "gaze_error_after_recalibration", status_col = "gaze_recalibration_status", overwrite = FALSE, name = "gazepoint_gaze_recalibration" )recalibrate_gazepoint_gaze( data, x_col, y_col, target_x_col, target_y_col, time_col = NULL, grouping_cols = NULL, calibration_col = NULL, calibration_value = NULL, method = c("median_shift", "mean_shift"), min_valid_points = 3L, max_shift = NULL, output_x_col = "gaze_x_recalibrated", output_y_col = "gaze_y_recalibrated", dx_col = "gaze_recalibration_dx", dy_col = "gaze_recalibration_dy", shift_col = "gaze_recalibration_shift", error_before_col = "gaze_error_before_recalibration", error_after_col = "gaze_error_after_recalibration", status_col = "gaze_recalibration_status", overwrite = FALSE, name = "gazepoint_gaze_recalibration" )
data |
A data frame containing gaze and target coordinates. |
x_col |
Horizontal gaze coordinate column. |
y_col |
Vertical gaze coordinate column. |
target_x_col |
Known horizontal target coordinate column. |
target_y_col |
Known vertical target coordinate column. |
time_col |
Optional time column used only for stable ordering. |
grouping_cols |
Optional grouping columns used to estimate one correction per participant, trial, block, stimulus, or other unit. |
calibration_col |
Optional column identifying rows to use for estimating the correction. |
calibration_value |
Optional value in |
method |
Shift estimator. |
min_valid_points |
Minimum valid target/gaze pairs required per group. |
max_shift |
Optional maximum Euclidean correction shift. If exceeded, the shift is reported but not applied. |
output_x_col |
Corrected horizontal gaze output column. |
output_y_col |
Corrected vertical gaze output column. |
dx_col |
Estimated horizontal correction column. |
dy_col |
Estimated vertical correction column. |
shift_col |
Estimated Euclidean shift-distance column. |
error_before_col |
Row-wise gaze-to-target error before correction. |
error_after_col |
Row-wise gaze-to-target error after correction. |
status_col |
Row-level recalibration status column. |
overwrite |
Logical. If |
name |
Character label stored in object attributes. |
This helper is useful only when known target coordinates are available, for example from calibration checks, fixation targets, validation targets, or drift-check trials.
A tibble with recalibrated gaze columns and recalibration attributes.
Create explicit trial-level and participant-level exclusion recommendations from Gazepoint sample-level quality information. The helper can use validity flags, gaze-coordinate missingness, pupil missingness, and optional artifact flags to produce transparent exclusion tables.
recommend_gazepoint_exclusions( data, participant_col, trial_col = NULL, condition_col = NULL, validity_col = NULL, x_col = NULL, y_col = NULL, pupil_col = NULL, artifact_col = NULL, min_trial_samples = 10L, max_trial_missing_prop = 0.5, max_trial_artifact_prop = 0.5, min_participant_trials = 2L, min_participant_valid_trials = 1L, max_participant_missing_prop = 0.5, max_participant_artifact_prop = 0.5, require_both_gaze_coordinates = TRUE, name = "gazepoint_exclusion_recommendations" )recommend_gazepoint_exclusions( data, participant_col, trial_col = NULL, condition_col = NULL, validity_col = NULL, x_col = NULL, y_col = NULL, pupil_col = NULL, artifact_col = NULL, min_trial_samples = 10L, max_trial_missing_prop = 0.5, max_trial_artifact_prop = 0.5, min_participant_trials = 2L, min_participant_valid_trials = 1L, max_participant_missing_prop = 0.5, max_participant_artifact_prop = 0.5, require_both_gaze_coordinates = TRUE, name = "gazepoint_exclusion_recommendations" )
data |
A data frame containing sample-level or trial-level data. |
participant_col |
Participant identifier column. |
trial_col |
Optional trial identifier column. |
condition_col |
Optional condition column retained in summaries. |
validity_col |
Optional logical/numeric/character validity column. |
x_col |
Optional horizontal gaze coordinate column. |
y_col |
Optional vertical gaze coordinate column. |
pupil_col |
Optional pupil column. |
artifact_col |
Optional logical/numeric/character artifact flag column. |
min_trial_samples |
Minimum samples required per trial. |
max_trial_missing_prop |
Maximum missing/unusable sample proportion per trial. |
max_trial_artifact_prop |
Maximum artifact proportion per trial. |
min_participant_trials |
Minimum total trials required per participant. |
min_participant_valid_trials |
Minimum retained trials required per participant. |
max_participant_missing_prop |
Maximum missing/unusable sample proportion per participant. |
max_participant_artifact_prop |
Maximum artifact proportion per participant. |
require_both_gaze_coordinates |
Logical. If both gaze columns are supplied, should a sample be usable only when both coordinates are finite? |
name |
Character label stored in object attributes. |
This function recommends exclusions only. It does not remove rows.
A list with overview, trial recommendations, participant recommendations, an explicit exclusion table, and settings.
Maps common eye-tracking and pupillometry metrics to suitable statistical model families, transformations, and modelling notes. The helper is intended for planning and reporting; it does not fit a model.
recommend_gazepoint_model_family(metric = NULL)recommend_gazepoint_model_family(metric = NULL)
metric |
Character vector of metric names. If |
A data frame with metric, data property, recommended family, common transformation, and notes.
Applies a declared reconstruction policy without overwriting the original eye channels. Linear-regression reconstruction uses separately fitted left-from-right and right-from-left models, explicit eligibility gates, gap-duration restrictions, extrapolation controls, physiological bounds, and row-level provenance.
reconstruct_gazepoint_binocular_pupil( data, left_col, right_col, time_col = NULL, group_cols = NULL, gap_group_cols = NULL, method = c("linear_regression", "available_eye", "none"), calibration = NULL, fallback_group_cols = NULL, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, time_unit = c("auto", "milliseconds", "seconds"), max_gap_ms = Inf, allow_edge_gaps = TRUE, allow_extrapolation = FALSE, valid_min = NULL, valid_max = NULL, exclude_flag_cols = NULL, prefix = "gp3_binocular", overwrite = FALSE )reconstruct_gazepoint_binocular_pupil( data, left_col, right_col, time_col = NULL, group_cols = NULL, gap_group_cols = NULL, method = c("linear_regression", "available_eye", "none"), calibration = NULL, fallback_group_cols = NULL, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, time_unit = c("auto", "milliseconds", "seconds"), max_gap_ms = Inf, allow_edge_gaps = TRUE, allow_extrapolation = FALSE, valid_min = NULL, valid_max = NULL, exclude_flag_cols = NULL, prefix = "gp3_binocular", overwrite = FALSE )
data |
A data frame containing pupil channels. |
left_col, right_col
|
Numeric pupil columns. |
time_col |
Optional numeric time column. Required when |
group_cols |
Primary calibration grouping columns. |
gap_group_cols |
Optional grouping columns used only to define temporal
missing-eye runs. When |
method |
Reconstruction policy: |
calibration |
Optional result from |
fallback_group_cols, min_pairs, min_unique, min_r2
|
Calibration settings
used only when |
time_unit |
Unit for |
max_gap_ms |
Maximum contiguous missing-eye run eligible for model-based
reconstruction. |
allow_edge_gaps |
Whether missing runs touching a group boundary may be reconstructed from the simultaneously observed contralateral eye. |
allow_extrapolation |
Whether predictions outside the calibration predictor range are allowed. |
valid_min, valid_max
|
Optional bounds applied both to observed values used by this workflow and to predictions. |
exclude_flag_cols |
Optional logical/numeric flag columns. Rows flagged in any supplied column are not reconstructed. |
prefix |
Prefix for added provenance and reconstructed-channel columns. |
overwrite |
Whether existing output columns with this prefix may be replaced. |
Reconstructed values are predictions from the contralateral eye; they are never labelled as measurements. Temporal interpolation and cross-eye reconstruction solve different missing-data problems and are deliberately kept separate.
The input data with additional observed, final-channel, reconstruction,
model, gap, and status columns. Original pupil columns are untouched. A
gp3_binocular_reconstruction metadata attribute records the declared policy
and calibration object.
Ong J, He W, Maglanque P, Jiang X, Gillman LM, Vergis A, Hardy K (2025). A Preprocessing Pipeline for Pupillometry Signal from Multimodal iMotion Data. Sensors, 25(15), 4737. doi:10.3390/s25154737
construct_gazepoint_combined_pupil(),
validate_gazepoint_binocular_reconstruction()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 13) dat$pupil_left[40:43] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", min_pairs = 20 ) table(rec$gp3_binocular_status)dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 13) dat$pupil_left[40:43] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", min_pairs = 20 ) table(rec$gp3_binocular_status)
Fits cross-eye regressions within independent sequences and creates a regression-smoothed binocular pupil trace. The function is diagnostic and preprocessing-oriented; it does not imply that one eye causally predicts the other.
regress_gazepoint_pupils( master_df, lp_col = "LPupil", rp_col = "RPupil", id_col = "USER_ID", group_cols = NULL, direction = c("bidirectional", "right_on_left", "left_on_right"), output_col = "pupil_regressed", residual_col = "pupil_regression_residual", min_complete = 10 )regress_gazepoint_pupils( master_df, lp_col = "LPupil", rp_col = "RPupil", id_col = "USER_ID", group_cols = NULL, direction = c("bidirectional", "right_on_left", "left_on_right"), output_col = "pupil_regressed", residual_col = "pupil_regression_residual", min_complete = 10 )
master_df |
A sample-level pupil data frame. |
lp_col, rp_col
|
Left- and right-pupil columns. |
id_col |
Participant identifier. |
group_cols |
Optional additional independent-sequence columns. |
direction |
Regression direction. |
output_col |
Name of the fused pupil column. |
residual_col |
Name of the right-on-left residual column. |
min_complete |
Minimum complete binocular samples required for regression. Groups below this threshold use the binocular mean. |
The input data with regression-smoothed pupil columns.
pupil <- data.frame( USER_ID = rep("P01", 20), LPupil = seq(3, 4, length.out = 20), RPupil = seq(3.1, 4.1, length.out = 20) ) regress_gazepoint_pupils(pupil)pupil <- data.frame( USER_ID = rep("P01", 20), LPupil = seq(3, 4, length.out = 20), RPupil = seq(3.1, 4.1, length.out = 20) ) regress_gazepoint_pupils(pupil)
Create a compact, cautious, text-ready report from a cluster-permutation result. The report avoids exact onset/offset claims and describes detected clusters as time ranges surviving the specified cluster procedure.
report_gazepoint_cluster_permutation(result, alpha = 0.05)report_gazepoint_cluster_permutation(result, alpha = 0.05)
result |
A result object returned by
|
alpha |
Significance threshold. |
A list with cluster table, settings, and report text.
Creates a compact markdown or list report from facial-behaviour quality, synchronisation, window-summary, reactivity, and modelling objects. The report is designed for transparent methods/supplementary reporting. It does not infer facial expressions or emotional states.
report_gazepoint_face_qc( face_data = NULL, quality_audit = NULL, sync_audit = NULL, window_summary = NULL, reactivity_summary = NULL, multimodal_model = NULL, checklist = NULL, output = c("markdown", "list"), include_cautions = TRUE )report_gazepoint_face_qc( face_data = NULL, quality_audit = NULL, sync_audit = NULL, window_summary = NULL, reactivity_summary = NULL, multimodal_model = NULL, checklist = NULL, output = c("markdown", "list"), include_cautions = TRUE )
face_data |
Optional imported or standardised face-analysis data. |
quality_audit |
Optional object returned by
|
sync_audit |
Optional object returned by |
window_summary |
Optional object returned by
|
reactivity_summary |
Optional object returned by
|
multimodal_model |
Optional object returned by a gp3tools multimodal modelling helper. |
checklist |
Optional checklist returned by
|
output |
Output format. |
include_cautions |
Should interpretation cautions be included? |
A markdown character vector with class gp3_face_qc_report, or a list
with class gp3_face_qc_report_list.
quality <- list( overview = data.frame( n_rows = 10, valid_percent = 95, face_quality_status = "pass" ), issue_summary = data.frame( issue = "missing_confidence", n_groups_affected = 0 ) ) class(quality) <- c("gp3_face_quality_audit", "list") report_gazepoint_face_qc(quality_audit = quality)quality <- list( overview = data.frame( n_rows = 10, valid_percent = 95, face_quality_status = "pass" ), issue_summary = data.frame( issue = "missing_confidence", n_groups_affected = 0 ) ) class(quality) <- c("gp3_face_quality_audit", "list") report_gazepoint_face_qc(quality_audit = quality)
Produces a compact, cautious text summary of missingness rates. The report is intended for transparent methods/results documentation and does not recommend exclusions.
report_gazepoint_missingness( data, cols = NULL, group_cols = NULL, digits = 1, max_variables = 5 )report_gazepoint_missingness( data, cols = NULL, group_cols = NULL, digits = 1, max_variables = 5 )
data |
A data frame or a missingness summary produced by
|
cols |
Optional columns to summarize when |
group_cols |
Optional grouping columns when |
digits |
Number of decimal places for percentages. |
max_variables |
Maximum number of highest-missingness variables to name in the report text. |
A list with summary, overall, and report_text.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) report_gazepoint_missingness( x, cols = c("pupil_left", "pupil_right", "pupil") )x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) report_gazepoint_missingness( x, cols = c("pupil_left", "pupil_right", "pupil") )
Create compact branch-, status-, and term-level summaries from a multiverse result object. This helper is intentionally generic and can summarise the package's multiverse output after it has been tidied to data frames.
report_gazepoint_multiverse( multiverse_results, branch_col = NULL, term_col = NULL, estimate_col = NULL, p_col = NULL, status_col = NULL, alpha = 0.05 )report_gazepoint_multiverse( multiverse_results, branch_col = NULL, term_col = NULL, estimate_col = NULL, p_col = NULL, status_col = NULL, alpha = 0.05 )
multiverse_results |
A data frame, or a list containing data frames. |
branch_col |
Optional branch/specification column. |
term_col |
Optional model term column. |
estimate_col |
Optional estimate/effect column. |
p_col |
Optional p-value column. |
status_col |
Optional status column. |
alpha |
Significance threshold used for descriptive counts. |
A list with branch, status, and term summaries.
Produces compact, cautious text describing task-phase data coverage. The report is intended for methods/results documentation and does not define exclusion rules.
report_gazepoint_phase_coverage( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, value_cols = NULL, digits = 1 )report_gazepoint_phase_coverage( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, value_cols = NULL, digits = 1 )
data |
A raw data frame or a summary produced by
|
phase_col, group_cols, time_col, value_cols
|
Arguments used when |
digits |
Number of decimal places used in report percentages. |
A list with summary, overall, and report_text.
x <- data.frame(time_ms = c(0, 250, 750, 1250), value = c(1, NA, 3, 4)) windows <- data.frame(phase = c("baseline", "stimulus"), start = c(0, 500), end = c(500, 1500)) segmented <- segment_gazepoint_task_phases(x, "time_ms", windows) report_gazepoint_phase_coverage(segmented, phase_col = "task_phase", time_col = "time_ms")x <- data.frame(time_ms = c(0, 250, 750, 1250), value = c(1, NA, 3, 4)) windows <- data.frame(phase = c("baseline", "stimulus"), start = c(0, 500), end = c(500, 1500)) segmented <- segment_gazepoint_task_phases(x, "time_ms", windows) report_gazepoint_phase_coverage(segmented, phase_col = "task_phase", time_col = "time_ms")
Produces compact, cautious text from a QC summary bundle. The report describes available QC outputs and status patterns, but it does not replace the underlying audit, readiness-gate, checklist, or exclusion-recommendation functions.
report_gazepoint_qc_overview(qc_bundle, max_objects = 5)report_gazepoint_qc_overview(qc_bundle, max_objects = 5)
qc_bundle |
A |
max_objects |
Maximum number of non-pass objects to name in the report. |
A list with summary, object_summary, and report_text.
x <- list(overview = data.frame(audit_status = "review", message = "Check coverage.")) report_gazepoint_qc_overview(list(example = x))x <- list(overview = data.frame(audit_status = "review", message = "Check coverage.")) report_gazepoint_qc_overview(list(example = x))
Run all AOI preprocessing branches defined by
create_gazepoint_preprocessing_multiverse(). Each branch creates AOI-window
summaries and then prepares binomial AOI GLMM data using the branch-specific
denominator and minimum denominator threshold.
run_gazepoint_aoi_multiverse( data, multiverse, branch_ids = NULL, windows, time_col = "time", aoi_col = "aoi_current", subject_col = "subject", condition_col = NULL, group_cols = NULL, target_aoi_values, distractor_aoi_values = NULL, success_col = "n_target_samples", outcome_label = "target", keep_outputs = TRUE, stop_on_error = FALSE )run_gazepoint_aoi_multiverse( data, multiverse, branch_ids = NULL, windows, time_col = "time", aoi_col = "aoi_current", subject_col = "subject", condition_col = NULL, group_cols = NULL, target_aoi_values, distractor_aoi_values = NULL, success_col = "n_target_samples", outcome_label = "target", keep_outputs = TRUE, stop_on_error = FALSE )
data |
A Gazepoint master table or sample-level AOI table. |
multiverse |
A |
branch_ids |
Optional character vector of AOI branch IDs to run. |
windows |
Numeric vector or labelled window table passed to
|
time_col |
Time column. |
aoi_col |
AOI-state column. |
subject_col |
Subject column. |
condition_col |
Optional condition column. |
group_cols |
Optional grouping columns for AOI-window summaries. |
target_aoi_values |
Target AOI values. |
distractor_aoi_values |
Optional distractor AOI values. |
success_col |
Success-count column passed to
|
outcome_label |
Outcome label passed to AOI helpers. |
keep_outputs |
Logical. If |
stop_on_error |
Logical. If |
A list with class gp3_aoi_multiverse_results containing overview,
branch results, optional branch outputs, and settings.
Run a paired cluster-based permutation test on time-course data prepared by
prepare_gazepoint_cluster_data(). The function tests whether two
conditions diverge over time while controlling cluster-level inference using
a permutation distribution of maximum cluster statistics.
run_gazepoint_cluster_permutation( data, condition_order = NULL, n_permutations = 1000, cluster_threshold = 2, tail = c("two_sided", "greater", "less"), cluster_stat = c("sum_abs_t", "sum_t", "size"), min_time_bins = 1, seed = NULL, paired = TRUE )run_gazepoint_cluster_permutation( data, condition_order = NULL, n_permutations = 1000, cluster_threshold = 2, tail = c("two_sided", "greater", "less"), cluster_stat = c("sum_abs_t", "sum_t", "size"), min_time_bins = 1, seed = NULL, paired = TRUE )
data |
Cluster-ready data produced by
|
condition_order |
Optional character vector of length 2 defining the two conditions and their order. The tested difference is condition 2 minus condition 1. |
n_permutations |
Number of sign-flip permutations. |
cluster_threshold |
Absolute t-statistic threshold for forming
candidate clusters. For |
tail |
Direction of the test. |
cluster_stat |
Cluster statistic. |
min_time_bins |
Minimum number of adjacent time bins required for a cluster to be retained. |
seed |
Optional random seed for reproducible permutations. |
paired |
Logical. Currently only paired within-subject sign-flip permutation is supported. |
Cluster-based permutation tests are intended for time-course inference. They should not be used to discover a confirmatory time window and then test that same window again in a second confirmatory model.
A list containing observed time-course statistics, observed clusters, the permutation distribution, settings, and status fields.
This function intentionally fails safely. Cluster-permutation ANOVA is not implemented as an active inferential engine in gp3tools because it requires additional design, exchangeability, and error-term choices that are outside the currently validated two-condition workflow.
run_gazepoint_cluster_permutation_anova(...)run_gazepoint_cluster_permutation_anova(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
This function intentionally fails safely. Covariate-adjusted cluster permutation is not implemented as an active inferential engine in gp3tools.
run_gazepoint_cluster_permutation_covariate_adjusted(...)run_gazepoint_cluster_permutation_covariate_adjusted(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
This function intentionally fails safely. Mixed-model cluster permutation is not implemented as an active inferential engine in gp3tools.
run_gazepoint_cluster_permutation_lmer(...)run_gazepoint_cluster_permutation_lmer(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
This function intentionally fails safely. Parallel cluster permutation is not implemented as a separate active engine in gp3tools.
run_gazepoint_cluster_permutation_parallel(...)run_gazepoint_cluster_permutation_parallel(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
Re-run run_gazepoint_cluster_permutation() across a small set of
cluster-forming thresholds and summarize how many clusters are detected.
run_gazepoint_cluster_threshold_sensitivity( data, thresholds = c(1.5, 2, 2.5), ... )run_gazepoint_cluster_threshold_sensitivity( data, thresholds = c(1.5, 2, 2.5), ... )
data |
Prepared cluster-permutation data. |
thresholds |
Numeric vector of cluster-forming thresholds. |
... |
Additional arguments passed to |
A list containing threshold-level summaries and full result objects.
Prepare Gazepoint sample-level gaze data for the optional eyetools package
and, when eyetools is installed, run fixation and/or saccade detection using
eyetools::fixation_dispersion(), eyetools::fixation_VTI(), and/or
eyetools::saccade_VTI().
run_gazepoint_eyetools_fixation_detection( data, participant_col = NULL, trial_col = NULL, time_col = NULL, x_col = NULL, y_col = NULL, condition_col = NULL, stimulus_col = NULL, method = c("dispersion", "vti", "saccade", "all"), sample_rate = NULL, threshold = 100, min_dur = 150, min_dur_sac = 20, disp_tol = 100, NA_tol = 0.25, smooth = FALSE, drop_missing = TRUE, progress = FALSE, name = "gazepoint_eyetools_fixation_detection" )run_gazepoint_eyetools_fixation_detection( data, participant_col = NULL, trial_col = NULL, time_col = NULL, x_col = NULL, y_col = NULL, condition_col = NULL, stimulus_col = NULL, method = c("dispersion", "vti", "saccade", "all"), sample_rate = NULL, threshold = 100, min_dur = 150, min_dur_sac = 20, disp_tol = 100, NA_tol = 0.25, smooth = FALSE, drop_missing = TRUE, progress = FALSE, name = "gazepoint_eyetools_fixation_detection" )
data |
A data frame containing sample-level gaze data. |
participant_col |
Participant/subject column. If |
trial_col |
Trial column. If |
time_col |
Time column. If |
x_col |
Horizontal gaze coordinate column. If |
y_col |
Vertical gaze coordinate column. If |
condition_col |
Optional condition/group column. |
stimulus_col |
Optional stimulus/media column. |
method |
Detector branch. Options are |
sample_rate |
Optional sample rate passed to velocity-threshold functions. |
threshold |
Velocity threshold passed to velocity-threshold functions. |
min_dur |
Minimum fixation duration in milliseconds. |
min_dur_sac |
Minimum saccade duration in milliseconds. |
disp_tol |
Dispersion tolerance in pixels. |
NA_tol |
Missing-data tolerance passed to |
smooth |
Logical; passed to |
drop_missing |
Logical. If |
progress |
Logical. Passed to eyetools detector functions. |
name |
Character label stored in the returned object. |
This helper is an optional external-detector branch. It does not replace the
main gp3tools summaries or AOI/transition workflows.
A list with class gp3_eyetools_fixation_detection.
Prepare Gazepoint pupil data for the optional gazer package and, when
gazer is installed, run a conservative pupil-preprocessing cross-check using
gazeR-style blink extension, smoothing/interpolation, optional baseline
correction, and optional downsampling.
run_gazepoint_gazer_crosscheck( data, participant_col = NULL, trial_col = NULL, time_col = NULL, pupil_col = NULL, condition_col = NULL, message_col = NULL, blink_col = NULL, hz = 60, fillback = 100, fillforward = 100, smooth_n = 5, step_first = c("smooth", "interpolate"), interpolation_type = "linear", maxgap = Inf, baseline_window = NULL, baseline_event = NULL, baseline_dur = 100, baseline_method = "sub", bin_length = NULL, name = "gazepoint_gazer_crosscheck" )run_gazepoint_gazer_crosscheck( data, participant_col = NULL, trial_col = NULL, time_col = NULL, pupil_col = NULL, condition_col = NULL, message_col = NULL, blink_col = NULL, hz = 60, fillback = 100, fillforward = 100, smooth_n = 5, step_first = c("smooth", "interpolate"), interpolation_type = "linear", maxgap = Inf, baseline_window = NULL, baseline_event = NULL, baseline_dur = 100, baseline_method = "sub", bin_length = NULL, name = "gazepoint_gazer_crosscheck" )
data |
A data frame containing Gazepoint or gp3tools pupil time-series data. |
participant_col |
Participant/subject column. If |
trial_col |
Trial column. If |
time_col |
Time column. If |
pupil_col |
Pupil column. If |
condition_col |
Optional condition column. If |
message_col |
Optional message/event column. |
blink_col |
Optional blink/trackloss column. |
hz |
Sampling rate passed to gazeR functions. |
fillback |
Blink-extension window before missing/blink samples, in ms. |
fillforward |
Blink-extension window after missing/blink samples, in ms. |
smooth_n |
Smoothing window parameter passed to |
step_first |
Processing order passed to |
interpolation_type |
Interpolation type passed to |
maxgap |
Maximum gap passed to |
baseline_window |
Optional numeric vector of length 2 passed to |
baseline_event |
Optional event label passed to |
baseline_dur |
Baseline duration used with |
baseline_method |
Baseline method used with |
bin_length |
Optional bin length passed to |
name |
Character label stored in the returned object. |
This helper is a cross-check branch. It is not intended to replace the main
gp3tools pupil preprocessing pipeline.
A list with class gp3_gazer_crosscheck.
Aligns gp3tools gaze output with an already imported biometric data frame, computes AOI/event-contingent signal summaries, and returns a combined audit and cautious report text. A user-supplied adapter can replace the native nearest-timestamp join without making gpbiometrics a mandatory dependency.
run_gazepoint_gpbiometrics_workflow( gaze_data, biometrics_data, gaze_args = list(), biometric_participant_col = NULL, biometric_trial_col = NULL, biometric_time_col = NULL, biometric_time_unit = c("auto", "seconds", "milliseconds"), signal_cols = NULL, event_col = NULL, tolerance_s = NULL, adapter = NULL, include_unmatched = TRUE )run_gazepoint_gpbiometrics_workflow( gaze_data, biometrics_data, gaze_args = list(), biometric_participant_col = NULL, biometric_trial_col = NULL, biometric_time_col = NULL, biometric_time_unit = c("auto", "seconds", "milliseconds"), signal_cols = NULL, event_col = NULL, tolerance_s = NULL, adapter = NULL, include_unmatched = TRUE )
gaze_data |
Raw gp3tools gaze/master data or a prepared bridge. |
biometrics_data |
Biometric samples, including participant, trial, time, and one or more numeric signal columns. |
gaze_args |
Named list forwarded to
|
biometric_participant_col, biometric_trial_col, biometric_time_col
|
Explicit biometric source columns. |
biometric_time_unit |
Unit for the biometric time column. |
signal_cols |
Numeric biometric signals to summarise. |
event_col |
Optional biometric event column. |
tolerance_s |
Maximum absolute time difference for a match. When |
adapter |
Optional function with arguments |
include_unmatched |
Retain unmatched gaze rows. |
A "gazepoint_cross_package_workflow" object.
Refit the same model repeatedly while removing one participant, item, stimulus, trial, or other analysis unit at a time. The helper compares leave-one-out estimates with the full-data model to assess whether a key effect is driven by a single unit.
run_gazepoint_model_leave_one_out( data, unit_col, fit_function, extract_function = NULL, effect_terms = NULL, min_rows = 2L, keep_models = FALSE, name = "gazepoint_model_leave_one_out" )run_gazepoint_model_leave_one_out( data, unit_col, fit_function, extract_function = NULL, effect_terms = NULL, min_rows = 2L, keep_models = FALSE, name = "gazepoint_model_leave_one_out" )
data |
A data frame used for model fitting. |
unit_col |
Column identifying the unit to leave out, for example subject, participant, item, stimulus, or trial. |
fit_function |
Function that takes one data frame argument and returns a fitted model. |
extract_function |
Optional function that takes a fitted model and
returns a data frame of effects. If |
effect_terms |
Optional character vector of terms/effects to retain in the sensitivity summary. |
min_rows |
Minimum number of rows required after leaving one unit out. |
keep_models |
Logical. If |
name |
Character label stored in the returned object. |
This is a generic robustness wrapper. It can be used with linear models, GLMs, mixed models, GAMMs, GCA models, AOI GLMMs, pupil LMMs, or any custom model as long as a fitting function is supplied.
A list with class gp3_model_leave_one_out_sensitivity.
This function intentionally fails safely. Multidimensional cluster permutation is not implemented as an active inferential engine in gp3tools.
run_gazepoint_multidimensional_cluster_permutation(...)run_gazepoint_multidimensional_cluster_permutation(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
Run all pupil preprocessing branches defined by
create_gazepoint_preprocessing_multiverse(). Each branch can apply pupil
artifact flagging, interpolation, baseline correction, smoothing, and
optional pupil-window summarisation.
run_gazepoint_pupil_multiverse( data, multiverse, branch_ids = NULL, pupil_col = NULL, time_col = NULL, group_cols = NULL, summarise_windows = FALSE, windows = NULL, keep_outputs = TRUE, stop_on_error = FALSE )run_gazepoint_pupil_multiverse( data, multiverse, branch_ids = NULL, pupil_col = NULL, time_col = NULL, group_cols = NULL, summarise_windows = FALSE, windows = NULL, keep_outputs = TRUE, stop_on_error = FALSE )
data |
A Gazepoint master table or processed pupil table. |
multiverse |
A |
branch_ids |
Optional character vector of pupil branch IDs to run. |
pupil_col |
Optional pupil column passed to downstream preprocessing helpers when supported. |
time_col |
Optional time column passed to downstream preprocessing helpers when supported. |
group_cols |
Optional grouping columns passed to downstream preprocessing helpers when supported. |
summarise_windows |
Logical. If |
windows |
Optional windows passed to |
keep_outputs |
Logical. If |
stop_on_error |
Logical. If |
A list with class gp3_pupil_multiverse_results containing overview,
branch results, optional branch outputs, and settings.
This function intentionally fails safely. TFCE is not implemented as an active inferential engine in gp3tools.
run_gazepoint_tfce(...)run_gazepoint_tfce(...)
... |
Arguments reserved for a future implementation. |
This function always stops with an explanatory error.
Reads Gazepoint all-gaze and fixation exports from a folder, computes sampling-rate checks, tracking-quality summaries, quality flags, and AOI-level metrics, and optionally exports output tables, diagnostic plots, and an HTML diagnostic report.
run_gazepoint_workflow( export_dir, all_gaze_pattern = "_all_gaze\\.csv$", fixation_pattern = "_fixations\\.csv$", check_file_pairs = TRUE, group_cols = c("USER_FILE", "MEDIA_ID"), user_col = "USER_FILE", sample_rate = 60, min_gaze_valid_pct = 70, min_pupil_valid_pct = 70, expected_hz = 60, hz_tolerance = 5, min_duration_sec = NULL, output_dir = NULL, prefix = "gazepoint", overwrite = TRUE, save_plots = FALSE, plot_output_dir = NULL, create_report = FALSE, report_file = NULL, report_title = "Gazepoint diagnostic report", report_plot_dir = NULL, report_max_rows = 30 )run_gazepoint_workflow( export_dir, all_gaze_pattern = "_all_gaze\\.csv$", fixation_pattern = "_fixations\\.csv$", check_file_pairs = TRUE, group_cols = c("USER_FILE", "MEDIA_ID"), user_col = "USER_FILE", sample_rate = 60, min_gaze_valid_pct = 70, min_pupil_valid_pct = 70, expected_hz = 60, hz_tolerance = 5, min_duration_sec = NULL, output_dir = NULL, prefix = "gazepoint", overwrite = TRUE, save_plots = FALSE, plot_output_dir = NULL, create_report = FALSE, report_file = NULL, report_title = "Gazepoint diagnostic report", report_plot_dir = NULL, report_max_rows = 30 )
export_dir |
Folder containing Gazepoint CSV export files. |
all_gaze_pattern |
Regular expression for selecting all-gaze files. |
fixation_pattern |
Regular expression for selecting fixation files. |
check_file_pairs |
Logical. If |
group_cols |
Columns used for grouped sampling and tracking-quality summaries. |
user_col |
Column name used to identify the source/user file. |
sample_rate |
Sampling rate used for approximate sample-based AOI viewed time. |
min_gaze_valid_pct |
Minimum acceptable FPOGV validity percentage. |
min_pupil_valid_pct |
Minimum acceptable pupil validity percentage. |
expected_hz |
Expected sampling rate. |
hz_tolerance |
Allowed deviation from the expected sampling rate. |
min_duration_sec |
Optional minimum acceptable recording duration in seconds. |
output_dir |
Optional folder where output CSV files should be written. |
prefix |
Filename prefix used when exporting output tables, plots, and report. |
overwrite |
Logical. If |
save_plots |
Logical. If |
plot_output_dir |
Optional folder where diagnostic plots should be saved.
If |
create_report |
Logical. If |
report_file |
Optional path to the HTML report. If |
report_title |
Title used in the HTML diagnostic report. |
report_plot_dir |
Optional folder for plots used inside the HTML report. |
report_max_rows |
Maximum number of rows shown in report preview tables. |
A named list containing file-pair checks, imported data, analysis tables, quality flags, written table paths, written plot paths, and written report path.
Saves standard diagnostic plots produced from gp3tools workflow outputs.
save_gazepoint_plots( flagged_quality = NULL, sampling = NULL, output_dir, prefix = "gazepoint", overwrite = TRUE, width = 9, height_quality = 6, height_sampling = 5, dpi = 300 )save_gazepoint_plots( flagged_quality = NULL, sampling = NULL, output_dir, prefix = "gazepoint", overwrite = TRUE, width = 9, height_quality = 6, height_sampling = 5, dpi = 300 )
flagged_quality |
Flagged tracking-quality table, usually from
|
sampling |
Sampling-rate table, usually from |
output_dir |
Folder where plot files should be saved. |
prefix |
Filename prefix used for saved plot files. |
overwrite |
Logical. If |
width |
Plot width in inches. |
height_quality |
Tracking-quality plot height in inches. |
height_sampling |
Sampling-rate plot height in inches. |
dpi |
Plot resolution. |
A tibble with plot names and written file paths.
Assigns each row of a Gazepoint-style data set to a task phase using a user-supplied phase-window table. The helper is deterministic and descriptive: it labels rows according to declared time windows and does not infer phases.
segment_gazepoint_task_phases( data, time_col, phase_windows, phase_col = "task_phase", window_phase_col = "phase", window_start_col = "start", window_end_col = "end", outside_label = "outside", include_lower = TRUE, include_upper = FALSE, keep_window_metadata = FALSE )segment_gazepoint_task_phases( data, time_col, phase_windows, phase_col = "task_phase", window_phase_col = "phase", window_start_col = "start", window_end_col = "end", outside_label = "outside", include_lower = TRUE, include_upper = FALSE, keep_window_metadata = FALSE )
data |
A data frame. |
time_col |
Character name of the time column. |
phase_windows |
A data frame containing phase labels and start/end times. |
phase_col |
Output column name for assigned phases. |
window_phase_col, window_start_col, window_end_col
|
Column names in
|
outside_label |
Label assigned to rows outside all phase windows. If
|
include_lower, include_upper
|
Logical values controlling whether phase window boundaries are closed on the lower and upper sides. |
keep_window_metadata |
If |
A copy of data with phase labels and assignment diagnostics.
x <- data.frame(time_ms = c(0, 250, 750, 1250, 1750)) windows <- data.frame( phase = c("baseline", "stimulus", "response"), start = c(0, 500, 1000), end = c(500, 1000, 2000) ) segment_gazepoint_task_phases(x, "time_ms", windows)x <- data.frame(time_ms = c(0, 250, 750, 1250, 1750)) windows <- data.frame( phase = c("baseline", "stimulus", "response"), start = c(0, 500, 1000), end = c(500, 1000, 2000) ) segment_gazepoint_task_phases(x, "time_ms", windows)
Provides a lightweight Bayesian-optimization-style acquisition helper for adaptive testing. It assumes candidate-level posterior means and standard deviations are already available or supplied by the user.
select_gazepoint_adaptive_trial( candidates, mean, sd, acquisition = c("ucb", "uncertainty", "expected_improvement"), kappa = 2, best_observed = NULL, maximize = TRUE )select_gazepoint_adaptive_trial( candidates, mean, sd, acquisition = c("ucb", "uncertainty", "expected_improvement"), kappa = 2, best_observed = NULL, maximize = TRUE )
candidates |
A data frame of candidate stimuli/trials. |
mean |
Column containing posterior mean utility or expected information. |
sd |
Column containing posterior uncertainty. |
acquisition |
Acquisition rule: |
kappa |
Exploration weight for UCB. |
best_observed |
Best observed value for expected improvement. |
maximize |
Logical; select maximum acquisition value if |
One-row data frame corresponding to the selected candidate, with an added acquisition score.
Compare candidate cluster counts using mean silhouette width.
Input formats and sequence-preparation arguments match
cluster_gazepoint_scanpaths().
select_gazepoint_scanpath_clusters( x, k_values = NULL, method = c("hierarchical", "pam"), linkage = c("average", "complete", "single", "ward.D2", "ward.D", "mcquitty", "median", "centroid"), aoi_col = NULL, group_cols = NULL, time_col = NULL, distance_col = "normalized_distance", include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )select_gazepoint_scanpath_clusters( x, k_values = NULL, method = c("hierarchical", "pam"), linkage = c("average", "complete", "single", "ward.D2", "ward.D", "mcquitty", "median", "centroid"), aoi_col = NULL, group_cols = NULL, time_col = NULL, distance_col = "normalized_distance", include_missing = FALSE, missing_label = "missing", collapse_repeats = FALSE, max_sequences = 200 )
x |
Long-format AOI data, a pairwise-distance data frame, a
square numeric distance matrix, or a |
k_values |
Candidate cluster counts. When |
method |
Clustering method: |
linkage |
Hierarchical linkage method passed to
|
aoi_col |
AOI column when |
group_cols |
Columns identifying independent scanpaths. |
time_col |
Optional ordering column. |
distance_col |
Distance column for pairwise-distance data. |
include_missing |
Should missing AOI labels be retained? |
missing_label |
Label used for retained missing AOIs. |
collapse_repeats |
Should consecutive repeated AOIs be collapsed? |
max_sequences |
Maximum number of scanpaths permitted when pairwise distances must be calculated. |
An object of class gp3_scanpath_cluster_selection containing
candidate diagnostics, the recommended number of clusters, all
fitted solutions, the recommended fit, and the distance object.
d <- matrix( c( 0, 0.1, 1, 1, 0.1, 0, 1, 1, 1, 1, 0, 0.1, 1, 1, 0.1, 0 ), nrow = 4, byrow = TRUE, dimnames = list(LETTERS[1:4], LETTERS[1:4]) ) if (requireNamespace("cluster", quietly = TRUE)) { result <- select_gazepoint_scanpath_clusters( d, k_values = 2:3 ) result$diagnostics }d <- matrix( c( 0, 0.1, 1, 1, 0.1, 0, 1, 1, 1, 1, 0, 0.1, 1, 1, 0.1, 0 ), nrow = 4, byrow = TRUE, dimnames = list(LETTERS[1:4], LETTERS[1:4]) ) if (requireNamespace("cluster", quietly = TRUE)) { result <- select_gazepoint_scanpath_clusters( d, k_values = 2:3 ) result$diagnostics }
Generate synthetic two-condition within-subject time-course data for examples and tests. The simulation is intentionally simple and should not be treated as a realistic model of gaze, pupil, or biometric time-series data.
simulate_gazepoint_cluster_timecourse_data( n_subjects = 20, n_time_bins = 60, conditions = c("control", "treatment"), effect_start = 25, effect_end = 40, effect_size = 0.5, subject_sd = 0.3, noise_sd = 0.4, seed = NULL )simulate_gazepoint_cluster_timecourse_data( n_subjects = 20, n_time_bins = 60, conditions = c("control", "treatment"), effect_start = 25, effect_end = 40, effect_size = 0.5, subject_sd = 0.3, noise_sd = 0.4, seed = NULL )
n_subjects |
Number of subjects. |
n_time_bins |
Number of time bins. |
conditions |
Two condition labels. |
effect_start |
First time bin with an injected treatment effect. |
effect_end |
Last time bin with an injected treatment effect. |
effect_size |
Added treatment effect inside the effect window. |
subject_sd |
Standard deviation of subject random shifts. |
noise_sd |
Standard deviation of observation noise. |
seed |
Optional random seed. |
A long-format data frame.
Generate a compact synthetic Gazepoint-style data set for examples, tests, teaching, and workflow demonstrations. The simulation is intentionally simple and should not be treated as a realistic generative model of visual attention.
simulate_gazepoint_data( n_subjects = 12, n_trials = 8, trial_duration_ms = 2000, sampling_rate_hz = 60, conditions = c("control", "treatment"), aoi_labels = c("target", "other"), effect_size = 0.5, target_aoi = aoi_labels[1L], seed = NULL, include_fixations = TRUE )simulate_gazepoint_data( n_subjects = 12, n_trials = 8, trial_duration_ms = 2000, sampling_rate_hz = 60, conditions = c("control", "treatment"), aoi_labels = c("target", "other"), effect_size = 0.5, target_aoi = aoi_labels[1L], seed = NULL, include_fixations = TRUE )
n_subjects |
Number of synthetic participants. |
n_trials |
Number of trials per participant. |
trial_duration_ms |
Trial duration in milliseconds. |
sampling_rate_hz |
Sampling rate in Hz. |
conditions |
Character vector of condition labels. |
aoi_labels |
Character vector of AOI labels. |
effect_size |
Logit-scale increase in target-AOI probability for the second and later conditions. |
target_aoi |
AOI receiving the simulated condition effect. |
seed |
Optional random seed. |
include_fixations |
Should a simple fixation-level table be returned? |
A list containing all_gaze, aoi_windows, optional
fixations, and simulation metadata.
Generates event-level fixation data with bounded random spatial drift.
simulate_gazepoint_fixations( n_subjects = 10, n_fix = 50, sd = 10, coordinate_system = c("pixels", "normalized"), screen_width = 1920, screen_height = 1080, duration_mean = 250, duration_sd = 80, saccade_gap_mean = 40, seed = NULL )simulate_gazepoint_fixations( n_subjects = 10, n_fix = 50, sd = 10, coordinate_system = c("pixels", "normalized"), screen_width = 1920, screen_height = 1080, duration_mean = 250, duration_sd = 80, saccade_gap_mean = 40, seed = NULL )
n_subjects |
Number of simulated participants. |
n_fix |
Number of fixations per participant. |
sd |
Standard deviation of spatial random-walk increments. |
coordinate_system |
Coordinate representation. |
screen_width, screen_height
|
Pixel dimensions when
|
duration_mean, duration_sd
|
Mean and standard deviation of fixation duration in milliseconds. |
saccade_gap_mean |
Mean interval between fixations in milliseconds. |
seed |
Optional random seed. |
A tibble resembling a Gazepoint fixation export.
simulate_gazepoint_fixations( n_subjects = 2, n_fix = 10, seed = 1 )simulate_gazepoint_fixations( n_subjects = 2, n_fix = 10, seed = 1 )
Generates a privacy-safe synthetic pupil data set with balanced conditions, left/right pupil channels, a combined pupil column, blink/trackloss flags, and simple gaze coordinates. The generator is intended for examples and unit tests, not for claims about empirical pupil physiology.
simulate_gazepoint_pupil_data( n_subjects = 12, n_trials = 8, n_time_bins = 60, conditions = c("control", "treatment"), baseline_mean = 3.5, condition_effect = 0.15, noise_sd = 0.08, subject_sd = 0.25, blink_probability = 0.03, seed = NULL )simulate_gazepoint_pupil_data( n_subjects = 12, n_trials = 8, n_time_bins = 60, conditions = c("control", "treatment"), baseline_mean = 3.5, condition_effect = 0.15, noise_sd = 0.08, subject_sd = 0.25, blink_probability = 0.03, seed = NULL )
n_subjects |
Number of synthetic participants. |
n_trials |
Number of trials per participant. |
n_time_bins |
Number of time bins per trial. |
conditions |
Character vector of condition labels. |
baseline_mean |
Mean pupil size around which synthetic data are generated. |
condition_effect |
Numeric effect added to non-reference conditions.
If a single value is supplied, it is applied to all non-reference
conditions. If multiple values are supplied, they are recycled across
|
noise_sd |
Standard deviation of sample-level noise. |
subject_sd |
Standard deviation of participant-level random offsets. |
blink_probability |
Probability that a sample is marked as blink/trackloss. |
seed |
Optional random seed. |
A data frame with synthetic Gazepoint-like pupil and gaze columns.
simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1)simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1)
Applies a centred rolling median or moving average to gaze coordinates.
smooth_gazepoint_coordinate( all_gaze, method = c("median", "mean"), window = 5, x_col = "FPOGX", y_col = "FPOGY", id_col = "USER_ID", group_cols = NULL, suffix = "_smooth", min_valid = 1, preserve_missing = TRUE )smooth_gazepoint_coordinate( all_gaze, method = c("median", "mean"), window = 5, x_col = "FPOGX", y_col = "FPOGY", id_col = "USER_ID", group_cols = NULL, suffix = "_smooth", min_valid = 1, preserve_missing = TRUE )
all_gaze |
A sample-level gaze data frame. |
method |
Smoothing method. |
window |
Positive integer rolling-window width. |
x_col, y_col
|
Coordinate columns. |
id_col |
Participant identifier. |
group_cols |
Additional independent-sequence columns. |
suffix |
Suffix for generated columns. |
min_valid |
Minimum finite samples required in a rolling window. |
preserve_missing |
Keep smoothed values missing where the original coordinate is missing. |
The input data with smoothed coordinate columns.
gaze <- data.frame( USER_ID = "P01", FPOGX = c(0.1, 0.11, 0.5, 0.12, 0.13), FPOGY = c(0.2, 0.21, 0.6, 0.22, 0.23) ) smooth_gazepoint_coordinate(gaze, window = 3)gaze <- data.frame( USER_ID = "P01", FPOGX = c(0.1, 0.11, 0.5, 0.12, 0.13), FPOGY = c(0.2, 0.21, 0.6, 0.22, 0.23) ) smooth_gazepoint_coordinate(gaze, window = 3)
Applies sample-based rolling smoothing to a Gazepoint pupil time series,
typically after flag_gazepoint_pupil(), interpolate_gazepoint_pupil(),
and optionally baseline_correct_gazepoint_pupil(). The function preserves
the original pupil column and adds smoothed-output columns.
smooth_gazepoint_pupil( data, pupil_col = NULL, time_col = NULL, group_cols = c("subject", "media_id"), window_samples = 5, method = c("mean", "median"), align = c("center", "right", "left"), min_points = 1, preserve_missing = TRUE )smooth_gazepoint_pupil( data, pupil_col = NULL, time_col = NULL, group_cols = c("subject", "media_id"), window_samples = 5, method = c("mean", "median"), align = c("center", "right", "left"), min_points = 1, preserve_missing = TRUE )
data |
A Gazepoint master table, preferably after pupil preprocessing. |
pupil_col |
Optional name of the pupil column to smooth. If |
time_col |
Optional name of the time column. If |
group_cols |
Character vector of grouping columns used to keep smoothing
within independent time series. Defaults to |
window_samples |
Number of samples in the rolling smoothing window.
Defaults to |
method |
Smoothing statistic. One of |
align |
Window alignment. One of |
min_points |
Minimum number of finite values required inside a window to
return a smoothed value. Defaults to |
preserve_missing |
Logical. If |
A tibble containing the original data plus pupil-smoothing columns.
## Not run: smoothed <- smooth_gazepoint_pupil( baseline_corrected, pupil_col = "pupil_baseline_corrected", window_samples = 5, method = "mean" ) dplyr::count(smoothed, pupil_smoothing_status) ## End(Not run)## Not run: smoothed <- smooth_gazepoint_pupil( baseline_corrected, pupil_col = "pupil_baseline_corrected", window_samples = 5, method = "mean" ) dplyr::count(smoothed, pupil_smoothing_status) ## End(Not run)
Converts timestamped Gazepoint headers such as TIME(2026/02/20 00:53:57.275)
to TIME, converts TIMETICK(f=10000000) to TIMETICK, trims whitespace,
and removes empty columns created by trailing commas in Gazepoint exports.
standardise_gazepoint_names(x)standardise_gazepoint_names(x)
x |
A data frame or character vector of column names. |
If x is a data frame, the same data frame with standardised names and
empty Gazepoint columns removed. If x is a character vector, a character vector.
Adds common gp3tools-friendly facial-analysis columns to external
face-analysis outputs. The function keeps the original columns by default and
prepends standard columns such as face_frame, face_time_sec,
face_confidence, face_success, and face_valid.
standardize_gazepoint_face_columns( data, source = c("auto", "openface", "pyfeat", "mediapipe", "facereader", "generic"), participant_id_col = NULL, frame_col = NULL, time_col = NULL, confidence_col = NULL, success_col = NULL, face_id_col = NULL, file_col = NULL, confidence_threshold = 0.8, keep_original_columns = TRUE )standardize_gazepoint_face_columns( data, source = c("auto", "openface", "pyfeat", "mediapipe", "facereader", "generic"), participant_id_col = NULL, frame_col = NULL, time_col = NULL, confidence_col = NULL, success_col = NULL, face_id_col = NULL, file_col = NULL, confidence_threshold = 0.8, keep_original_columns = TRUE )
data |
A data frame returned by |
source |
Facial-analysis source. Use |
participant_id_col |
Optional participant identifier column. |
frame_col |
Optional frame-index column. |
time_col |
Optional time column, preferably in seconds. |
confidence_col |
Optional face-detection confidence column. |
success_col |
Optional face-detection success column. |
face_id_col |
Optional face identifier column. |
file_col |
Optional file/source column. |
confidence_threshold |
Minimum confidence required for |
keep_original_columns |
Should original facial-analysis columns be kept? |
A tibble with standardised facial-analysis columns. The returned
object has class gp3_face_data.
face <- data.frame( frame = 1:2, timestamp = c(0, 0.033), confidence = c(0.98, 0.40), success = c(1, 1), AU12_r = c(0.1, 0.2) ) standardize_gazepoint_face_columns(face)face <- data.frame( frame = 1:2, timestamp = c(0, 0.033), confidence = c(0.98, 0.40), success = c(1, 1), AU12_r = c(0.1, 0.2) ) standardize_gazepoint_face_columns(face)
Repeats artificial monocular-loss validation across declared missingness levels and random/contiguous masking modes to show where cross-eye reconstruction begins to degrade.
stress_test_gazepoint_binocular_reconstruction( data, left_col, right_col, time_col = NULL, group_cols = NULL, gap_group_cols = NULL, fallback_group_cols = NULL, missingness = c(0.05, 0.1, 0.2, 0.3), mask_modes = c("random", "contiguous"), block_size = 6L, repeats = 3L, seed = 1L, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, max_gap_ms = Inf, valid_min = NULL, valid_max = NULL )stress_test_gazepoint_binocular_reconstruction( data, left_col, right_col, time_col = NULL, group_cols = NULL, gap_group_cols = NULL, fallback_group_cols = NULL, missingness = c(0.05, 0.1, 0.2, 0.3), mask_modes = c("random", "contiguous"), block_size = 6L, repeats = 3L, seed = 1L, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, max_gap_ms = Inf, valid_min = NULL, valid_max = NULL )
data, left_col, right_col, time_col, group_cols, gap_group_cols, fallback_group_cols
|
|
missingness |
Numeric proportions strictly between 0 and 1. |
mask_modes |
One or both of |
block_size |
Contiguous mask size in samples. |
repeats |
Repeats per stress-test cell. |
seed |
Base seed; deterministic offsets are used across cells. |
min_pairs, min_unique, min_r2, max_gap_ms, valid_min, valid_max
|
Passed to validation. |
A gp3_binocular_stress_test object containing cell-level results
and individual validation objects.
validate_gazepoint_binocular_reconstruction()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 22) stress_test_gazepoint_binocular_reconstruction( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", missingness = c(0.05, 0.10), mask_modes = "random", repeats = 1, min_pairs = 20 )dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 22) stress_test_gazepoint_binocular_reconstruction( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", missingness = c(0.05, 0.10), mask_modes = "random", repeats = 1, min_pairs = 20 )
Computes transparent AOI metrics from sample-level rows. These may not exactly
reproduce Gazepoint Analysis summary metrics; use read_gazepoint_summary()
when official Gazepoint summary values are available.
summarise_aoi_samples( data, group_cols = "MEDIA_ID", aoi_col = "AOI", time_col = "TIME" )summarise_aoi_samples( data, group_cols = "MEDIA_ID", aoi_col = "AOI", time_col = "TIME" )
data |
A Gazepoint all-gaze data frame. |
group_cols |
Grouping columns. |
aoi_col |
AOI column name. |
time_col |
Time column name. |
A tibble with AOI sample count, TTFF, and approximate dwell time.
Summarise fixation-level AOI metrics
summarise_fixations(data, group_cols = "MEDIA_ID", aoi_col = "AOI")summarise_fixations(data, group_cols = "MEDIA_ID", aoi_col = "AOI")
data |
A Gazepoint fixation data frame. |
group_cols |
Grouping columns. |
aoi_col |
AOI column name. |
A tibble with fixation counts and summed fixation duration by AOI.
Combines sample-level AOI viewing information from all-gaze data with fixation-level AOI metrics from fixation data.
summarise_gazepoint_aoi( gaze_data, fixation_data, user_col = "USER_FILE", sample_rate = 60 )summarise_gazepoint_aoi( gaze_data, fixation_data, user_col = "USER_FILE", sample_rate = 60 )
gaze_data |
A Gazepoint all-gaze data frame imported with |
fixation_data |
A Gazepoint fixation data frame imported with |
user_col |
Name of the column identifying the user file. Default is |
sample_rate |
Assumed sampling rate used to approximate viewed time from sample counts. |
A tibble with one row per user, media, and AOI.
Convert sample-level AOI states into AOI entry episodes. An entry starts whenever the AOI state changes within a subject, media, trial, or other grouping unit.
summarise_gazepoint_aoi_entries( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )summarise_gazepoint_aoi_entries( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )
data |
A Gazepoint master/sample-level data frame. |
aoi_col |
Name of the AOI-state column. If |
time_col |
Name of the time column, in milliseconds. |
group_cols |
Character vector of columns defining independent sequences, usually subject/media/trial. |
include_non_aoi |
Logical. If |
non_aoi_values |
Character vector of AOI labels treated as background or non-AOI states. |
missing_aoi_label |
Label used when the AOI value is missing. |
A tibble with one row per AOI entry episode.
Summarise AOI transitions at the trial or group level. The function can work
from sample-level Gazepoint AOI data, AOI-entry tables created by
summarise_gazepoint_aoi_entries(), or AOI-sequence tables created by
prepare_gazepoint_aoi_sequences().
summarise_gazepoint_aoi_transitions( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )summarise_gazepoint_aoi_transitions( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )
data |
A Gazepoint sample-level data frame, AOI-entry table, or AOI-sequence table. |
aoi_col |
Name of the AOI-state column. Used only when |
time_col |
Name of the time column, in milliseconds. Used only when
|
group_cols |
Character vector of columns defining independent AOI sequences, usually subject/media/trial. |
include_non_aoi |
Logical. If |
target_aoi_values |
Optional character vector defining target AOI labels. |
distractor_aoi_values |
Optional character vector defining distractor AOI labels. |
non_aoi_values |
Character vector of AOI labels treated as background or non-AOI states. |
missing_aoi_label |
Label used when the AOI value is missing. |
A tibble with one row per group and trial-level AOI transition features.
Create trial-level AOI features from sample-level Gazepoint AOI data or from
AOI-entry tables created by summarise_gazepoint_aoi_entries(). The output
includes AOI dwell, entry, TTFF, revisit, and transition features.
summarise_gazepoint_aoi_trial_features( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )summarise_gazepoint_aoi_trial_features( data, aoi_col = NULL, time_col = "time", group_cols = c("subject", "MEDIA_ID", "trial_global"), include_non_aoi = TRUE, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )
data |
A Gazepoint sample-level data frame, AOI-entry table, or compatible AOI table. |
aoi_col |
Name of the AOI-state column. Used only when |
time_col |
Name of the time column, in milliseconds. Used only when
|
group_cols |
Character vector of columns defining independent trials, usually subject/media/trial. |
include_non_aoi |
Logical. If |
target_aoi_values |
Optional character vector defining target AOI labels. |
distractor_aoi_values |
Optional character vector defining distractor AOI labels. |
non_aoi_values |
Character vector of AOI labels treated as background or non-AOI states. |
missing_aoi_label |
Label used when the AOI value is missing. |
A tibble with one row per trial/group and AOI trial-level features.
Summarise sample-level AOI states into predefined analysis windows. This is intended for confirmatory AOI window modelling, especially binomial target-looking models where target samples are modelled relative to a denominator such as all valid window samples.
summarise_gazepoint_aoi_windows( data, windows, time_col = "time", aoi_col = NULL, subject_col = "subject", condition_col = "condition", group_cols = NULL, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), window_label_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", include_right_endpoint = FALSE, missing_condition_label = "all_data", missing_aoi_label = "missing_aoi" )summarise_gazepoint_aoi_windows( data, windows, time_col = "time", aoi_col = NULL, subject_col = "subject", condition_col = "condition", group_cols = NULL, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), window_label_col = "window_label", window_start_col = "window_start_ms", window_end_col = "window_end_ms", include_right_endpoint = FALSE, missing_condition_label = "all_data", missing_aoi_label = "missing_aoi" )
data |
A Gazepoint master table or sample-level gaze data. |
windows |
Numeric breakpoints, for example |
time_col |
Name of the time column. |
aoi_col |
Optional AOI-state column. If |
subject_col |
Name of the subject column. |
condition_col |
Optional condition column. |
group_cols |
Additional grouping columns. Defaults to subject, condition, media, trial-global, and trial columns when available. |
target_aoi_values |
Character vector identifying target AOIs. |
distractor_aoi_values |
Character vector identifying distractor AOIs. |
non_aoi_values |
Character vector identifying background/non-AOI states. |
window_label_col |
Window label column when |
window_start_col |
Window start column when |
window_end_col |
Window end column when |
include_right_endpoint |
Logical. If |
missing_condition_label |
Label used when condition is missing. |
missing_aoi_label |
Label used when AOI state is missing. |
A tibble with one row per group and AOI window.
Produces structured reporting fields plus conservative prose describing the declared calibration, reconstruction burden, and optional pseudo-missing validation. The text never describes predicted values as measured or as the biological truth.
summarise_gazepoint_binocular_reporting( data, audit = NULL, validation = NULL, by = NULL, prefix = "gp3_binocular" )summarise_gazepoint_binocular_reporting( data, audit = NULL, validation = NULL, by = NULL, prefix = "gp3_binocular" )
data |
Output from |
audit |
Optional result from |
validation |
Optional result from
|
by |
Optional audit grouping used when |
prefix |
Reconstruction prefix. |
A gp3_binocular_reporting object with summary, models,
validation, text, and limitations.
audit_gazepoint_binocular_reconstruction()
dat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 25) dat$pupil_left[30:33] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 ) summarise_gazepoint_binocular_reporting(rec)$textdat <- simulate_gazepoint_pupil_data(n_subjects = 4, n_trials = 2, seed = 25) dat$pupil_left[30:33] <- NA_real_ rec <- reconstruct_gazepoint_binocular_pupil( dat, "pupil_left", "pupil_right", group_cols = "subject", min_pairs = 20 ) summarise_gazepoint_binocular_reporting(rec)$text
Create compact reporting tables from the output of
run_gazepoint_cluster_permutation(). The function returns an overview
table, all observed clusters, significant clusters, time-course summary,
permutation-distribution summary, settings table, and circularity warning.
summarise_gazepoint_clusters( result, alpha = 0.05, round_digits = NULL, include_timecourse = TRUE )summarise_gazepoint_clusters( result, alpha = 0.05, round_digits = NULL, include_timecourse = TRUE )
result |
A result object returned by
|
alpha |
Cluster-level significance threshold. |
round_digits |
Optional number of digits for rounding numeric reporting
columns. If |
include_timecourse |
Logical. If |
Cluster-based permutation tests are intended for time-course inference. They should not be used to discover a confirmatory time window and then test that same window again in a second confirmatory model.
A list of summary tables.
summarize_gazepoint_coordinate_coverage()
British-spelling alias for summarize_gazepoint_coordinate_coverage()
summarise_gazepoint_coordinate_coverage(...)summarise_gazepoint_coordinate_coverage(...)
... |
Arguments passed to |
The result of summarize_gazepoint_coordinate_coverage().
Create manuscript-ready estimated marginal means and pairwise contrast tables
from fitted models used in gp3tools workflows.
summarise_gazepoint_emmeans( model, specs, by = NULL, model_name = NULL, type = "response", contrast_method = "pairwise", adjust = "tukey", conf_level = 0.95, include_contrasts = TRUE )summarise_gazepoint_emmeans( model, specs, by = NULL, model_name = NULL, type = "response", contrast_method = "pairwise", adjust = "tukey", conf_level = 0.95, include_contrasts = TRUE )
model |
A fitted model object, or a |
specs |
Character vector or formula passed to |
by |
Optional character vector of grouping variables passed to
|
model_name |
Optional model label used in returned tables. |
type |
Scale passed to |
contrast_method |
Contrast method passed to |
adjust |
Multiplicity adjustment for contrasts. |
conf_level |
Confidence level. |
include_contrasts |
Logical. If |
The function uses the optional emmeans package. If emmeans is not
installed, the function returns structured skipped tables rather than
failing. This keeps emmeans as an optional suggested dependency.
A list with overview, emmeans, contrasts, and settings. The returned
object has class gp3_emmeans_summary.
Compare standardized fixation intervals using event-level intersection-over-union. Agreement is methodological and does not identify a uniquely correct detector.
summarise_gazepoint_event_detector_agreement(x, min_overlap = 0.5)summarise_gazepoint_event_detector_agreement(x, min_overlap = 0.5)
x |
An object returned by |
min_overlap |
Minimum interval intersection-over-union required for a match. |
A list containing detector summaries, pairwise agreement, unmatched events, and settings.
Extract detector-level, sequence-level, matched-event, or unmatched-event tables from an event-detector benchmark.
summarise_gazepoint_event_detector_benchmark( x, level = c("detector", "sequence", "matches", "errors"), sort = TRUE )summarise_gazepoint_event_detector_benchmark( x, level = c("detector", "sequence", "matches", "errors"), sort = TRUE )
x |
An object returned by |
level |
Summary level to return. |
sort |
Should detector summaries be ordered by decreasing F1 score? |
A data frame.
summarize_gazepoint_face_reactivity()
British-spelling alias for summarize_gazepoint_face_reactivity()
summarise_gazepoint_face_reactivity(...)summarise_gazepoint_face_reactivity(...)
... |
Arguments passed to |
The result of summarize_gazepoint_face_reactivity().
summarize_gazepoint_face_windows()
British-spelling alias for summarize_gazepoint_face_windows()
summarise_gazepoint_face_windows(...)summarise_gazepoint_face_windows(...)
... |
Arguments passed to |
The result of summarize_gazepoint_face_windows().
Create trial-level fixation features from Gazepoint fixation-level data. The
function supports common Gazepoint fixation export columns such as FPOGS,
FPOGD, FPOGX, FPOGY, FPOGID, FPOGV, and AOI, as well as
already-standardised columns.
summarise_gazepoint_fixation_trials( data, group_cols = NULL, fixation_id_col = NULL, start_col = NULL, duration_col = NULL, x_col = NULL, y_col = NULL, valid_col = NULL, aoi_col = NULL, start_time_unit = c("auto", "ms", "s"), duration_unit = c("auto", "ms", "s"), valid_only = TRUE, include_non_aoi = TRUE, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )summarise_gazepoint_fixation_trials( data, group_cols = NULL, fixation_id_col = NULL, start_col = NULL, duration_col = NULL, x_col = NULL, y_col = NULL, valid_col = NULL, aoi_col = NULL, start_time_unit = c("auto", "ms", "s"), duration_unit = c("auto", "ms", "s"), valid_only = TRUE, include_non_aoi = TRUE, target_aoi_values = NULL, distractor_aoi_values = NULL, non_aoi_values = c("non_aoi", "none", "background", "outside", "outside_aoi", "missing", "missing_aoi"), missing_aoi_label = "missing_aoi" )
data |
A Gazepoint fixation-level data frame. |
group_cols |
Character vector of columns defining independent trials. If
|
fixation_id_col |
Optional fixation ID column. If |
start_col |
Optional fixation start-time column. If |
duration_col |
Optional fixation-duration column. If |
x_col |
Optional fixation x-coordinate column. |
y_col |
Optional fixation y-coordinate column. |
valid_col |
Optional fixation-validity column. If detected and
|
aoi_col |
Optional AOI column. If |
start_time_unit |
Unit for the start-time column: |
duration_unit |
Unit for the duration column: |
valid_only |
Logical. If |
include_non_aoi |
Logical. If |
target_aoi_values |
Optional character vector defining target AOI labels. |
distractor_aoi_values |
Optional character vector defining distractor AOI labels. |
non_aoi_values |
Character vector of AOI labels treated as background or non-AOI states. |
missing_aoi_label |
Label used when the AOI value is missing. |
A tibble with one row per trial/group and fixation-level features.
Create a compact manuscript-ready fixed-effect summary table from common
models used in gp3tools workflows.
summarise_gazepoint_fixed_effects( model, model_name = NULL, conf_level = 0.95, exponentiate = FALSE, drop_intercept = FALSE )summarise_gazepoint_fixed_effects( model, model_name = NULL, conf_level = 0.95, exponentiate = FALSE, drop_intercept = FALSE )
model |
A fitted model object, or a |
model_name |
Optional model label used in the returned table. |
conf_level |
Confidence level for Wald confidence intervals. |
exponentiate |
Logical. If |
drop_intercept |
Logical. If |
The function supports lm, glm, lme4 mixed models, and mgcv GAM/BAM
objects. It can also accept a gp3tools fit object containing a $model
element. Confidence intervals are computed using a Wald approximation from
the estimate and standard error so that the function remains lightweight and
fast for mixed models.
A tibble with fixed-effect estimates, standard errors, test statistics, p-values when available, confidence intervals, significance stars, and status fields.
Convert a Gazepoint Markov-chain object, transition matrix, or transition
data frame into a tidy transition summary. The function is deliberately
permissive so that it can summarise objects created by
create_gazepoint_markovchain_object() as well as simple matrices
used in examples or tests.
summarise_gazepoint_markovchain( markov_object, include_zero = FALSE, from_col = NULL, to_col = NULL, count_col = NULL, probability_col = NULL )summarise_gazepoint_markovchain( markov_object, include_zero = FALSE, from_col = NULL, to_col = NULL, count_col = NULL, probability_col = NULL )
markov_object |
A Markov-chain object, matrix, table, list, or data frame containing transition information. |
include_zero |
Should zero-valued transitions be retained? |
from_col |
Optional source-state column when |
to_col |
Optional destination-state column when |
count_col |
Optional transition-count column when available. |
probability_col |
Optional transition-probability column when available. |
A data frame with source state, destination state, transition count or weight, row total, transition probability, and status columns.
Summarise pupil and/or AOI preprocessing multiverse result objects created by
run_gazepoint_pupil_multiverse() and run_gazepoint_aoi_multiverse().
summarise_gazepoint_multiverse_results(..., results = NULL)summarise_gazepoint_multiverse_results(..., results = NULL)
... |
One or more multiverse result objects. |
results |
Optional named list of multiverse result objects. |
A list with class gp3_multiverse_summary_results containing
overview, branch summary, failure summary, and settings tables.
Creates compact pupil-quality and pupil-distribution summaries from a
Gazepoint master sample-level table created by as_gazepoint_master() or
create_gazepoint_master(). This function is intended as the first pupil
preprocessing gate before interpolation, filtering, baseline correction, or
pupil-based modelling.
summarise_gazepoint_pupil( master, group_cols = c("subject", "media_id"), pupil_col = NULL, time_col = NULL, missing_pupil_col = NULL, min_pupil = 0, max_pupil = Inf, outlier_k = 1.5 )summarise_gazepoint_pupil( master, group_cols = c("subject", "media_id"), pupil_col = NULL, time_col = NULL, missing_pupil_col = NULL, min_pupil = 0, max_pupil = Inf, outlier_k = 1.5 )
master |
A Gazepoint master sample-level table. |
group_cols |
Character vector of grouping columns. Defaults to
|
pupil_col |
Optional name of the pupil column to summarise. If |
time_col |
Optional name of the time column. If |
missing_pupil_col |
Optional name of the missing-pupil flag column. If
|
min_pupil |
Minimum plausible pupil value. Defaults to |
max_pupil |
Maximum plausible pupil value. Defaults to |
outlier_k |
Multiplier for IQR-based outlier detection. Defaults to
|
A tibble with pupil-quality and pupil-distribution summaries.
## Not run: master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) summarise_gazepoint_pupil(master) summarise_gazepoint_pupil(master, group_cols = "subject") summarise_gazepoint_pupil(master, group_cols = character(0)) ## End(Not run)## Not run: master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) summarise_gazepoint_pupil(master) summarise_gazepoint_pupil(master, group_cols = "subject") summarise_gazepoint_pupil(master, group_cols = character(0)) ## End(Not run)
summarize_gazepoint_pupil_response_features()
British-spelling alias for summarize_gazepoint_pupil_response_features()
summarise_gazepoint_pupil_response_features(...)summarise_gazepoint_pupil_response_features(...)
... |
Arguments passed to |
The result of summarize_gazepoint_pupil_response_features().
Convert sample-level Gazepoint pupil time series into trial-level pupil features for statistical modelling.
summarise_gazepoint_pupil_trial_features( data, group_cols = c("subject", "trial_global"), pupil_col = NULL, time_col = "time", interpolated_col = "pupil_was_interpolated", artifact_col = NULL, artifact_reason_col = NULL, early_window = c(0, 500), middle_window = c(500, 1500), late_window = c(1500, 3000), min_valid_samples = 1 )summarise_gazepoint_pupil_trial_features( data, group_cols = c("subject", "trial_global"), pupil_col = NULL, time_col = "time", interpolated_col = "pupil_was_interpolated", artifact_col = NULL, artifact_reason_col = NULL, early_window = c(0, 500), middle_window = c(500, 1500), late_window = c(1500, 3000), min_valid_samples = 1 )
data |
A Gazepoint pupil data frame. |
group_cols |
Character vector of grouping columns. The default is
|
pupil_col |
Name of the processed pupil column to summarise. If |
time_col |
Name of the time column. |
interpolated_col |
Optional logical interpolation flag column. |
artifact_col |
Optional artifact flag column. If |
artifact_reason_col |
Optional artifact-reason column. If |
early_window |
Numeric vector of length 2 defining the early window in milliseconds. |
middle_window |
Numeric vector of length 2 defining the middle window in milliseconds. |
late_window |
Numeric vector of length 2 defining the late window in milliseconds. |
min_valid_samples |
Minimum number of valid pupil samples required for
a trial to be labelled |
The function summarises one row per trial or other user-defined grouping. It computes mean pupil, peak pupil, time-to-peak, AUC, early/middle/late window means, valid-sample percentage, interpolation percentage, artifact percentage, and missingness summaries.
A tibble with one row per trial/group.
Aggregates processed Gazepoint pupil data into user-defined analysis windows,
typically after flag_gazepoint_pupil(), interpolate_gazepoint_pupil(),
baseline_correct_gazepoint_pupil(), and smooth_gazepoint_pupil().
The function can summarise raw, interpolated, baseline-corrected,
percent-change, or smoothed pupil columns.
summarise_gazepoint_pupil_windows( data, pupil_col = NULL, time_col = NULL, windows = c(0, 500, 1000, 2000), group_cols = c("subject", "media_id"), include_window_end = FALSE, min_valid_samples = 1 )summarise_gazepoint_pupil_windows( data, pupil_col = NULL, time_col = NULL, windows = c(0, 500, 1000, 2000), group_cols = c("subject", "media_id"), include_window_end = FALSE, min_valid_samples = 1 )
data |
A Gazepoint master table or processed pupil table. |
pupil_col |
Optional name of the pupil column to summarise. If |
time_col |
Optional name of the time column used for assigning samples
to windows. If |
windows |
Window definitions. Either a numeric vector of breakpoints,
such as |
group_cols |
Character vector of grouping columns. Standard roles such
as |
include_window_end |
Logical. If |
min_valid_samples |
Minimum number of finite pupil samples required for
a window to be labelled |
A tibble with one row per group-by-window combination present in the data.
## Not run: pupil_windows <- summarise_gazepoint_pupil_windows( smoothed_pupil, pupil_col = "pupil_smoothed", windows = c(0, 500, 1000, 2000), group_cols = c("subject", "media_id") ) ## End(Not run)## Not run: pupil_windows <- summarise_gazepoint_pupil_windows( smoothed_pupil, pupil_col = "pupil_smoothed", windows = c(0, 500, 1000, 2000), group_cols = c("subject", "media_id") ) ## End(Not run)
Convert bootstrap scanpath-clustering output into overview, sequence-level, pairwise, and representative-stability tables.
summarise_gazepoint_scanpath_cluster_stability( x, min_pair_coverage = 0.5, stable_threshold = 0.75 )summarise_gazepoint_scanpath_cluster_stability( x, min_pair_coverage = 0.5, stable_threshold = 0.75 )
x |
An object returned by
|
min_pair_coverage |
Minimum proportion of iterations in which a pair must co-occur before it contributes to summaries. |
stable_threshold |
Within-reference-cluster co-clustering threshold used to count stable scanpaths. |
An object of class "gp3_scanpath_cluster_stability_summary"
containing overview, sequence, pairwise, and representative tables.
latent <- rep(1:3, each = 2) d <- outer( latent, latent, FUN = function(x, y) ifelse(x == y, 0.1, 1) ) diag(d) <- 0 dimnames(d) <- list(LETTERS[1:6], LETTERS[1:6]) stability <- bootstrap_gazepoint_scanpath_clusters( d, k = 3, n_boot = 10, seed = 1 ) summarise_gazepoint_scanpath_cluster_stability( stability )latent <- rep(1:3, each = 2) d <- outer( latent, latent, FUN = function(x, y) ifelse(x == y, 0.1, 1) ) diag(d) <- 0 dimnames(d) <- list(LETTERS[1:6], LETTERS[1:6]) stability <- bootstrap_gazepoint_scanpath_clusters( d, k = 3, n_boot = 10, seed = 1 ) summarise_gazepoint_scanpath_cluster_stability( stability )
Summarise state visits and state-to-state transitions from semi-Markov preparation output or a compatible data frame. The function returns a list with a state-duration summary and a transition summary.
summarise_gazepoint_semimarkov( semimarkov_data, state_col = NULL, duration_col = NULL, sequence_col = NULL, time_col = NULL, from_col = NULL, to_col = NULL )summarise_gazepoint_semimarkov( semimarkov_data, state_col = NULL, duration_col = NULL, sequence_col = NULL, time_col = NULL, from_col = NULL, to_col = NULL )
semimarkov_data |
Output from |
state_col |
Optional state/AOI column. |
duration_col |
Optional state-duration column. |
sequence_col |
Optional sequence, subject, or trial column. |
time_col |
Optional time/order column. |
from_col |
Optional transition source-state column. |
to_col |
Optional transition destination-state column. |
A list with state_summary, transition_summary,
columns, and summary_status.
summarize_gazepoint_time_clusters()
British-spelling alias for summarize_gazepoint_time_clusters()
summarise_gazepoint_time_clusters(...)summarise_gazepoint_time_clusters(...)
... |
Arguments passed to |
The result of summarize_gazepoint_time_clusters().
Creates a compact one-row summary from a result object returned by
run_gazepoint_workflow(). This is useful for quickly checking how many rows,
file pairs, flagged recordings, exported tables, exported plots, and reports
were produced by the workflow.
summarise_gazepoint_workflow(results)summarise_gazepoint_workflow(results)
results |
A named list returned by |
A tibble with one row containing workflow-level summary counts.
## Not run: results <- run_gazepoint_workflow( export_dir = "C:/Users/YourName/Desktop/gp3_test_exports", output_dir = "C:/Users/YourName/Desktop/gp3_outputs", prefix = "study1", save_plots = TRUE, create_report = TRUE ) summarise_gazepoint_workflow(results) ## End(Not run)## Not run: results <- run_gazepoint_workflow( export_dir = "C:/Users/YourName/Desktop/gp3_test_exports", output_dir = "C:/Users/YourName/Desktop/gp3_outputs", prefix = "study1", save_plots = TRUE, create_report = TRUE ) summarise_gazepoint_workflow(results) ## End(Not run)
Summarise Gazepoint tracking quality
summarise_tracking_quality(data, group_cols = "MEDIA_ID")summarise_tracking_quality(data, group_cols = "MEDIA_ID")
data |
A Gazepoint data frame. |
group_cols |
Grouping columns. |
A tibble with validity percentages for available validity columns.
Summarizes how much of the screen area is represented by valid gaze coordinates. The helper reports valid-coordinate rates, coordinate ranges, and the proportion of occupied grid cells. It is intended for quality review and documentation, not for inference about attention.
summarize_gazepoint_coordinate_coverage( data, x_col, y_col, screen_width, screen_height, group_cols = NULL, grid_n_x = 10, grid_n_y = 10, include_out_of_bounds = FALSE )summarize_gazepoint_coordinate_coverage( data, x_col, y_col, screen_width, screen_height, group_cols = NULL, grid_n_x = 10, grid_n_y = 10, include_out_of_bounds = FALSE )
data |
A data frame. |
x_col, y_col
|
Character names of gaze-coordinate columns. |
screen_width, screen_height
|
Numeric screen or stimulus dimensions. |
group_cols |
Optional grouping columns. |
grid_n_x, grid_n_y
|
Number of grid cells along the x and y dimensions. |
include_out_of_bounds |
If |
A data frame with one row per group.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) summarize_gazepoint_coordinate_coverage( x, x_col = "gaze_x", y_col = "gaze_y", screen_width = 1920, screen_height = 1080, group_cols = "condition" )x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) summarize_gazepoint_coordinate_coverage( x, x_col = "gaze_x", y_col = "gaze_y", screen_width = 1920, screen_height = 1080, group_cols = "condition" )
Returns the overview table from audit_gazepoint_face_quality(). The helper
accepts either an existing face-quality audit object or data that can be
audited directly.
summarize_gazepoint_face_quality(data, ...) summarise_gazepoint_face_quality(data, ...)summarize_gazepoint_face_quality(data, ...) summarise_gazepoint_face_quality(data, ...)
data |
A |
... |
Additional arguments passed to |
A tibble with class gp3_face_quality_summary.
face <- data.frame( frame = 1:2, timestamp = c(0, 0.033), confidence = c(0.95, 0.90), success = c(1, 1) ) summarize_gazepoint_face_quality(face)face <- data.frame( frame = 1:2, timestamp = c(0, 0.033), confidence = c(0.95, 0.90), success = c(1, 1) ) summarize_gazepoint_face_quality(face)
Computes baseline-to-response differences from
summarize_gazepoint_face_windows() output. The function returns one row per
group and measure. Reactivity is reported as response minus baseline. The
helper summarises technical facial-behaviour measures only and does not infer
emotional states.
summarize_gazepoint_face_reactivity( data, baseline_window, response_window, group_cols = NULL, window_col = NULL, measure_cols = NULL, statistic = c("mean", "median") )summarize_gazepoint_face_reactivity( data, baseline_window, response_window, group_cols = NULL, window_col = NULL, measure_cols = NULL, statistic = c("mean", "median") )
data |
A window-summary table returned by
|
baseline_window |
Value in |
response_window |
Value in |
group_cols |
Optional grouping columns. |
window_col |
Column identifying window labels or IDs. Auto-detected when possible. |
measure_cols |
Measure names or summary columns. If |
statistic |
Statistic used for reactivity. One of |
A tibble with one row per group and measure. The returned object has
class gp3_face_reactivity_summary.
face <- data.frame( participant_id = "P001", face_time_sec = c(0.00, 0.05, 0.10), face_valid = c(TRUE, TRUE, TRUE), AU12_r = c(0.1, 0.2, 0.3) ) windows <- data.frame( participant_id = "P001", window = c("baseline", "response"), window_start_sec = c(0.00, 0.05), window_end_sec = c(0.05, 0.15) ) summary <- summarize_gazepoint_face_windows( face, windows = windows, group_cols = "participant_id", window_label_col = "window" ) summarize_gazepoint_face_reactivity( summary, baseline_window = "baseline", response_window = "response", group_cols = "participant_id" )face <- data.frame( participant_id = "P001", face_time_sec = c(0.00, 0.05, 0.10), face_valid = c(TRUE, TRUE, TRUE), AU12_r = c(0.1, 0.2, 0.3) ) windows <- data.frame( participant_id = "P001", window = c("baseline", "response"), window_start_sec = c(0.00, 0.05), window_end_sec = c(0.05, 0.15) ) summary <- summarize_gazepoint_face_windows( face, windows = windows, group_cols = "participant_id", window_label_col = "window" ) summarize_gazepoint_face_reactivity( summary, baseline_window = "baseline", response_window = "response", group_cols = "participant_id" )
Summarises numeric external facial-behaviour variables within time windows. The helper can use a separate window table or data rows that already contain window labels. It is intended for external face-analysis data imported, standardised, and optionally synchronised with Gazepoint data. It does not infer facial expressions or emotional states.
summarize_gazepoint_face_windows( data, windows = NULL, time_col = NULL, window_start_col = "window_start_sec", window_end_col = "window_end_sec", group_cols = NULL, window_id_col = NULL, window_label_col = NULL, measure_cols = NULL, validity_col = NULL, confidence_col = NULL, require_valid = TRUE, include_empty_windows = TRUE )summarize_gazepoint_face_windows( data, windows = NULL, time_col = NULL, window_start_col = "window_start_sec", window_end_col = "window_end_sec", group_cols = NULL, window_id_col = NULL, window_label_col = NULL, measure_cols = NULL, validity_col = NULL, confidence_col = NULL, require_valid = TRUE, include_empty_windows = TRUE )
data |
A face-analysis data frame, usually returned by
|
windows |
Optional data frame defining windows. When supplied, it must contain start and end columns. |
time_col |
Time column in |
window_start_col |
Window-start column in seconds. |
window_end_col |
Window-end column in seconds. |
group_cols |
Optional grouping columns shared by |
window_id_col |
Optional window identifier column. |
window_label_col |
Optional human-readable window label column. |
measure_cols |
Numeric facial-behaviour columns to summarise. When
|
validity_col |
Optional validity column. Auto-detected when possible. |
confidence_col |
Optional confidence column. Auto-detected when possible. |
require_valid |
Should measure summaries use only rows where the validity
column is |
include_empty_windows |
Should windows with no matching rows be kept in the output? |
A tibble with one row per group/window and summary columns for each
measure. The returned object has class gp3_face_window_summary.
face <- data.frame( participant_id = "P001", face_time_sec = c(0.00, 0.05, 0.10), face_confidence = c(0.95, 0.94, 0.93), face_valid = c(TRUE, TRUE, TRUE), AU12_r = c(0.1, 0.2, 0.3) ) windows <- data.frame( participant_id = "P001", window = c("baseline", "response"), window_start_sec = c(0.00, 0.05), window_end_sec = c(0.05, 0.15) ) summarize_gazepoint_face_windows( face, windows = windows, group_cols = "participant_id", window_label_col = "window" )face <- data.frame( participant_id = "P001", face_time_sec = c(0.00, 0.05, 0.10), face_confidence = c(0.95, 0.94, 0.93), face_valid = c(TRUE, TRUE, TRUE), AU12_r = c(0.1, 0.2, 0.3) ) windows <- data.frame( participant_id = "P001", window = c("baseline", "response"), window_start_sec = c(0.00, 0.05), window_end_sec = c(0.05, 0.15) ) summarize_gazepoint_face_windows( face, windows = windows, group_cols = "participant_id", window_label_col = "window" )
Computes missingness and observed-data rates for selected columns, optionally within grouping variables such as participant, trial, condition, or AOI. The helper is intended for transparent data-coverage reporting and does not make exclusion decisions.
summarize_gazepoint_missingness( data, cols = NULL, group_cols = NULL, include_group_cols = FALSE ) summarise_gazepoint_missingness( data, cols = NULL, group_cols = NULL, include_group_cols = FALSE )summarize_gazepoint_missingness( data, cols = NULL, group_cols = NULL, include_group_cols = FALSE ) summarise_gazepoint_missingness( data, cols = NULL, group_cols = NULL, include_group_cols = FALSE )
data |
A data frame. |
cols |
Optional character vector of columns to summarize. If |
group_cols |
Optional character vector of grouping columns. |
include_group_cols |
If |
A data frame with one row per variable and group.
x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) summarize_gazepoint_missingness( x, cols = c("pupil_left", "pupil_right", "pupil"), group_cols = "condition" )x <- simulate_gazepoint_pupil_data(n_subjects = 2, n_trials = 2, n_time_bins = 5, seed = 1) summarize_gazepoint_missingness( x, cols = c("pupil_left", "pupil_right", "pupil"), group_cols = "condition" )
Summarizes row counts, optional time coverage, and optional value completeness by task phase and optional grouping variables. The helper is intended for documenting task-stage data availability, not for inferential modelling.
summarize_gazepoint_phase_coverage( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, value_cols = NULL ) summarise_gazepoint_phase_coverage( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, value_cols = NULL )summarize_gazepoint_phase_coverage( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, value_cols = NULL ) summarise_gazepoint_phase_coverage( data, phase_col = "task_phase", group_cols = NULL, time_col = NULL, value_cols = NULL )
data |
A data frame containing a phase column. |
phase_col |
Character name of the phase column. |
group_cols |
Optional grouping columns, such as subject, trial, or condition. |
time_col |
Optional time column used to summarize phase timing. |
value_cols |
Optional value columns used to summarize complete-value coverage within phases. |
A data frame with one row per group-phase combination.
x <- data.frame(time_ms = c(0, 250, 750, 1250), value = c(1, NA, 3, 4)) windows <- data.frame(phase = c("baseline", "stimulus"), start = c(0, 500), end = c(500, 1500)) segmented <- segment_gazepoint_task_phases(x, "time_ms", windows) summarize_gazepoint_phase_coverage(segmented, phase_col = "task_phase", time_col = "time_ms")x <- data.frame(time_ms = c(0, 250, 750, 1250), value = c(1, NA, 3, 4)) windows <- data.frame(phase = c("baseline", "stimulus"), start = c(0, 500), end = c(500, 1500)) segmented <- segment_gazepoint_task_phases(x, "time_ms", windows) summarize_gazepoint_phase_coverage(segmented, phase_col = "task_phase", time_col = "time_ms")
Extracts common pupil-response features from sample-level pupil data.
summarize_gazepoint_pupil_response_features( data, pupil, time, subject, trial, baseline_window, response_window, condition = NULL, interpolated = NULL )summarize_gazepoint_pupil_response_features( data, pupil, time, subject, trial, baseline_window, response_window, condition = NULL, interpolated = NULL )
data |
A sample-level data frame. |
pupil |
Pupil column. |
time |
Time column. |
subject |
Subject column. |
trial |
Trial column. |
baseline_window |
Numeric vector of length two. |
response_window |
Numeric vector of length two. |
condition |
Optional condition column to carry forward. |
interpolated |
Optional logical/numeric interpolation flag column. |
A trial-level data frame of pupil features.
Summarizes pass/warn/fail/info/unknown status counts from a QC bundle or an
object-summary table produced by collect_gazepoint_qc_summaries().
summarize_gazepoint_qc_status(qc_bundle) summarise_gazepoint_qc_status(qc_bundle)summarize_gazepoint_qc_status(qc_bundle) summarise_gazepoint_qc_status(qc_bundle)
qc_bundle |
A |
A list with overview, status_counts, and object_summary.
x <- list(overview = data.frame(audit_status = "ok")) summarize_gazepoint_qc_status(list(x))x <- list(overview = data.frame(audit_status = "ok")) summarize_gazepoint_qc_status(list(x))
summarize_gazepoint_time_clusters() provides a compact US-spelling summary
of cluster-permutation output from run_gazepoint_cluster_permutation().
summarize_gazepoint_time_clusters(result, alpha = 0.05)summarize_gazepoint_time_clusters(result, alpha = 0.05)
result |
A result object returned by
|
alpha |
Significance threshold used for the descriptive
|
A data frame with one row per cluster. If no clusters are present, an empty data frame with the expected columns is returned.
# See run_gazepoint_cluster_permutation() for the inferential workflow.# See run_gazepoint_cluster_permutation() for the inferential workflow.
Aligns external facial-behaviour data to Gazepoint rows using either nearest
time matching or exact frame matching. The helper is designed for facial data
previously imported with read_gazepoint_face_export() and standardised with
standardize_gazepoint_face_columns(). It does not infer facial expressions
from Gazepoint exports and does not interpret facial behaviour as emotion.
sync_gazepoint_face_data( gazepoint_data, face_data, method = c("nearest_time", "frame_exact"), by = NULL, gaze_time_col = NULL, face_time_col = NULL, gaze_frame_col = NULL, face_frame_col = NULL, tolerance_sec = 0.05, prefix = "face_", keep_unmatched = TRUE, standardize_face = TRUE )sync_gazepoint_face_data( gazepoint_data, face_data, method = c("nearest_time", "frame_exact"), by = NULL, gaze_time_col = NULL, face_time_col = NULL, gaze_frame_col = NULL, face_frame_col = NULL, tolerance_sec = 0.05, prefix = "face_", keep_unmatched = TRUE, standardize_face = TRUE )
gazepoint_data |
Gazepoint data frame, typically a master table, trial table, or sample-level table. |
face_data |
External facial-behaviour data frame, preferably returned by
|
method |
Synchronisation method. |
by |
Optional named character vector mapping Gazepoint grouping columns
to facial-data grouping columns. For example,
|
gaze_time_col |
Gazepoint time column. Required for
|
face_time_col |
Facial-data time column. Defaults to |
gaze_frame_col |
Gazepoint frame column. Required for
|
face_frame_col |
Facial-data frame column. Defaults to |
tolerance_sec |
Maximum allowed absolute time difference in seconds for nearest-time matching. |
prefix |
Prefix added to non-standard facial-data columns before joining. |
keep_unmatched |
Should Gazepoint rows without a valid face-data match be retained? |
standardize_face |
Should |
A tibble with Gazepoint columns plus matched facial-behaviour columns
and synchronisation metadata. The returned object has class
gp3_face_sync.
gaze <- data.frame( subject_id = "P001", time_sec = c(0.00, 0.03, 0.07), AOI = c("A", "A", "B") ) face <- data.frame( participant_id = "P001", frame = 1:3, timestamp = c(0.00, 0.033, 0.066), confidence = c(0.95, 0.94, 0.93), success = c(1, 1, 1), AU12_r = c(0.1, 0.2, 0.3) ) sync_gazepoint_face_data( gaze, face, by = c(subject_id = "participant_id"), gaze_time_col = "time_sec" )gaze <- data.frame( subject_id = "P001", time_sec = c(0.00, 0.03, 0.07), AOI = c("A", "A", "B") ) face <- data.frame( participant_id = "P001", frame = 1:3, timestamp = c(0.00, 0.033, 0.066), confidence = c(0.95, 0.94, 0.93), success = c(1, 1, 1), AU12_r = c(0.1, 0.2, 0.3) ) sync_gazepoint_face_data( gaze, face, by = c(subject_id = "participant_id"), gaze_time_col = "time_sec" )
Create a compact model-summary object from common fitted models used in
gp3tools workflows. The function combines model metadata, fixed-effect
summaries, and optional model diagnostics into one structured object.
tidy_gazepoint_model_summary( model, model_name = NULL, conf_level = 0.95, exponentiate = FALSE, drop_intercept = FALSE, include_diagnostics = TRUE, use_dharma = FALSE, dharma_simulations = 250, seed = 123 )tidy_gazepoint_model_summary( model, model_name = NULL, conf_level = 0.95, exponentiate = FALSE, drop_intercept = FALSE, include_diagnostics = TRUE, use_dharma = FALSE, dharma_simulations = 250, seed = 123 )
model |
A fitted model object, or a |
model_name |
Optional model label used in returned tables. |
conf_level |
Confidence level for Wald confidence intervals. |
exponentiate |
Logical. If |
drop_intercept |
Logical. If |
include_diagnostics |
Logical. If |
use_dharma |
Logical. If |
dharma_simulations |
Number of DHARMa simulations. |
seed |
Random seed used before DHARMa simulation. |
A list with overview, model_info, fixed_effects, diagnostics, and
settings. The returned object has class gp3_model_summary.
Convert bounded AOI proportions into empirical logits for linear mixed models, growth-curve analysis, or other approximately Gaussian time-course models.
transform_gazepoint_aoi_empirical_logit( data, numerator_col = NULL, denominator_col = NULL, proportion_col = NULL, correction = 0.5, pseudo_denominator = 1, output_col = "aoi_empirical_logit", adjusted_proportion_col = "aoi_proportion_adjusted", raw_proportion_col = "aoi_proportion_raw", numerator_output_col = "aoi_numerator", denominator_output_col = "aoi_denominator", status_col = "aoi_empirical_logit_status", overwrite = FALSE, name = "gazepoint_aoi_empirical_logit" )transform_gazepoint_aoi_empirical_logit( data, numerator_col = NULL, denominator_col = NULL, proportion_col = NULL, correction = 0.5, pseudo_denominator = 1, output_col = "aoi_empirical_logit", adjusted_proportion_col = "aoi_proportion_adjusted", raw_proportion_col = "aoi_proportion_raw", numerator_output_col = "aoi_numerator", denominator_output_col = "aoi_denominator", status_col = "aoi_empirical_logit_status", overwrite = FALSE, name = "gazepoint_aoi_empirical_logit" )
data |
A data frame containing AOI proportions or AOI count data. |
numerator_col |
Optional numerator column, for example number of samples or fixations inside the AOI. |
denominator_col |
Optional denominator column, for example total valid samples or total fixations in the window. |
proportion_col |
Optional bounded AOI proportion column. If
|
correction |
Positive correction constant added to numerator and
non-AOI count. The common empirical-logit correction is |
pseudo_denominator |
Positive pseudo-denominator used only when
|
output_col |
Name of the empirical-logit output column. |
adjusted_proportion_col |
Name of the adjusted proportion output column. |
raw_proportion_col |
Name of the raw proportion output column. |
numerator_output_col |
Name of the numerator output column used in the transformation. |
denominator_output_col |
Name of the denominator output column used in the transformation. |
status_col |
Name of the row-level transformation status column. |
overwrite |
Logical. If |
name |
Character label stored in object attributes. |
Binomial GLMMs are usually preferable when numerator and denominator counts are available. This helper is intended for sensitivity analyses, GCA-style models, and linear time-course summaries where a transformed AOI proportion is needed.
A tibble with empirical-logit transformation columns added. The object
has class gp3_aoi_empirical_logit_data.
Uses bilateral observations as known reference values, temporarily masks one eye, refits cross-eye calibration without the masked target values, reconstructs the hidden observations, and compares predictions with the held-out values. This provides dataset-specific empirical reconstruction diagnostics rather than assuming that a cross-eye regression is adequate.
validate_gazepoint_binocular_reconstruction( data, left_col, right_col, time_col = NULL, group_cols = NULL, gap_group_cols = NULL, fallback_group_cols = NULL, direction = c("both", "left_from_right", "right_from_left"), mask_prop = 0.2, mask_mode = c("random", "contiguous"), block_size = 6L, repeats = 5L, seed = 1L, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, time_unit = c("auto", "milliseconds", "seconds"), max_gap_ms = Inf, allow_edge_gaps = TRUE, allow_extrapolation = FALSE, valid_min = NULL, valid_max = NULL )validate_gazepoint_binocular_reconstruction( data, left_col, right_col, time_col = NULL, group_cols = NULL, gap_group_cols = NULL, fallback_group_cols = NULL, direction = c("both", "left_from_right", "right_from_left"), mask_prop = 0.2, mask_mode = c("random", "contiguous"), block_size = 6L, repeats = 5L, seed = 1L, min_pairs = 30L, min_unique = 5L, min_r2 = NULL, time_unit = c("auto", "milliseconds", "seconds"), max_gap_ms = Inf, allow_edge_gaps = TRUE, allow_extrapolation = FALSE, valid_min = NULL, valid_max = NULL )
data |
A data frame containing binocular pupil measurements. |
left_col, right_col
|
Numeric pupil columns. |
time_col |
Optional time column; required for meaningful contiguous-gap
validation and finite |
group_cols |
Primary calibration and masking groups. |
gap_group_cols |
Optional groups used to define temporal missing-eye runs
during reconstruction; defaults to |
fallback_group_cols |
Optional calibration fallback groups. |
direction |
|
mask_prop |
Proportion of bilateral observations masked in each repeat. |
mask_mode |
|
block_size |
Number of samples per attempted contiguous block. |
repeats |
Number of repeated artificial-missingness evaluations. |
seed |
Random seed. The caller's RNG state is restored on exit. |
min_pairs, min_unique, min_r2
|
Calibration gates. |
time_unit |
Time unit used by reconstruction. |
max_gap_ms, allow_edge_gaps, allow_extrapolation
|
Reconstruction gates. |
valid_min, valid_max
|
Optional bounds. |
Artificial masking evaluates prediction error where the hidden target is actually known. It does not prove that naturally missing observations are missing at random or that their unobserved values would follow the same error distribution.
A gp3_binocular_validation object containing repeat-level metrics,
row-level predictions, aggregated summary, and settings.
fit_gazepoint_binocular_calibration(),
stress_test_gazepoint_binocular_reconstruction()
dat <- simulate_gazepoint_pupil_data(n_subjects = 5, n_trials = 2, seed = 21) val <- validate_gazepoint_binocular_reconstruction( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", mask_prop = 0.1, repeats = 2, min_pairs = 20, seed = 9 ) val$summarydat <- simulate_gazepoint_pupil_data(n_subjects = 5, n_trials = 2, seed = 21) val <- validate_gazepoint_binocular_reconstruction( dat, "pupil_left", "pupil_right", time_col = "timestamp_ms", group_cols = "subject", mask_prop = 0.1, repeats = 2, min_pairs = 20, seed = 9 ) val$summary
Performs formal validation checks on a Gazepoint master sample-level table
created by as_gazepoint_master() or create_gazepoint_master(). This
function is intended as a gate between master-table construction and more
advanced steps such as pupil preprocessing, AOI modelling, or statistical
analysis.
validate_gazepoint_master( master, min_valid_sample_pct = 75, max_missing_gaze_pct = 25, max_missing_pupil_pct = 50, max_offscreen_gaze_pct = 25, require_pupil = FALSE, require_aoi = FALSE, fail_on_error = FALSE )validate_gazepoint_master( master, min_valid_sample_pct = 75, max_missing_gaze_pct = 25, max_missing_pupil_pct = 50, max_offscreen_gaze_pct = 25, require_pupil = FALSE, require_aoi = FALSE, fail_on_error = FALSE )
master |
A Gazepoint master sample-level table. |
min_valid_sample_pct |
Minimum acceptable percentage of valid gaze
samples. Defaults to |
max_missing_gaze_pct |
Maximum acceptable percentage of missing gaze
samples. Defaults to |
max_missing_pupil_pct |
Maximum acceptable percentage of missing pupil
samples. Defaults to |
max_offscreen_gaze_pct |
Maximum acceptable percentage of off-screen gaze
samples. Defaults to |
require_pupil |
Logical. If |
require_aoi |
Logical. If |
fail_on_error |
Logical. If |
A named list with:
One-row validation summary.
A tibble containing all validation checks.
Validation checks with status "fail".
Validation checks with status "warning".
Detected column mapping used for validation.
## Not run: master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) validation <- validate_gazepoint_master(master) validation$summary validation$checks ## End(Not run)## Not run: master <- create_gazepoint_master( gaze_data = results$all_gaze, screen_width_px = 1920, screen_height_px = 1080 ) validation <- validate_gazepoint_master(master) validation$summary validation$checks ## End(Not run)
Write a gp3tools naming-consistency audit
write_gazepoint_naming_audit(x, output_file)write_gazepoint_naming_audit(x, output_file)
x |
A |
output_file |
CSV output path. |
Normalized path to the written file.
Convenience wrapper for exporting standard gp3tools outputs such as sampling
checks, tracking quality summaries, flagged quality rows, and AOI tables.
write_gazepoint_outputs( sampling = NULL, quality = NULL, flagged_quality = NULL, aoi_table = NULL, output_dir, prefix = "gazepoint", overwrite = TRUE )write_gazepoint_outputs( sampling = NULL, quality = NULL, flagged_quality = NULL, aoi_table = NULL, output_dir, prefix = "gazepoint", overwrite = TRUE )
sampling |
Sampling-rate table, usually from |
quality |
Tracking-quality table, usually from |
flagged_quality |
Flagged quality table, usually from |
aoi_table |
AOI summary table, usually from |
output_dir |
Folder where CSV files should be written. |
prefix |
Optional filename prefix. |
overwrite |
Logical. If |
A tibble with table names and written file paths.
Write gp3tools performance benchmark tables
write_gazepoint_performance_benchmark( x, output_dir, prefix = "gp3tools-performance" )write_gazepoint_performance_benchmark( x, output_dir, prefix = "gp3tools-performance" )
x |
A |
output_dir |
Output directory. |
prefix |
Filename prefix. |
Named character vector of written files.