Remove trials/participants with too much trackloss, with a customizable threshold.

clean_by_trackloss(
  data,
  participant_prop_thresh = 1,
  trial_prop_thresh = 1,
  window_start_time = -Inf,
  window_end_time = Inf
)

Arguments

data

Data already run through make_eyetrackingr_data

participant_prop_thresh

Maximum proportion of trackloss for participants

trial_prop_thresh

Maximum proportion of trackloss for trials

window_start_time, window_end_time

Time-window within which you want trackloss analysis to be based. Allows you to keep the entire trial window for data, but clean based on the trackloss within a subset of it

Value

Cleaned data

Examples

data(word_recognition)
data <- make_eyetrackingr_data(word_recognition, 
                               participant_column = "ParticipantName",
                               trial_column = "Trial",
                               time_column = "TimeFromTrialOnset",
                               trackloss_column = "TrackLoss",
                               aoi_columns = c('Animate','Inanimate'),
                               treat_non_aoi_looks_as_missing = TRUE
)

# scrub all trials with greater than 25% trackloss, and all
# participants with greater than 25% trackloss on average
# during the timeperiod 15500-2100
data_clean <- clean_by_trackloss(data,
                                 participant_prop_thresh = .25, 
                                 trial_prop_thresh = .25,
                                 window_start_time = 15500, 
                                 window_end_time = 21000
)
#> Performing Trackloss Analysis...
#> Will exclude trials whose trackloss proportion is greater than : 0.25
#> 	...removed  33  trials.
#> Will exclude participants whose trackloss proportion is greater than : 0.25
#> 	...removed  3  participants.

# scrub all trials with greater than 25% trackloss, but leave participants with a high average
data_clean <- clean_by_trackloss(data,
                                 trial_prop_thresh = .25,
                                 window_start_time = 15500, 
                                 window_end_time = 21000
)
#> Performing Trackloss Analysis...
#> Will exclude trials whose trackloss proportion is greater than : 0.25
#> 	...removed  33  trials.