Prepare Gazepoint Growth Curve Analysis data
Source:R/prepare_gazepoint_gca_data.R
prepare_gazepoint_gca_data.RdPrepare 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
prepare_gazepoint_pupil_gamm_data().- 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
TRUE, use orthogonal polynomial terms fromstats::poly(). IfFALSE, use raw powers of z-scored time.- 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
valid_samples_colis available.- weights_col
Optional weights column to preserve for later modelling.
- missing_condition_label
Label used when condition values are missing.
- drop_missing
Logical. If
TRUE, rows with missing outcome/time/subject values are removed.