library(plyr) #source("CI-Functions.R") source("CI-Functions-Bonferroni.R") defaultpath <- dirname(rstudioapi::getActiveDocumentContext()$path) setwd(defaultpath) if (exists ("mydata")) { rm(mydata) } mydata <- read.table("aggregated_data.csv", header=T, sep=",") #################################################################################### # # times # #################################################################################### ############################# # analysis of all questions # ############################# # order for the transpose elements <- mydata elements <- elements [ order(elements$user, elements$vis), ] # myvars <- c("user", "vis", "mean_time") elements <- elements [myvars] #aggregating all cases per participant statstable_time <- ddply(elements, c("user","vis"), summarise, time=mean(mean_time) ) elements <- statstable_time # elements <- reshape(elements, timevar="vis", idvar=c("user"), direction="wide") colnames(elements) <- gsub("time.", "", colnames(elements)) # drop columns with N/A elements <- na.omit(elements) ######### # stats # ######### data <- elements techniqueA <- bootstrapMeanCI(data$SmallMultiples) techniqueB <- bootstrapMeanCI(data$Animation) techniqueC <- bootstrapMeanCI(data$OneMap) # # Calculating means per condition # analysisData <- c() analysisData$name <- c("Gly","Ani","SMul") analysisData$pointEstimate <- c(techniqueC[1], techniqueB[1], techniqueA[1]) analysisData$ci.max <- c(techniqueC[3], techniqueB[3], techniqueA[3]) analysisData$ci.min <- c(techniqueC[2], techniqueB[2], techniqueA[2]) datatoprint <- data.frame(factor(analysisData$name),analysisData$pointEstimate, analysisData$ci.min, analysisData$ci.max) colnames(datatoprint) <- c("vis", "mean_time", "lowerBound_CI", "upperBound_CI ") #We use the name mean_time for the value of the mean even though it's not a time, it's just to parse the data for the plot path = paste0("plots/") filename = paste0("time_means_task_all") write.table(datatoprint, paste0(path,"printed_",filename,".txt",seq=""), sep=",",row.names=FALSE) barChart(datatoprint, analysisData$name, nbTechs = 3, ymin = 0, ymax = 20, mycolor = "dodgerblue2", "", "") ggsave(paste0(path,"plot_",filename,".pdf",seq=""), device = "pdf", width=4, height=2) # # Calculating differences of means # # CIs with adapted alpha value for multiple comparisons not needed here diffBA = bootstrapMeanCI_corr(data$Animation - data$SmallMultiples, 1) diffCA = bootstrapMeanCI_corr(data$OneMap - data$SmallMultiples, 1) diffCB = bootstrapMeanCI_corr(data$OneMap - data$Animation, 1) analysisData <- c() analysisData$name <- c("Gly-Ani","Gly-SMul","Ani-SMul") analysisData$pointEstimate <- c(diffCB[1], diffCA[1], diffBA[1]) analysisData$ci.max <- c(diffCB[3], diffCA[3], diffBA[3]) analysisData$ci.min <- c(diffCB[2], diffCA[2], diffBA[2]) analysisData$level <- c(diffCB[4], diffCA[4], diffBA[4]) analysisData$ci_corr.max <- c(diffCB[6], diffCA[6], diffBA[6]) analysisData$ci_corr.min <- c(diffCB[5], diffCA[5], diffBA[5]) datatoprint <- data.frame(factor(analysisData$name), analysisData$pointEstimate, analysisData$ci.max, analysisData$ci.min, analysisData$level, analysisData$ci_corr.max, analysisData$ci_corr.min) colnames(datatoprint) <- c("technique", "mean_time", "lowerBound_CI", "upperBound_CI", "corrected_CI", "lowerBound_CI_corr", "upperBound_CI_corr") #We use the name mean_time for the value of the mean even though it's not a time, it's just to parse the data for the plot path = paste("plots/") filename = paste("time_diffs_task_all") write.table(datatoprint, paste0(path,"printed_",filename,".txt",seq=""), sep=",",row.names=FALSE) barChart(datatoprint, analysisData$name, nbTechs = 3, ymin = 0, ymax = 10, mycolor = "dodgerblue2", "", "") #barChart_corr(datatoprint, analysisData$name, nbTechs = 3, ymin = -20, ymax = 10, mycolor = "dodgerblue2", "", "", ) ggsave(paste0(path,"plot_",filename,".pdf",seq=""),device = "pdf", width=4, height=2)