#make sure everybody saw all pairs#make sure we have the right amount of trials at each distance: DONE#check RTs?#Num unique subjectslength(sub_csvs)
[1] 10
length(dist_mats)
[1] 10
all.combos <-combn(unique_stims, 2)#Check dimensions of dist_mats: Num trials, same color never presented together, and all 12 colors presented L/Rfor (i in1:length(sub_csvs)) { x <-sapply(dist_mats[[i]], function(x) dim(x)[1])if (all(x ==66)){print("Pass: This participant has 66 trials per distance, thus 198 total")} y <-sapply(dist_mats[[i]], function(x) sum(x$Left.Color != x$Right.Color))if(all(y ==66)) {print("Pass: The same color never presented together")} z <-sapply(dist_mats[[i]], function(x) c(length(unique(x$Left.Color)),length(unique(x$Right.Color))))if(all(z ==12)) {print("Pass: All 12 colors presented L/R")}#check RTs subRTs <- dist_mats[[i]] %>%reduce(bind_rows) %>%select(ResponseTime..ms.)hist(subRTs$ResponseTime..ms.)print(paste0(sum(subRTs$ResponseTime..ms. <100), " trials faster than 100ms"))}
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "1 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "1 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
[1] "Pass: This participant has 66 trials per distance, thus 198 total"
[1] "Pass: The same color never presented together"
[1] "Pass: All 12 colors presented L/R"
[1] "0 trials faster than 100ms"
Make preference matrices
#probably a better, existing way to do this, but I haven't found it yetpref_mat_list <-list()unique_stims <-sort(unique(c(subdat$Left.Color, subdat$Right.Color)))for (i in1:length(dist_mats)){ pref_mat_list[[i]] <-list()for (j in1:3){ tempdat <- dist_mats[[i]][[j]] submat <-matrix(0, ncol =12, nrow =12,dimnames =list(unique_stims, unique_stims))for (k in1:66){ tempresp <- tempdat$User.response.0.left.1.right.[k]#if participant responded with 0, then left color# if 1, then right colorif (tempresp ==0){ preferred <- tempdat$Left.Color[k] non <- tempdat$Right.Color[k] } elseif (tempresp ==1){ non <- tempdat$Left.Color[k] preferred <- tempdat$Right.Color[k] } submat[rownames(submat) == preferred, colnames(submat) == non] <- submat[rownames(submat) == preferred, colnames(submat) == non] +1 } pref_mat_list[[i]][[j]] <- submat } }
Aggregate pref matrices for each distance (and plot?)