| Type: | Package |
| Title: | Import, Inspect, Analyse, and Report Gazepoint GP3 Exports |
| Version: | 1.0.1 |
| Description: | Imports, inspects, cleans, summarises, models, and reports Gazepoint GP3 and Gazepoint Analysis CSV exports. Supports offline workflows for all-gaze, fixation, pupil, area-of-interest, transition, time-course, quality-audit, and manuscript-reporting analyses. |
| License: | MIT + file LICENSE |
| LazyData: | true |
| Encoding: | UTF-8 |
| Language: | en-US |
| Depends: | R (≥ 4.1.0) |
| Imports: | dplyr, ggplot2, readr, rlang, stringr, tibble, tidyr, withr |
| Suggests: | DHARMa, emmeans, eyetools, glmmTMB, knitr, lme4, magick, mgcv, pracma, rmarkdown, testthat (≥ 3.0.0) |
| VignetteBuilder: | knitr |
| Config/testthat/edition: | 3 |
| Config/roxygen2/version: | 8.0.0 |
| URL: | https://github.com/stefanosbalaskas/gp3tools |
| BugReports: | https://github.com/stefanosbalaskas/gp3tools/issues |
| NeedsCompilation: | no |
| Packaged: | 2026-06-22 20:33:54 UTC; Stefanos-PC |
| Author: | Stefanos Balaskas [aut, cre] |
| Maintainer: | Stefanos Balaskas <s.balaskas@ac.upatras.gr> |
| Repository: | CRAN |
| Date/Publication: | 2026-06-29 12:50:07 UTC |
Convert Gazepoint all-gaze data to a master sample table
Description
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.
Usage
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
)
Arguments
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. |
Details
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.
Value
A tibble with one row per sample and standardised sample-level eye-tracking columns.
Examples
results <- run_gazepoint_workflow(
export_dir = system.file("extdata", "gazepoint_realistic_demo_exports", package = "gp3tools"),
output_dir = file.path(tempdir(), "gp3_outputs")
)
master <- as_gazepoint_master(
gazepoint_example_master,
screen_width_px = 1920,
screen_height_px = 1080
)
dplyr::glimpse(master)
Audit AOI coding against geometry
Description
Validate observed sample-level AOI labels against AOI labels derived from gaze coordinates and AOI geometry.
Usage
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
)
Arguments
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 |
Value
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.
Audit AOI geometry definitions
Description
Create a publication-level audit of AOI geometry definitions, including AOI size, area, coordinate validity, screen-bound checks, and duplicate geometry.
Usage
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
)
Arguments
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 |
Value
A list with class gp3_aoi_geometry_audit containing overview,
geometry_summary, size_summary, flagged_aois, duplicate_geometry, and
settings tables.
Audit AOI margin sensitivity
Description
Audit whether sample-level AOI assignments are sensitive to small expansions or shrinkages of AOI boundaries.
Usage
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
)
Arguments
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 |
Value
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.
Audit AOI overlap
Description
Create a publication-level audit of pairwise AOI overlap within each stimulus.
Usage
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
)
Arguments
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 |
Value
A list with class gp3_aoi_overlap_audit containing overview,
geometry_summary, pairwise_overlap, overlap_summary, flagged_overlaps, and
settings tables.
Audit AOI window denominators before binomial modelling
Description
Audit AOI-window sample denominators before confirmatory binomial or
logistic mixed-effects modelling. The function is designed for output from
summarise_gazepoint_aoi_windows().
Usage
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
)
Arguments
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. |
Value
A named list containing overview, row audit, window summary, condition-window summary, denominator-imbalance summary, flagged rows, and settings.
Audit condition-level quality imbalance
Description
Create a publication-level audit of whether gaze, pupil, retention, or other quality metrics differ across experimental conditions.
Usage
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")
)
Arguments
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. |
Value
A list with class gp3_condition_quality_imbalance_audit
containing overview, condition_summary, metric_summary, flagged_metrics,
and settings tables.
Audit Gazepoint experimental design balance
Description
Create a publication-level audit of observed design balance across subjects, conditions, and optional stimulus/trial identifiers.
Usage
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
)
Arguments
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 |
Value
A list with class gp3_design_balance_audit containing overview,
subject_summary, condition_summary, cell_summary, imbalance_summary,
flagged_cells, and settings tables.
Audit Gazepoint event and timing synchronisation
Description
Create a publication-level audit of event timing, trial timing, and event availability in a Gazepoint master table or sample-level export.
Usage
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
)
Arguments
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. |
Value
A list with class gp3_event_sync_audit containing overview,
unit_summary, event_summary, expected_event_summary, flagged_units, and
settings tables.
Audit Gazepoint exclusion and retention flow
Description
Create a publication-level audit of retained and excluded analysis units.
Usage
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
)
Arguments
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. |
Value
A list with class gp3_exclusion_flow_audit containing overview,
unit_flow, reason_summary, condition_summary, subject_summary,
flagged_units, and settings tables.
Audit Gazepoint gaze-signal quality
Description
Create a publication-level audit of gaze coordinate availability, validity, off-screen samples, and optional pupil availability.
Usage
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
)
Arguments
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. |
Value
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.
Audit a Gazepoint master sample table
Description
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.
Usage
audit_gazepoint_master(master)
Arguments
master |
A master sample-level table created by |
Value
A named list of tibbles:
- overview
One-row overview of the master table.
- by_subject
Quality summary by participant/source.
- by_media
Quality summary by media/stimulus.
- by_subject_media
Quality summary by participant/source and media/stimulus.
- aoi_states
Counts and percentages of AOI states.
- pupil_summary
Pupil summary by participant/source and media/stimulus.
- coordinate_summary
Coordinate range and off-screen summary.
Examples
master <- gazepoint_example_master
results <- run_gazepoint_workflow(
export_dir = system.file("extdata", "gazepoint_realistic_demo_exports", package = "gp3tools"),
output_dir = file.path(tempdir(), "gp3_outputs")
)
master <- create_gazepoint_master(
gaze_data = gazepoint_example_master,
screen_width_px = 1920,
screen_height_px = 1080
)
audit <- audit_gazepoint_master(master)
audit$overview
audit$by_subject
audit$aoi_states
Audit post-exclusion condition balance
Description
Create a publication-level audit of whether the retained analysis sample remains balanced across subjects and experimental conditions after exclusions.
Usage
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
)
Arguments
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 |
Value
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.
Audit Gazepoint pupil baseline quality
Description
Summarise baseline quality after baseline_correct_gazepoint_pupil().
Usage
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
)
Arguments
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. |
Details
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.
Value
A tibble with one row per group.
Audit Gazepoint pupil drift
Description
Summarise tonic pupil/time-on-task drift in processed Gazepoint pupil data.
Usage
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
)
Arguments
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. |
Details
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.
Value
A named list containing by_group, by_subject, by_condition,
condition_balance, and summary tibbles.
Audit Gazepoint pupil interpolation gaps
Description
Summarise observed, interpolated, and remaining missing pupil samples, together with gap-level counts and gap duration/sample-size summaries.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A tibble with one row per group, or one row overall when
group_cols = character(0).
Audit Gazepoint pupil preprocessing imbalance
Description
Check whether pupil preprocessing loss differs across experimental conditions or other grouping variables.
Usage
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
)
Arguments
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. |
Details
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.
Value
A tibble with one row per group and imbalance-warning columns.
Audit Gazepoint pupil-response overlap risk
Description
Check whether event-related pupil-response windows may overlap.
Usage
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
)
Arguments
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 |
Details
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".
Value
A named list containing events, event_gaps, by_trial, and
summary tibbles.
Audit split-half reliability for Gazepoint pupil outcomes
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_pupil_reliability_audit.
Audit stimulus luminance and brightness for Gazepoint studies
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_stimulus_luminance_audit.
Baseline-correct Gazepoint pupil data
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble containing the original data plus baseline-correction columns.
Examples
master <- gazepoint_example_master
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)
)
Check Gazepoint all-gaze and fixation file pairs
Description
Checks whether each Gazepoint participant/source has both an all-gaze CSV file and a fixation CSV file before running the full workflow.
Usage
check_gazepoint_file_pairs(
folder,
all_gaze_pattern = "_all_gaze\\.csv$",
fixation_pattern = "_fixations\\.csv$",
recursive = FALSE
)
Arguments
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 |
Value
A tibble with one row per detected participant/source and file-pair status.
Check model convergence
Description
Check convergence status for fitted models used in gp3tools workflows.
Usage
check_gazepoint_model_convergence(model, model_name = NULL)
Arguments
model |
A fitted model object, or a |
model_name |
Optional model label used in the returned table. |
Details
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.
Value
A tibble with model class, convergence status, diagnostic status, and message.
Check model overdispersion
Description
Compute a Pearson-residual overdispersion diagnostic for models where this is meaningful, especially binomial and count models.
Usage
check_gazepoint_model_overdispersion(
model,
ratio_threshold = 1.2,
model_name = NULL
)
Arguments
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. |
Details
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.
Value
A tibble with Pearson chi-square, residual degrees of freedom, dispersion ratio, overdispersion flag, diagnostic status, and message.
Check model singularity
Description
Check whether a fitted mixed model has a singular random-effects structure.
Usage
check_gazepoint_model_singularity(model, tolerance = 1e-04, model_name = NULL)
Arguments
model |
A fitted model object, or a |
tolerance |
Numeric tolerance passed to |
model_name |
Optional model label used in the returned table. |
Details
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.
Value
A tibble with model class, singular-fit status, diagnostic status, and message.
Check real-data readiness before Gazepoint analysis
Description
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.
Usage
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"
)
Arguments
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. |
Details
This helper is a final decision wrapper. It complements, but does not replace,
validate_gazepoint_master() or create_gazepoint_analysis_decision_audit().
Value
A list with class gp3_real_data_readiness_gate.
Check sampling rate by group
Description
Check sampling rate by group
Usage
check_sampling_rate(data, group_cols = "MEDIA_ID", time_col = "TIME")
Arguments
data |
A Gazepoint all-gaze data frame. |
group_cols |
Character vector of grouping columns, usually |
time_col |
Name of elapsed-time column. |
Value
A tibble with sample interval and estimated Hz.
Classify a Gazepoint export
Description
Uses the filename and header structure to classify a file as all_gaze,
fixations, summary, or unknown.
Usage
classify_gazepoint_export(path)
Arguments
path |
File path. |
Value
A single character string.
Compare nested Gazepoint models
Description
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.
Usage
compare_gazepoint_nested_models(
models,
model_names = NULL,
comparison = c("sequential", "against_first"),
name = "gazepoint_nested_model_comparison"
)
Arguments
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. |
Details
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.
Value
A list with class gp3_nested_model_comparison.
Compute Gazepoint AOI transition matrices
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list containing count matrices, probability matrices, and long-form transition counts/probabilities.
Compute time-varying Gazepoint transition matrices
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_time_varying_transition_matrix.
Compute an AOI transition matrix
Description
Compute an AOI transition matrix
Usage
compute_transition_matrix(
data,
group_cols = "MEDIA_ID",
aoi_col = "AOI",
time_col = "TIME",
collapse_repeats = TRUE
)
Arguments
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 |
Value
A tibble with from, to, n, and prob.
Create a final Gazepoint analysis-decision audit
Description
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.
Usage
create_gazepoint_analysis_decision_audit(
...,
results = NULL,
branch_roles = NULL,
required_confirmatory = character(),
diagnostics_required = TRUE,
require_clean_diagnostics = FALSE
)
Arguments
... |
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 |
Value
A list with class gp3_analysis_decision_audit containing overview,
branch audit, diagnostics summary, interpretation cautions, readiness, and
settings tables.
Create a Gazepoint AOI Markov-chain object
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_markovchain_object.
Create a master long-format dataset from Gazepoint all-gaze data
Description
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.
Usage
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
)
Arguments
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. |
Value
A tibble with one row per Gazepoint sample and publication-oriented master columns.
Create a Gazepoint preprocessing multiverse
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_preprocessing_multiverse containing overview,
pupil grid, AOI grid, combined grid, and settings tables.
Create a Gazepoint pupil-preprocessing registry
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with one row per preprocessing parameter.
Examples
registry <- create_gazepoint_preprocessing_registry()
registry
Create a Gazepoint HTML diagnostic report
Description
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.
Usage
create_gazepoint_report(
results,
output_file,
title = "Gazepoint diagnostic report",
overwrite = TRUE,
max_rows = 30,
save_plots = TRUE,
plot_dir = NULL
)
Arguments
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 |
Value
A tibble with the written report path and plot folder.
Create a Gazepoint reporting checklist
Description
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.
Usage
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"
)
Arguments
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. |
Details
This helper is intended as a reporting aid. It does not replace the underlying audit, preprocessing, modelling, or readiness-gate functions.
Value
A list with class gp3_reporting_checklist.
Diagnose GAM and BAM models
Description
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.
Usage
diagnose_gazepoint_gamm(
model,
model_name = NULL,
check_convergence = TRUE,
check_basis = TRUE,
check_overdispersion = TRUE,
use_dharma = FALSE,
dharma_simulations = 250,
seed = 123
)
Arguments
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. |
Details
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.
Value
A list with overview, convergence, basis, overdispersion, DHARMa diagnostics, and settings.
Diagnose GLMM, LMM, and GLM models
Description
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.
Usage
diagnose_gazepoint_glmm(
model,
model_name = NULL,
check_convergence = TRUE,
check_singularity = TRUE,
check_overdispersion = TRUE,
use_dharma = TRUE,
dharma_simulations = 250,
seed = 123
)
Arguments
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. |
Details
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.
Value
A list with overview, convergence, singularity, overdispersion, DHARMa diagnostics, and settings.
Estimate a bootstrapped divergence point between two Gazepoint time courses
Description
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.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A list with class gp3_divergence_point_analysis.
Export a Gazepoint master table, audit tables, and validation tables
Description
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().
Usage
export_gazepoint_master_audit(
master,
audit = NULL,
validation = NULL,
output_dir = NULL,
prefix = "gazepoint",
export_master = TRUE,
export_audit = TRUE,
export_validation = TRUE,
overwrite = TRUE,
na = ""
)
Arguments
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. Must be supplied explicitly. |
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. |
Value
A tibble listing the exported files, table names, and dimensions.
Examples
master <- tibble::tibble(
subject = c("P1", "P1", "P2", "P2"),
MEDIA_ID = c("M1", "M1", "M1", "M1"),
time = c(0, 16, 0, 16),
x = c(100, 120, 200, 220),
y = c(100, 130, 200, 230),
raw_x = c(0.10, 0.12, 0.20, 0.22),
raw_y = c(0.20, 0.26, 0.30, 0.34),
valid_sample = c(TRUE, TRUE, TRUE, TRUE),
missing_gaze = c(FALSE, FALSE, FALSE, FALSE),
missing_pupil = c(FALSE, FALSE, FALSE, FALSE),
gaze_offscreen = c(FALSE, FALSE, FALSE, FALSE),
mean_pupil = c(3.5, 3.6, 3.7, 3.8),
aoi_current = c("AOI 1", "AOI 1", "AOI 2", "AOI 2"),
aoi_count = c(1L, 1L, 1L, 1L),
screen_width_px = rep(1000, 4),
screen_height_px = rep(500, 4)
)
exported <- export_gazepoint_master_audit(
master = master,
output_dir = file.path(tempdir(), "gp3_master_audit"),
prefix = "example"
)
exported
Export manuscript-ready model tables
Description
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().
Usage
export_gazepoint_model_tables(
model_summary = NULL,
emmeans_summary = NULL,
output_dir,
prefix = "gazepoint_model",
overwrite = TRUE,
include_diagnostics = TRUE
)
Arguments
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 |
Value
A tibble indexing the written files.
Export Gazepoint analysis tables to CSV files
Description
Writes a named list of analysis tables to CSV files in an output folder.
Usage
export_gazepoint_tables(
tables,
output_dir,
prefix = NULL,
overwrite = TRUE,
na = ""
)
Arguments
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. |
Value
A tibble with table names and written file paths.
Fit AOI time-course GAMMs
Description
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.
Usage
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,
...
)
Arguments
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 |
Details
This function is intended for AOI time-course modelling. It is separate from confirmatory AOI-window GLMMs and from cluster-based permutation tests.
Value
A list containing the fitted model, formula, model status, diagnostics, parametric table, smooth table, and settings.
Fit AOI-window model-family sensitivity checks
Description
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.
Usage
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
)
Arguments
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. |
Value
A list containing fitted models, formulas, comparison table, fixed effects table, settings, and status information.
Fit an AOI-window binomial GLMM
Description
Fit a confirmatory AOI-window mixed-effects logistic regression from data
prepared by prepare_gazepoint_aoi_glmm_data().
Usage
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
)
Arguments
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. |
Value
A list with fitted model, attempted model, formulas, comparison table, settings, status fields, and model data.
Fit a Gazepoint Growth Curve Analysis mixed model
Description
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.
Usage
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
)
Arguments
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 |
Value
A list of class gp3_gca_model containing the fitted model, attempted
and final formulas, model comparison information, settings, and status.
Fit a Gazepoint pupil GAMM
Description
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().
Usage
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
)
Arguments
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 |
Value
A list of class gp3_pupil_gamm containing the fitted model,
formula, data, settings, and status information.
Fit a gaze-position-adjusted pupil GAMM sensitivity model
Description
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).
Usage
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
)
Arguments
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 |
Value
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 confirmatory pupil-window linear mixed models
Description
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.
Usage
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,
...
)
Arguments
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 |
Value
A list containing the fitted model, formula, attempted model, fallback information, fixed effects, comparison table, settings, and model diagnostics.
Run sensitivity models for confirmatory pupil-window analyses
Description
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.
Usage
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,
...
)
Arguments
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
|
Value
A list containing fitted models, formulas, fixed effects, a comparison table, settings, and model-status information.
Fit optional negative-binomial transition-count sensitivity models
Description
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.
Usage
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"
)
Arguments
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. |
Details
The helper keeps glmmTMB optional. If glmmTMB is not installed, it returns
a structured skipped object rather than failing.
Value
A list with class gp3_transition_count_nb_sensitivity.
Flag invalid, missing, implausible, and outlying Gazepoint pupil samples
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble containing the original master table plus pupil-flagging columns.
Examples
master <- gazepoint_example_master
flagged <- flag_gazepoint_pupil(master)
dplyr::count(flagged, pupil_flag_reason)
Flag Gazepoint pupil artifacts before interpolation
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble containing the original data plus pupil-artifact columns.
Examples
master <- gazepoint_example_master
registry <- create_gazepoint_preprocessing_registry()
artifact_pupil <- flag_gazepoint_pupil_artifacts(
master,
registry = registry
)
dplyr::count(artifact_pupil, pupil_artifact_reason)
Flag pupil artifacts with a Hampel filter
Description
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.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A tibble with Hampel-filter columns added. The object has class
gp3_pupil_hampel_flags.
Flag low-quality Gazepoint recordings
Description
Combines tracking-quality and sampling-rate summaries and flags rows with low gaze validity, low pupil validity, abnormal sampling rate, or short duration.
Usage
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
)
Arguments
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. |
Value
A tibble with quality, sampling, flag columns, and an overall review flag.
Example AOI geometry table
Description
A lightweight synthetic AOI geometry table for AOI-verification examples. Coordinates are normalised to a 0–1 screen coordinate system.
Usage
gazepoint_example_aoi_geometry
Format
A tibble with one row per stimulus and AOI, including:
- media_id
Synthetic stimulus identifier.
- aoi
Synthetic AOI label.
- x_min, y_min, x_max, y_max
Normalised rectangular AOI boundaries.
Examples
data(gazepoint_example_aoi_geometry)
gazepoint_example_aoi_geometry
Example AOI-window summary table
Description
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.
Usage
gazepoint_example_aoi_windows
Format
A tibble with one row per participant, stimulus/trial, and AOI time window.
Examples
data(gazepoint_example_aoi_windows)
head(gazepoint_example_aoi_windows)
Example Gazepoint fixation table
Description
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.
Usage
gazepoint_example_fixations
Format
A tibble with fixation-level rows and columns including:
- USER_FILE
Synthetic participant/file identifier.
- subject
Synthetic participant identifier.
- MEDIA_ID
Synthetic stimulus identifier.
- trial_global
Synthetic trial identifier.
- condition
Synthetic experimental condition.
- FPOGID
Synthetic fixation identifier.
- FPOGS
Synthetic fixation start time.
- FPOGD
Synthetic fixation duration.
- FPOGX, FPOGY
Synthetic fixation coordinates.
- FPOGV
Synthetic fixation validity flag.
- AOI
Synthetic AOI label.
Examples
data(gazepoint_example_fixations)
head(gazepoint_example_fixations)
Example Gazepoint master table
Description
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.
Usage
gazepoint_example_master
Format
A tibble with sample-level rows and columns including:
- subject
Synthetic participant identifier.
- USER_FILE
Gazepoint-style participant/file identifier.
- MEDIA_ID
Synthetic stimulus identifier.
- trial_global
Synthetic trial identifier.
- condition
Synthetic experimental condition.
- time
Sample time in milliseconds.
- x, y
Normalised gaze coordinates.
- pupil
Synthetic pupil value.
- valid
Logical gaze/pupil validity flag.
- artifact
Logical synthetic pupil-artifact flag.
- aoi_current
Synthetic AOI state.
- is_fixation, is_saccade
Synthetic fixation and saccade indicators.
- event_label
Synthetic event marker.
Examples
data(gazepoint_example_master)
head(gazepoint_example_master)
Example pupil-window summary table
Description
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.
Usage
gazepoint_example_pupil_windows
Format
A tibble with one row per participant, stimulus/trial, condition, and pupil time window.
Examples
data(gazepoint_example_pupil_windows)
head(gazepoint_example_pupil_windows)
Inspect Gazepoint columns
Description
Inspect Gazepoint columns
Usage
inspect_gazepoint_columns(x)
Arguments
x |
A data frame or path to a Gazepoint CSV export. |
Value
A tibble describing column names, semantic groups, and missingness.
Interpolate short missing gaps in Gazepoint pupil data
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble containing the original data plus interpolation columns.
Examples
master <- gazepoint_example_master
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)
Interpolate Gazepoint pupil data using PCHIP
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble with PCHIP interpolation columns added.
Plot AOI time-course GAMM results
Description
Plot observed AOI target-looking proportions and fitted GAMM trajectories
from a model returned by fit_gazepoint_aoi_gamm().
Usage
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)
)
Arguments
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. |
Details
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.
Value
A ggplot object with prediction and observed data stored as
attributes.
Plot Gazepoint AOI transition matrix
Description
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.
Usage
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
)
Arguments
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. |
Value
A ggplot2 plot object.
Plot AOI geometry for visual verification
Description
Create a visual verification plot of AOI rectangles, with optional gaze samples overlaid.
Usage
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
)
Arguments
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. |
Value
A ggplot object.
Plot cluster-based permutation results
Description
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.
Usage
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
)
Arguments
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. |
Details
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.
Value
A ggplot object.
Plot observed and fitted Growth Curve Analysis trajectories
Description
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.
Usage
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
)
Arguments
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. |
Value
A ggplot2 object.
Plot observed summaries and model-implied predictions
Description
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().
Usage
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"
)
Arguments
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. |
Value
A ggplot object with attributes containing the observed summary,
prediction summary, overview, and settings.
Plot Gazepoint preprocessing multiverse results
Description
Create diagnostic plots from preprocessing multiverse summaries or from pupil/AOI multiverse result objects.
Usage
plot_gazepoint_multiverse_results(
x,
plot = c("status", "rows", "pupil_parameters", "aoi_denominators"),
family = c("all", "pupil", "aoi"),
title = NULL,
show_labels = TRUE
)
Arguments
x |
A |
plot |
Character. Plot type. One of |
family |
Character. Which family to show. One of |
title |
Optional plot title. |
show_labels |
Logical. If |
Value
A ggplot object.
Plot Gazepoint pupil preprocessing for one trial
Description
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.
Usage
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
)
Arguments
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. |
Value
A ggplot2 plot object.
Plot Gazepoint pupil preprocessing status
Description
Visualise observed, interpolated, missing, artifact, and other pupil-sample statuses over time or as grouped percentages.
Usage
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
)
Arguments
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. |
Value
A ggplot2 plot object.
Plot Gazepoint pupil time course
Description
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.
Usage
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
)
Arguments
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. |
Value
A ggplot2 plot object.
Plot Gazepoint sampling-rate diagnostics
Description
Creates a diagnostic plot of estimated sampling rate by participant/file and media stimulus.
Usage
plot_sampling_rate(
sampling,
user_col = "USER_FILE",
media_col = "MEDIA_ID",
expected_hz = 60,
hz_tolerance = 5
)
Arguments
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. |
Value
A ggplot object.
Plot Gazepoint tracking-quality diagnostics
Description
Creates a readable diagnostic plot of selected gaze and pupil validity percentages by participant/file and media stimulus.
Usage
plot_tracking_quality(
data,
metric_cols = NULL,
user_col = "USER_FILE",
media_col = "MEDIA_ID",
review_col = "review_required",
min_valid_pct = 70
)
Arguments
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. |
Value
A ggplot object.
Plot an AOI transition heatmap
Description
Plot an AOI transition heatmap
Usage
plot_transition_heatmap(transitions)
Arguments
transitions |
Output of |
Value
A ggplot object.
Prepare AOI time-course data for GAMM analysis
Description
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.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A tibble with standardised AOI-GAMM columns.
Prepare AOI-window data for binomial GLMMs
Description
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().
Usage
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"
)
Arguments
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. |
Value
A tibble of GLMM-ready AOI-window rows.
Prepare Gazepoint AOI sequences
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with ordered AOI sequence and transition fields.
Prepare time-course data for cluster-based permutation tests
Description
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.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A tibble with standardised cluster-test preparation columns.
Prepare Gazepoint master data for eyetools-style workflows
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with class gp3_eyetools_data.
Prepare Gazepoint master data for eyetrackingR-style workflows
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with class gp3_eyetrackingr_data.
Prepare fixation- or saccade-contingent aligned Gazepoint data
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_fixation_aligned_data.
Prepare Gazepoint master data for gazer-style workflows
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with class gp3_gazer_data.
Prepare Gazepoint Growth Curve Analysis data
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble of class gp3_gca_data with standard GCA columns and
polynomial time terms.
Prepare Gazepoint AOI/state sequences for HMM-style workflows
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_hmm_data.
Prepare Gazepoint pupil GAMM data
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble with binned pupil time-course data for GAMM modelling.
Prepare pupil-window data for confirmatory mixed models
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble of pupil-window rows prepared for confirmatory modelling.
Prepare Gazepoint master data for pupillometryR-style workflows
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with class gp3_pupillometryr_data.
Prepare Gazepoint AOI sequences for semi-Markov modelling
Description
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.
Usage
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"
)
Arguments
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. |
Value
A list with class gp3_semimarkov_data.
Read a Gazepoint all-gaze or fixation CSV export
Description
Reads Gazepoint all-gaze and fixation CSV exports, standardises timestamped column names, and removes empty trailing columns produced by Gazepoint exports.
Usage
read_gazepoint(path, standardise_names = TRUE, drop_empty_cols = TRUE)
Arguments
path |
Path to a Gazepoint CSV export. |
standardise_names |
Logical. If |
drop_empty_cols |
Logical. If |
Value
A tibble with attributes gp3_file_type and gp3_source_file.
Read multiple Gazepoint CSV exports from a folder
Description
Reads all Gazepoint all-gaze or fixation CSV exports in a folder that match a filename pattern and combines them into one tibble.
Usage
read_gazepoint_folder(
folder,
pattern = "\\.csv$",
source_col = "USER_FILE",
recursive = FALSE,
...
)
Arguments
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 |
Value
A tibble containing all matching files combined row-wise.
Read a Gazepoint Analysis Data Summary export
Description
Parses the multi-section Data_Summary_export_*.csv file into metadata,
aoi_summary, and aoi_by_user tables.
Usage
read_gazepoint_summary(path)
Arguments
path |
Path to |
Value
A list with metadata, aoi_summary, and aoi_by_user.
Offline gaze recalibration using known target coordinates
Description
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.
Usage
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"
)
Arguments
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. |
Details
This helper is useful only when known target coordinates are available, for example from calibration checks, fixation targets, validation targets, or drift-check trials.
Value
A tibble with recalibrated gaze columns and recalibration attributes.
Recommend trial and participant exclusions
Description
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.
Usage
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"
)
Arguments
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. |
Details
This function recommends exclusions only. It does not remove rows.
Value
A list with overview, trial recommendations, participant recommendations, an explicit exclusion table, and settings.
Run a Gazepoint AOI preprocessing multiverse
Description
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.
Usage
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
)
Arguments
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 |
Value
A list with class gp3_aoi_multiverse_results containing overview,
branch results, optional branch outputs, and settings.
Run paired cluster-based permutation tests
Description
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.
Usage
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
)
Arguments
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. |
Details
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.
Value
A list containing observed time-course statistics, observed clusters, the permutation distribution, settings, and status fields.
Run optional eyetools fixation and saccade detection
Description
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().
Usage
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"
)
Arguments
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. |
Details
This helper is an optional external-detector branch. It does not replace the
main gp3tools summaries or AOI/transition workflows.
Value
A list with class gp3_eyetools_fixation_detection.
Run an optional gazeR pupil-preprocessing cross-check
Description
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.
Usage
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"
)
Arguments
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. |
Details
This helper is a cross-check branch. It is not intended to replace the main
gp3tools pupil preprocessing pipeline.
Value
A list with class gp3_gazer_crosscheck.
Run leave-one-unit model sensitivity analysis
Description
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.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A list with class gp3_model_leave_one_out_sensitivity.
Run a Gazepoint pupil preprocessing multiverse
Description
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.
Usage
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
)
Arguments
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 |
Value
A list with class gp3_pupil_multiverse_results containing overview,
branch results, optional branch outputs, and settings.
Run a complete Gazepoint analysis workflow
Description
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.
Usage
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
)
Arguments
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. |
Value
A named list containing file-pair checks, imported data, analysis tables, quality flags, written table paths, written plot paths, and written report path.
Save standard Gazepoint diagnostic plots
Description
Saves standard diagnostic plots produced from gp3tools workflow outputs.
Usage
save_gazepoint_plots(
flagged_quality = NULL,
sampling = NULL,
output_dir,
prefix = "gazepoint",
overwrite = TRUE,
width = 9,
height_quality = 6,
height_sampling = 5,
dpi = 300
)
Arguments
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. |
Value
A tibble with plot names and written file paths.
Smooth Gazepoint pupil data
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble containing the original data plus pupil-smoothing columns.
Examples
pupil_data <- tibble::tibble(
subject = rep("P1", 6),
time = c(0, 16, 32, 48, 64, 80),
pupil_baseline_corrected = c(0.00, 0.10, 0.20, 0.10, 0.00, -0.10)
)
smoothed <- smooth_gazepoint_pupil(
pupil_data,
pupil_col = "pupil_baseline_corrected",
time_col = "time",
group_cols = "subject",
window_samples = 3,
method = "mean"
)
smoothed
Standardise Gazepoint column names
Description
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.
Usage
standardise_gazepoint_names(x)
Arguments
x |
A data frame or character vector of column names. |
Value
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.
Summarise sample-level AOI viewing
Description
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.
Usage
summarise_aoi_samples(
data,
group_cols = "MEDIA_ID",
aoi_col = "AOI",
time_col = "TIME"
)
Arguments
data |
A Gazepoint all-gaze data frame. |
group_cols |
Grouping columns. |
aoi_col |
AOI column name. |
time_col |
Time column name. |
Value
A tibble with AOI sample count, TTFF, and approximate dwell time.
Summarise fixation-level AOI metrics
Description
Summarise fixation-level AOI metrics
Usage
summarise_fixations(data, group_cols = "MEDIA_ID", aoi_col = "AOI")
Arguments
data |
A Gazepoint fixation data frame. |
group_cols |
Grouping columns. |
aoi_col |
AOI column name. |
Value
A tibble with fixation counts and summed fixation duration by AOI.
Summarise Gazepoint AOI metrics from gaze and fixation exports
Description
Combines sample-level AOI viewing information from all-gaze data with fixation-level AOI metrics from fixation data.
Usage
summarise_gazepoint_aoi(
gaze_data,
fixation_data,
user_col = "USER_FILE",
sample_rate = 60
)
Arguments
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. |
Value
A tibble with one row per user, media, and AOI.
Summarise Gazepoint AOI entry episodes
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble with one row per AOI entry episode.
Summarise Gazepoint AOI transition features
Description
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().
Usage
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"
)
Arguments
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. |
Value
A tibble with one row per group and trial-level AOI transition features.
Summarise Gazepoint AOI trial features
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble with one row per trial/group and AOI trial-level features.
Summarise Gazepoint AOI samples within predefined time windows
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble with one row per group and AOI window.
Summarise cluster-based permutation results
Description
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.
Usage
summarise_gazepoint_clusters(
result,
alpha = 0.05,
round_digits = NULL,
include_timecourse = TRUE
)
Arguments
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 |
Details
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.
Value
A list of summary tables.
Summarise estimated marginal means and contrasts
Description
Create manuscript-ready estimated marginal means and pairwise contrast tables
from fitted models used in gp3tools workflows.
Usage
summarise_gazepoint_emmeans(
model,
specs,
by = NULL,
model_name = NULL,
type = "response",
contrast_method = "pairwise",
adjust = "tukey",
conf_level = 0.95,
include_contrasts = TRUE
)
Arguments
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 |
Details
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.
Value
A list with overview, emmeans, contrasts, and settings. The returned
object has class gp3_emmeans_summary.
Summarise Gazepoint fixation trial features
Description
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.
Usage
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"
)
Arguments
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. |
Value
A tibble with one row per trial/group and fixation-level features.
Summarise fixed effects from fitted models
Description
Create a compact manuscript-ready fixed-effect summary table from common
models used in gp3tools workflows.
Usage
summarise_gazepoint_fixed_effects(
model,
model_name = NULL,
conf_level = 0.95,
exponentiate = FALSE,
drop_intercept = FALSE
)
Arguments
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 |
Details
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.
Value
A tibble with fixed-effect estimates, standard errors, test statistics, p-values when available, confidence intervals, significance stars, and status fields.
Summarise Gazepoint preprocessing multiverse results
Description
Summarise pupil and/or AOI preprocessing multiverse result objects created by
run_gazepoint_pupil_multiverse() and run_gazepoint_aoi_multiverse().
Usage
summarise_gazepoint_multiverse_results(..., results = NULL)
Arguments
... |
One or more multiverse result objects. |
results |
Optional named list of multiverse result objects. |
Value
A list with class gp3_multiverse_summary_results containing
overview, branch summary, failure summary, and settings tables.
Summarise Gazepoint pupil data
Description
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.
Usage
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
)
Arguments
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
|
Value
A tibble with pupil-quality and pupil-distribution summaries.
Examples
master <- gazepoint_example_master
master <- create_gazepoint_master(
gaze_data = gazepoint_example_master,
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))
Summarise Gazepoint pupil trial-level features
Description
Convert sample-level Gazepoint pupil time series into trial-level pupil features for statistical modelling.
Usage
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
)
Arguments
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 |
Details
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.
Value
A tibble with one row per trial/group.
Summarise Gazepoint pupil responses within time windows
Description
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.
Usage
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
)
Arguments
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 |
Value
A tibble with one row per group-by-window combination present in the data.
Examples
pupil_data <- tibble::tibble(
subject = rep("P1", 6),
media_id = rep("M1", 6),
time = c(0, 250, 500, 750, 1000, 1250),
pupil_smoothed = c(0.00, 0.05, 0.10, 0.08, 0.03, 0.00)
)
pupil_windows <- summarise_gazepoint_pupil_windows(
pupil_data,
pupil_col = "pupil_smoothed",
time_col = "time",
windows = c(0, 500, 1000, 1500),
group_cols = c("subject", "media_id")
)
pupil_windows
Summarise a Gazepoint workflow result
Description
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.
Usage
summarise_gazepoint_workflow(results)
Arguments
results |
A named list returned by |
Value
A tibble with one row containing workflow-level summary counts.
Examples
results <- run_gazepoint_workflow(
export_dir = system.file("extdata", "gazepoint_realistic_demo_exports", package = "gp3tools"),
output_dir = file.path(tempdir(), "gp3_outputs"),
prefix = "study1",
save_plots = TRUE,
create_report = TRUE
)
summarise_gazepoint_workflow(results)
Summarise Gazepoint tracking quality
Description
Summarise Gazepoint tracking quality
Usage
summarise_tracking_quality(data, group_cols = "MEDIA_ID")
Arguments
data |
A Gazepoint data frame. |
group_cols |
Grouping columns. |
Value
A tibble with validity percentages for available validity columns.
Create a tidy model summary for manuscript tables
Description
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.
Usage
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
)
Arguments
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. |
Value
A list with overview, model_info, fixed_effects, diagnostics, and
settings. The returned object has class gp3_model_summary.
Transform AOI proportions to empirical logits
Description
Convert bounded AOI proportions into empirical logits for linear mixed models, growth-curve analysis, or other approximately Gaussian time-course models.
Usage
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"
)
Arguments
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. |
Details
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.
Value
A tibble with empirical-logit transformation columns added. The object
has class gp3_aoi_empirical_logit_data.
Validate a Gazepoint master sample table
Description
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.
Usage
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
)
Arguments
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 |
Value
A named list with:
- summary
One-row validation summary.
- checks
A tibble containing all validation checks.
- failed_checks
Validation checks with status
"fail".- warning_checks
Validation checks with status
"warning".- column_map
Detected column mapping used for validation.
Examples
master <- gazepoint_example_master
master <- create_gazepoint_master(
gaze_data = gazepoint_example_master,
screen_width_px = 1920,
screen_height_px = 1080
)
validation <- validate_gazepoint_master(master)
validation$summary
validation$checks
Write standard Gazepoint analysis outputs
Description
Convenience wrapper for exporting standard gp3tools outputs such as sampling
checks, tracking quality summaries, flagged quality rows, and AOI tables.
Usage
write_gazepoint_outputs(
sampling = NULL,
quality = NULL,
flagged_quality = NULL,
aoi_table = NULL,
output_dir,
prefix = "gazepoint",
overwrite = TRUE
)
Arguments
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 |
Value
A tibble with table names and written file paths.