Last active
September 29, 2015 21:43
-
-
Save brockf/52ac923fa02b86c7f3ce to your computer and use it in GitHub Desktop.
A brief example of eyetrackingR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load *eyetrackingR* and set data options | |
library(eyetrackingR) | |
data_options = set_data_options(item_columns = "Trial", trial_column = "Trial", time_column = "TimeFromPhaseOnset", trackloss_column = "TrackLoss", aoi_columns = c('Animate','Inanimate'), participant_column = "ParticipantName") | |
# verify colums in dataset | |
master_clean <- verify_dataset(master_clean, data_options) | |
# analyze and remove trackloss-ridden trials | |
master_clean <- convert_non_aoi_to_trackloss(master_clean, data_options) | |
trackloss <- trackloss_analysis(master_clean, data_options, window_start = 15500, window_end = 21000) | |
master_clean <- clean_by_trackloss(master_clean, data_options, participant_z_thresh = Inf, trial_z_thresh = 2, participant_prop_thresh = 1, trial_prop_thresh = .5, window_start = 15500, window_end = 21000) | |
master_clean <- remove_trackloss(master_clean, data_options, delete_rows = TRUE) | |
# zoom in on response window | |
word_window <- subset_by_window(master_clean, data_options, window_start = 15500, window_end = 21000) | |
# describe response data in summary | |
data_summary <- describe_column(word_window, data_options, c('ParticipantName','Condition')) | |
# perform growth curve analysis | |
word_time <- time_analysis(word_window, data_options, time_bin_size = 100, condition_columns = "Target", dv = c("Animate")) | |
plot(word_time, data_options, condition_column = "Target") | |
word_time$TargetC <- ifelse(word_time$Target == 'Animate', .5, -.5) | |
word_time$TargetC <- word_time$TargetC - mean(word_time$TargetC) | |
# use lme4 for mixed-effects modeling | |
library(lme4) | |
model <- lmer(Elog ~ TargetC*(ot1 + ot2 + ot3 + ot4 + ot5) + (1 | Trial) + (1 | ParticipantName), data = word_time, REML = FALSE) | |
summary(model) | |
drop1(model,~.,test="Chi") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment