Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data_path <-"C:/Users/willidon/Box Sync/ICC/RawData/Study1-Stroop"
- files_t1 <- list.files(data_path, pattern = "*1.csv")
- files_t2 <- list.files(data_path, pattern = "*2.csv")
- long_stroop <- foreach(i=seq_along(files_t1), .combine = "rbind") %do% {
- # For time 1
- tmp_t1 <- read.csv(file.path(data_path, files_t1[i]), header = F) %>%
- mutate(subj_num = i,
- time = 1)
- # For time 2 (about 3 weeks apart)
- tmp_t2 <- read.csv(file.path(data_path, files_t2[i]), header = F) %>%
- mutate(subj_num = i,
- time = 2)
- # Condition (0 = congruent, 1=neutral, 2=incongruent),
- # Correct (1) or incorrect (0),
- # Reaction time is in seconds
- names(tmp_t1)[1:6] <- names(tmp_t2)[1:6] <- c("Block", "Trial", "Unused",
- "Condition", "Correct", "RT")
- rbind(tmp_t1, tmp_t2)
- }
- t1 <- long_stroop %>% filter(time == 1,
- Condition != 1,
- Correct ==1 & RT < 2 & RT > 0.2) %>%
- mutate(time1 = 1, time2 = 0, cond = ifelse(Condition == 0, 0, 1 ))
- t2 <- long_stroop %>% filter(time == 2,
- Condition != 1,
- Correct ==1 & RT < 2 & RT > 0.2) %>%
- mutate(time1 = 0, time2 = 1, cond = ifelse(Condition == 0, 0, 1 ))
- mvn_data <- rbind.data.frame(t1, t2)
- library(brms)
- fit_mem <- brm(bf(RT ~ 0 + time1 + time1:cond + time2 + time2:cond +
- (0 + time1 + time1:cond + time2 + time2:cond | C |subj_num),
- sigma ~ 0 + time1 + time1:cond + time2 + time2:cond +
- (0 + time1 + time1:cond + time2 + time2:cond | C | subj_num)),
- data = mvn_data, cores = 2, chains = 2, iter = 3000, inits = 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement