############################################# ### ### ### Advice Taking in Dyads - Exp. 3 ### ### ### ############################################# # 0. load libraries and data ---------------------------------------------- library(dplyr) library(ez) library(yarrr) library(lavaan) library(lsr) library(effsize) setwd(dirname(rstudioapi::getActiveDocumentContext()$path)) # your working directory goes here. # if you use RStudio, this line of code will set the wd to the path where you saved this # script. Otherwise you need to set it to the folder where you copied the data manually. long3 = read.csv('exp3.csv', header = T) # The data set contains the following variables: # VPNR: number coding the participating individual/dyad # jType: type of judge (1 = individual, 2 = dependend dyad, 3 = independent dyad) # m1_age: age of individual judge or first dyad member in years # m1_gender: gender of individual judge or first dyad member (1 = female, 2 = male, 3 = other) # m2_age: age of second dyad member in years # m2_gender: gender of second dyad member (1 = female, 2 = male, 3 = other) # trial: trial number indicating the judgment task # IE: initial estimate # FE: final estimate # AD: advice # IC: initial confidence (1 - not at all confident; 5 - very confident) # FC: final confidence (1 - not at all confident; 5 - very confident) # AT: advice taking (truncated at 0 and 1) # CS: confidence shift (FC - IC) # TV: true value # task: variable coding the type of judgment task (MM = original tasks used by Minson & # Mueller, new = new unbounded tasks with extreme errors) # 1. demographics --------------------------------------------------------- # 1.1 participant age ----------------------------------------------------- rbind(long3 %>% group_by(VPNR) %>% summarize(age = first(m1_age)), long3 %>% group_by(VPNR) %>% summarize(age = first(m2_age))) %>% summarize(M = round(mean(age, na.rm = T),2), SD = round(sd(age, na.rm = T),2)) # 1.2 participant gender -------------------------------------------------- # absolute numbers table((rbind(long3 %>% group_by(VPNR) %>% summarize(gender = first(m1_gender)), long3 %>% group_by(VPNR) %>% summarize(gender = first(m2_gender))))[,2]) # 4 participants chose not to indicate their gender # percent round(table((rbind(long3 %>% group_by(VPNR) %>% summarize(gender = first(m1_gender)), long3 %>% group_by(VPNR) %>% summarize(gender = first(m2_gender))))[,2])/ sum(table((rbind(long3 %>% group_by(VPNR) %>% summarize(gender = first(m1_gender)), long3 %>% group_by(VPNR) %>% summarize(gender = first(m2_gender))))[,2])),2)*100 # 2. preliminary analyses ------------------------------------------------- # 2.1 undefined and truncated AT scores, missing confidence ratings ------- # 2.1.1 undefined AT scores (IE equals AD) -------------------------------- sum(long3$IE == long3$AD) round(sum(long3$IE == long3$AD)/nrow(long3)*100,1) # AT was undefined in 121 trials (4.5 percent) # 2.1.2 truncated AT scores ----------------------------------------------- sum((long3$IE-long3$FE)/(long3$IE-long3$AD) < 0, na.rm = T) round(sum((long3$IE-long3$FE)/(long3$IE-long3$AD) < 0, na.rm = T)/nrow(long3)*100,1) # AT was truncated at 0 in 46 trials (1.7 percent) sum((long3$IE-long3$FE)/(long3$IE-long3$AD) > 1, na.rm = T) round(sum((long3$IE-long3$FE)/(long3$IE-long3$AD) > 1, na.rm = T)/nrow(long3)*100,1) # AT was truncated at 1 in 30 trials (1.1 percent) # 2.1.3 missing confidence ratings ---------------------------------------- # there were no confidence ratings missing in Experiment 3 due to the # forced entry format in the computerized experiment # 3. main analyses -------------------------------------------------------- # create aggregated data set for the ANOVA analyses aggData3 = data.frame(long3 %>% group_by(VPNR, task) %>% summarize(jType = first(jType), meanAT = mean(AT, na.rm = T), meanIC = mean(IC, na.rm = T), MAD = mean(abs(IE-TV), na.rm = T), mdAPE = median(abs(IE-TV)/TV, na.rm = T))) # turn judge type into a factor for ANOVA computation aggData3$jType = factor(aggData3$jType) # collapse across the two tasks for post hoc pairwise comparisons of judge type effects postHocData3 = aggData3 %>% group_by(VPNR) %>% summarize(jType = first(jType), meanAT = mean(meanAT), meanIC = mean(meanIC)) # 3.1 Analysis of AT scores ----------------------------------------------- # 3.1.1 ANOVA on mean AT scores ------------------------------------------- suppressWarnings(ezANOVA(data = aggData3, wid = VPNR, dv = meanAT, between = jType, within = task, type = 3)) # main effect of judge type and task, no interaction # descriptives for judge type main effect on mean AT scores postHocData3 %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # descriptives for task main effect on mean AT scores aggData3 %>% group_by(task) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.2 post-hoc pairwise comparisons ------------------------------------- # 3.1.2.1 individual judges vs. dependend dyad judges --------------------- with(subset(postHocData3, jType != 3), t.test(meanAT ~ jType)) with(subset(postHocData3, jType != 3), suppressWarnings(cohen.d(meanAT ~ jType))) # t(84.46) = 2.89, p = .004, d = 0.58 # descriptives for the pairwise comparison subset(postHocData3, jType != 3) %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.2.2 individual judges vs. independend dyad judges ------------------- with(subset(postHocData3, jType != 2), t.test(meanAT ~ jType)) with(subset(postHocData3, jType != 2), suppressWarnings(cohen.d(meanAT ~ jType))) # t(89.56) = 3.32, p = .001, d = 0.81 # descriptives for the pairwise comparison subset(postHocData3, jType != 2) %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.2.3 dependend dyad judges vs. independend dyad judges ------------------ with(subset(postHocData3, jType != 1), t.test(meanAT ~ jType)) with(subset(postHocData3, jType != 1), suppressWarnings(cohen.d(meanAT ~ jType))) # t(96.9) = 0.68, p = .500, d = 0.13 # descriptives for the pairwise comparison subset(postHocData3, jType != 1) %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3 separate ANOVAs by task type -------------------------------------- # 3.1.3.1 ANOVA of mean AT scores for the original tasks ------------------ suppressWarnings(ezANOVA(data = subset(aggData3, task == 'MM'), wid = VPNR, dv = meanAT, between = jType, type = 3)) # only a main effect of judge type (replication of the original results) # descriptives for the main effect of judge type on mean AT scores subset(aggData3, task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.2 post-hoc pairwise comparisons for the original tasks -------------- # 3.1.3.2.1 individual judges vs. dependend dyad judges --------------------- with(subset(aggData3, jType != 3 & task == 'MM'), t.test(meanAT ~ jType)) with(subset(aggData3, jType != 3 & task == 'MM'), suppressWarnings(cohen.d(meanAT ~ jType))) # t(92.42) = 2.67, p = .009, d = 0.53 # descriptives for the pairwise comparison subset(aggData3, jType != 3 & task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.2.2 individual judges vs. independend dyad judges ------------------- with(subset(aggData3, jType != 2 & task == 'MM'), t.test(meanAT ~ jType)) with(subset(aggData3, jType != 2 & task == 'MM'), suppressWarnings(cohen.d(meanAT ~ jType))) # t(96.10) = 2.26, p = .026, d = 0.49 # descriptives for the pairwise comparison subset(aggData3, jType != 2 & task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.2.3 dependend dyad judges vs. independend dyad judges ------------------ with(subset(aggData3, jType != 1 & task == 'MM'), t.test(meanAT ~ jType)) with(subset(aggData3, jType != 1 & task == 'MM'), suppressWarnings(cohen.d(meanAT ~ jType))) # t(96.86) = -0.34, p = .732, d = 0.07 # descriptives for the pairwise comparison subset(aggData3, jType != 1 & task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.3 ANOVA of mean AT scores for the new unbounded tasks ------------------ suppressWarnings(ezANOVA(data = subset(aggData3, task != 'MM'), wid = VPNR, dv = meanAT, between = jType, type = 3)) # main effect of judge type # descriptives for the main effect of judge type on mean AT scores subset(aggData3, task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.4 post-hoc pairwise comparisons for the new unbounded tasks --------- # 3.1.3.4.1 individual judges vs. dependend dyad judges --------------------- with(subset(aggData3, jType != 3 & task != 'MM'), t.test(meanAT ~ jType)) with(subset(aggData3, jType != 3 & task != 'MM'), suppressWarnings(cohen.d(meanAT ~ jType))) # t(91.15) = 2.25, p = .027, d = 0.45 # descriptives for the pairwise comparison subset(aggData3, jType != 3 & task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.4.2 individual judges vs. independend dyad judges ------------------- with(subset(aggData3, jType != 2 & task != 'MM'), t.test(meanAT ~ jType)) with(subset(aggData3, jType != 2 & task != 'MM'), suppressWarnings(cohen.d(meanAT ~ jType))) # t(89.42) = 3.35, p = .001, d = 0.81 # descriptives for the pairwise comparison subset(aggData3, jType != 2 & task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.1.3.4.3 dependend dyad judges vs. independend dyad judges ------------------ with(subset(aggData3, jType != 1 & task != 'MM'), t.test(meanAT ~ jType)) with(subset(aggData3, jType != 1 & task != 'MM'), suppressWarnings(cohen.d(meanAT ~ jType))) # t(97.85) = 1.27, p = .207, d = 0.26 # descriptives for the pairwise comparison subset(aggData3, jType != 1 & task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanAT),2), SD = round(sd(meanAT),2)) # 3.2 Analysis of initial confidence ----------------------------------------- # 3.2.1 ANOVA on mean IC ----------------------------------------------------- suppressWarnings(ezANOVA(data = aggData3, wid = VPNR, dv = meanIC, between = jType, within = task, type = 3)) # effect of judge type and task, no interaction # descriptives for judge type main effect on mean initial confidence postHocData3 %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # descriptives for task main effect on mean initial confidence aggData3 %>% group_by(task) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.2 post-hoc pairwise comparisons of mean IC -------------------------- # 3.2.2.1 individual judges vs. dependend dyad judges --------------------- with(subset(postHocData3, jType != 3), t.test(meanIC ~ jType)) with(subset(postHocData3, jType != 3), suppressWarnings(cohen.d(meanIC ~ jType))) # t(94.79) = -2.20, p = .030, d = 0.44 # descriptives for the pairwise comparison subset(postHocData3, jType != 3) %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.2.2 individual judges vs. independent dyad judges ------------------- with(subset(postHocData3, jType != 2), t.test(meanIC ~ jType)) with(subset(postHocData3, jType != 2), suppressWarnings(cohen.d(meanIC ~ jType))) # t(81.41) = -2.51, p = .014, d = 0.69 # descriptives for the pairwise comparison subset(postHocData3, jType != 2) %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.2.3 dependend dyad judges vs. independend dyad judges ------------------ with(subset(postHocData3, jType != 1), t.test(meanIC ~ jType)) with(subset(postHocData3, jType != 1), suppressWarnings(cohen.d(meanIC ~ jType))) # t(90.32) = -0.07, p = .941, d = 0.02 # descriptives for the pairwise comparison subset(postHocData3, jType != 1) %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.3 separate ANOVAs on mean IC by task type --------------------------- # 3.2.3.1 ANOVA of mean IC scores for the original tasks ------------------ suppressWarnings(ezANOVA(data = subset(aggData3, task == 'MM'), wid = VPNR, dv = meanIC, between = jType, type = 3)) # effect of judge type fails to reach significance # descriptives for the non-significant main effect of judge type on mean IC subset(aggData3, task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.3.2 ANOVA of mean IC scores for the new unbounded tasks ------------------ suppressWarnings(ezANOVA(data = subset(aggData3, task != 'MM'), wid = VPNR, dv = meanIC, between = jType, type = 3)) # significant main effect of judge type # descriptives for the main effect of judge type on mean IC subset(aggData3, task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.3.3 post-hoc pairwise comparisons for the new unbounded tasks --------- # 3.2.3.3.1 individual judges vs. dependend dyad judges --------------------- with(subset(aggData3, jType != 3 & task != 'MM'), t.test(meanIC ~ jType)) with(subset(aggData3, jType != 3 & task != 'MM'), suppressWarnings(cohen.d(meanIC ~ jType))) # t(94.87) = -2.07, p = .041, d = 0.41 # descriptives for the pairwise comparison subset(aggData3, jType != 3 & task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.3.3.2 individual judges vs. independend dyad judges ------------------- with(subset(aggData3, jType != 2 & task != 'MM'), t.test(meanIC ~ jType)) with(subset(aggData3, jType != 2 & task != 'MM'), suppressWarnings(cohen.d(meanIC ~ jType))) # t(87.73) = -2.80, p = .006, d = 0.70 # descriptives for the pairwise comparison subset(aggData3, jType != 2 & task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.2.3.3.3 dependend dyad judges vs. independend dyad judges ------------------ with(subset(aggData3, jType != 1 & task != 'MM'), t.test(meanIC ~ jType)) with(subset(aggData3, jType != 1 & task != 'MM'), suppressWarnings(cohen.d(meanIC ~ jType))) # t(95.21) = -0.67, p = .506, d = 0.15 # descriptives for the pairwise comparison subset(aggData3, jType != 1 & task != 'MM') %>% group_by(jType) %>% summarize(M = round(mean(meanIC),2), SD = round(sd(meanIC),2)) # 3.3 mediation analysis -------------------------------------------------- lavData3 = data.frame(long3 %>% group_by(VPNR) %>% summarize(jType = first(jType), meanAT = mean(AT, na.rm = T), meanIC = mean(IC, na.rm = T))) # create dummy variable indicating whether judge is an individual or dyad lavData3$jDummy[lavData3$jType == 1] = 0 lavData3$jDummy[lavData3$jType != 1] = 1 medModel = ' # regressions # outcome model meanAT ~ cPrime*jDummy + b*meanIC # mediator models meanIC ~ a*jDummy # indirect effect (IDE) IDE := a*b # total effect total := cPrime + a*b ' fit = sem(medModel, data = lavData3b) parameterEstimates(fit) # indirect effect is in the predicted direction but fails to reach statistical significance # 3.4 analysis of initial accuracy ----------------------------------------- # since the error measures of the original and the new tasks differs (because of # differences in the scales: bounded percent estimates vs. unbounded estimates), # comparison across tasks requires z-standardization within task type aggData3$zError = NA aggData3$zError[aggData3$task == 'MM'] = scale(aggData3$MAD[aggData3$task == 'MM']) aggData3$zError[aggData3$task == 'new'] = scale(aggData3$mdAPE[aggData3$task == 'new']) # remove extreme estimates in the new tasks aggData3$mdAPE_reduced = aggData3$mdAPE aggData3$mdAPE_reduced[aggData3$zError > 3] = NA aggData3$zError_red = NA aggData3$zError_red[aggData3$task == 'MM2012'] = scale(aggData3$MAD[aggData3$task == 'MM2012']) aggData3$zError_red[aggData3$task == 'new_biased'] = scale(aggData3$mdAPE_reduced[aggData3$task == 'new_biased']) aggData3$zError_red[aggData3$task == 'new_unbiased'] = scale(aggData3$mdAPE_reduced[aggData3$task == 'new_unbiased']) # 3.4.1 ANOVA of the full design on z-standardized errors ----------------- suppressWarnings(ezANOVA(data = aggData3, wid = VPNR, dv = zError, between = jType, within = task, type = 3)) # main effect of judge type, qualified by an interaction of judge type and task type # 3.4.2 separate ANOVAs on initial accuracy (zError) by task type ------------- # 3.4.2.1 ANOVA of mean initial accuracy for the original tasks --------------- suppressWarnings(ezANOVA(data = subset(aggData3, task == 'MM'), wid = VPNR, dv = zError, between = jType, type = 3)) # significant effect of judge type # descriptives for the main effect of judge type on mean AT scores subset(aggData3, task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(zError),3), SD = round(sd(zError),2)) # descriptives in terms of MAD subset(aggData3, task == 'MM') %>% group_by(jType) %>% summarize(M = round(mean(MAD),2), SD = round(sd(MAD),2)) # 3.4.2.2 pairwise comparisons of initial accuracy for the original tasks -------- # 3.4.2.2.1 individual judges vs. dependend dyad judges --------------------- with(subset(aggData3, jType != 3 & task == 'MM'), t.test(zError ~ jType)) with(subset(aggData3, jType != 3 & task == 'MM'), suppressWarnings(cohen.d(zError ~ jType))) # t(97.98) = 2.29, p = .024, d = 0.46 # 3.4.2.2.2 individual judges vs. independend dyad judges ------------------- with(subset(aggData3, jType != 2 & task == 'MM'), t.test(zError ~ jType)) with(subset(aggData3, jType != 2 & task == 'MM'), suppressWarnings(cohen.d(zError ~ jType))) # t(91.01) = 4.69, p < .001, d = 1.11 # 3.4.2.2.3 dependend dyad judges vs. independend dyad judges --------------- with(subset(aggData3, jType != 1 & task == 'MM'), t.test(zError ~ jType)) with(subset(aggData3, jType != 1 & task == 'MM'), suppressWarnings(cohen.d(zError ~ jType))) # t(90.45) = 2.07, p = .041, d = 0.50 # 3.4.2.3 ANOVA of mean initial accuracy for the new unbounded tasks ----- suppressWarnings(ezANOVA(data = subset(aggData3, task == 'new'), wid = VPNR, dv = zError, between = jType, type = 3)) # no effect of judge type (due to extreme variance) # descriptives for the main effect of judge type on mean AT scores subset(aggData3, task == 'new') %>% group_by(jType) %>% summarize(M = round(mean(zError),2), SD = round(sd(zError),2)) # descriptives in terms of mdAPE subset(aggData3, task == 'new') %>% group_by(jType) %>% summarize(M = round(mean(mdAPE),2), SD = round(sd(mdAPE),2)) # 4. plots ---------------------------------------------------------------- plotExp3 = function(){ myPalette = c('#777777', '#EEEEEE', '#000000') layout(t(matrix(c(1,2,3,3), nrow = 2)), heights = c(5,1)) par(mar = c(2.5,3,1,1)) pirateplot(meanAT ~ jType*task, data = aggData3, theme = 3, ylim = c(0,1), pal = myPalette, inf.method = "ci", ylab = '', bean.lwd = 0.75, xaxt = 'n', yaxt = 'n', bty = 'n', gl.col = 'white', bean.f.o = .50) axis(2, tck = -.015, at = seq(0,1,.2), labels = NA) axis(2, lwd = 0, at = seq(0,1,.2), cex.axis = .7, line = -.6) mtext('mean AT score', 2, line = 1.5, cex = 1) lines(x = c(0,16), y = c(0,0)) axis(1, lwd = 0, at = c(2, 6), labels = c('original', 'new unbounded'), cex.axis = 1.15, line = -.8) mtext('task type', 1, line = 1.75, cex = 1) pirateplot(zError ~ jType*task, data = aggData3, theme = 3, ylim = c(-3,3), pal = myPalette, inf.method = "ci", ylab = '', bean.lwd = 0.75, xaxt = 'n', yaxt = 'n', bty = 'n', bean.f.o = .50, cut.min = -3, cut.max = 3, cap.beans = F, gl = 0, gl.col = 'black') axis(2, tck = -.015, at = seq(-3,5,1), labels = NA) axis(2, lwd = 0, at = seq(-3,5,1), cex.axis = .7, line = -.6) mtext('initial accuracy (z-standardized)', 2, line = 1.5, cex = 1) axis(1, lwd = 0, at = c(2, 6), labels = c('original', 'new unbounded'), cex.axis = 1.15, line = -.8) mtext('task type', 1, line = 1.75, cex = 1) par(mar = c(0,0,0,0)) plot(1,1, xlim = c(0,10), ylim = c(0,10), axes = F, col = 'white') legend('center', legend = c('individual', 'dependent dyad', 'independent dyad'), pch = 22, pt.bg = alpha(c(myPalette[1:3]), .50), bty = 'n', cex = 1, pt.cex = 3, ncol = 3) } png('AT_and_Acc_Exp3.png', height = 3, width = 6, unit = 'in', res = 600) plotExp3() dev.off()