Commit 413cd679 authored by Bonte Bruno's avatar Bonte Bruno

en train d organiser les graph

parent 014ffe42
......@@ -8,63 +8,78 @@ library(RColorBrewer)
#set working directory where this source file is
setwd("/home/bruno/git/aiat")
lemmDataFolder <- "~/git/interexpe-data/formated-data"
#################################################################
## Pour ploter les distributions des temps de réactions à partir#
##### des résultats bruts #######
#################################################################
alldata <- read.table("data/alldata-expe-lem.csv",
sep=",",
dec= ".",
header = T) %>%
alldata <- read.csv(file.path(lemmDataFolder, "iat-data.csv")) %>%
mutate(trial = trial + 1) %>%
mutate(id = as.factor(participant.label)) %>%
tbl_df()
iat_scores <- alldata %>%
filter(reactionTime < 3000) %>%
filter(reactionTime > 300) %>%
filter(trial == 4 | (trial == 7)) %>%
group_by(id) %>%
group_by(id, test.status) %>%
mutate(full.sd = sd(reactionTime)) %>%
group_by(id, trial, full.sd) %>%
group_by(id, trial, full.sd, test.status, refSession.traitement) %>%
summarise(mRT = mean(reactionTime), sdRT = sd(reactionTime)) %>%
gather(variable,value, -id, -full.sd, -trial) %>%
gather(variable,value, mRT, sdRT) %>%
unite(block, trial, variable) %>%
spread(block,value, sep = "") %>%
mutate(d = round((block7_mRT - block4_mRT) / full.sd, digits=5))
mutate(d = round((block7_mRT - block4_mRT) / full.sd, digits=5)) %>%
na.omit()
iat_scores_train <- alldata %>%
filter(reactionTime < 3000) %>%
filter(reactionTime > 300) %>%
filter(trial == 3 | (trial == 6)) %>%
group_by(id) %>%
group_by(id, test.status) %>%
mutate(full.sd = sd(reactionTime)) %>%
group_by(id, trial, full.sd) %>%
group_by(id, trial, full.sd, test.status, refSession.traitement) %>%
summarise(mRT = mean(reactionTime), sdRT = sd(reactionTime)) %>%
gather(variable,value, -id, -full.sd, -trial) %>%
gather(variable,value, mRT, sdRT) %>%
unite(block, trial, variable) %>%
spread(block,value, sep = "") %>%
mutate(d = round((block6_mRT - block3_mRT) / full.sd, digits=5))
mutate(d = round((block6_mRT - block3_mRT) / full.sd, digits=5)) %>%
na.omit()
alldata %>%
filter(test.status != "onlyPre") %>%
filter(reactionTime < 3000) %>%
filter(reactionTime > 300) %>%
filter(trial == 4 | (trial == 7)) %>%
mutate(category = recode_factor(category,
"A"= "Appropriation",
"P"= "Partage",
"1"= "Moi",
"2"= "PasMoi")) %>%
"A" = "Appropriation",
"P" = "Partage",
"1" = "Moi",
"2" = "PasMoi")) %>%
mutate(trial=as.factor(trial)) %>%
left_join(iat_scores, by='id') %>%
mutate(lab = paste0("id: ", id,"\n(d=",d,")")) %>%
left_join(iat_scores, by=c('id', "test.status", "refSession.traitement")) %>%
mutate(lab = paste0( "Traitement: ",refSession.traitement, "\nid: ", id, " ", test.status, "\n(d=",d,")")) %>%
ggplot() +
geom_histogram(aes(x= reactionTime, fill=trial), position = "dodge") +
facet_wrap(~lab, scales ="free_x") +
theme(strip.text.x = element_text(size = 5)) +
ggsave("per-trial-reaction-times-alldata.pdf",
height = 21,
width = 29.7,
units = "cm")
iat_scores %>%
mutate(sujet = (as.factor(id))) %>%
mutate(when = - as.numeric(test.status)) %>%
ggplot() +
geom_bar(aes(x=sujet, y=d, fill = test.status, group = when), stat="identity", position= "dodge") +
facet_wrap(~refSession.traitement, scales = "free_x") +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.5)) +
scale_fill_discrete(breaks=c("pre", "post")) +
ggsave("avant-apres-iat.pdf")
iat_scores %>%
mutate(lab = (as.factor(id))) %>%
ggplot() +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment