# stimulus_schedule = readxl::read_xlsx("/Users/robertoabreu/Documents/indiana/ams_task_data_082123/ams_task/imagePlaceList_5y_ram.xlsx")
# a = a %>%f
# left_join(stimulus_schedule, by = "image")
#a = read.csv("/Volumes/gunderson_lab/projects/manynumbers/data/mn_amstask/lf_mn_ams_task_2023-09-12_9pm.csv")
a = read.csv("2024_ucd_pilot/csv_files/processed_data/ams/lf_files/lf_mn_ams_2024-07-08.csv")
a$participant = paste("ucd", a$participant, sep="")
b = read.csv("2024_lafayette_pilot/csv_files/processed_data/ams/lf_files/lf_mn_ams_2024-04-17.csv")
c = read.csv("2024_iu_pilot/csv_files/processed_data/ams/lf_files/lf_mn_ams_2024-05-17.csv")
a = rbind(a,b,c)
a$participant = as.factor(as.character(a$participant))
#incomplete = c("020624LB","020624LG")
#a = a[which(a$participant %!in% incomplete),]
#View(table(a$participant))
Path: Main/Studies/2023_manynumbers/2024_iu_pilot/scripts/mn_amstask_analyses_all_072524.Rmd
df_acc=a
# df_acc$participant = paste(df_acc$participant, df_acc$date, df_acc$age, sep = "_")
# df_acc$participant = as.factor(as.character(df_acc$participant))
df_antcipatory=subset(df_acc, rt <= .25)
# unique(df_antcipatory$participant) #checks that all participants are included
kable(table(df_antcipatory$participant), table.attr = "style = \"color: white;\"")
| Var1 | Freq |
|---|---|
| 36 | 0 |
| 37 | 0 |
| 38 | 0 |
| 39 | 0 |
| 40 | 0 |
| 41 | 0 |
| 42 | 0 |
| 43 | 0 |
| 44 | 0 |
| 45 | 0 |
| 46 | 0 |
| 47 | 0 |
| 48 | 0 |
| 49 | 0 |
| 50 | 0 |
| 51 | 0 |
| 53 | 0 |
| 54 | 0 |
| 55 | 0 |
| 56 | 0 |
| 57 | 0 |
| 59 | 0 |
| 60 | 0 |
| 61 | 0 |
| mn001 | 0 |
| mn002 | 0 |
| mn003 | 0 |
| mn004 | 0 |
| mn005 | 0 |
| mn006 | 0 |
| mn007 | 0 |
| mn008 | 0 |
| mn009 | 0 |
| mn010 | 0 |
| mn011 | 0 |
| mn012 | 0 |
| mn013 | 0 |
| mn014 | 0 |
| mn015 | 0 |
| mn017 | 0 |
| mn018 | 0 |
| mn019 | 0 |
| mn020 | 0 |
| mn022 | 0 |
| ucd1 | 0 |
| ucd10 | 0 |
| ucd12 | 0 |
| ucd13 | 0 |
| ucd15 | 0 |
| ucd16 | 0 |
| ucd17 | 0 |
| ucd18 | 0 |
| ucd19 | 0 |
| ucd2 | 0 |
| ucd22 | 0 |
| ucd25 | 0 |
| ucd26 | 0 |
| ucd27 | 0 |
| ucd28 | 0 |
| ucd3 | 0 |
| ucd31 | 0 |
| ucd32 | 0 |
| ucd33 | 0 |
| ucd34 | 0 |
| ucd35 | 0 |
| ucd36 | 0 |
| ucd37 | 0 |
| ucd38 | 2 |
| ucd39 | 0 |
| ucd4 | 0 |
| ucd40 | 0 |
| ucd41 | 0 |
| ucd42 | 0 |
| ucd43 | 0 |
| ucd44 | 0 |
| ucd45 | 0 |
| ucd46 | 1 |
| ucd47 | 0 |
| ucd48 | 0 |
| ucd49 | 0 |
| ucd5 | 0 |
| ucd50 | 0 |
| ucd52 | 0 |
| ucd53 | 0 |
| ucd54 | 0 |
| ucd55 | 0 |
| ucd56 | 0 |
| ucd6 | 0 |
| ucd7 | 0 |
| ucd9 | 0 |
#table(dataset2$participant, dataset2$Block)
#check for missing values
length(which(is.na(df_acc$rt)))
## [1] 0
#Recodes missing trials (NA) to 99
df_acc$rt[is.na(df_acc$rt)] <- 99
#
na_trials=subset(df_acc, rt == 99)
#Select trials that had rt longer than 0.25 sec
#df_acc=subset(df_acc, rt > .25)
#Recodes missing trials from 99 to NA
df_acc["rt"]=replace(df_acc$rt, df_acc$rt==99, NA)
#Subset only valid (nonNA) trials
df_acc_na<-subset(df_acc, (!is.na(df_acc[,"rt"])))
#Calculate means and standard deviations by participants
summary_participant <- summarySE(df_acc_na, measurevar="rt", groupvars=c("participant"))
#Calculate upper(+3SD) lower (-3SD) thresholds
summary_participant["sd3_sup"]=summary_participant$rt+summary_participant$sd*3
summary_participant["sd3_inf"]=summary_participant$rt-summary_participant$sd*3
kable(summary_participant,table.attr = "style = \"color: white;\"")
| participant | N | rt | sd | se | ci | sd3_sup | sd3_inf |
|---|---|---|---|---|---|---|---|
| 36 | 60 | 4.039 | 3.2424 | 0.4186 | 0.8376 | 13.766 | -5.6880 |
| 37 | 54 | 5.555 | 2.7179 | 0.3699 | 0.7418 | 13.708 | -2.5990 |
| 38 | 54 | 3.620 | 1.4395 | 0.1959 | 0.3929 | 7.939 | -0.6982 |
| 39 | 54 | 2.943 | 0.8065 | 0.1098 | 0.2201 | 5.363 | 0.5236 |
| 40 | 42 | 6.614 | 5.5200 | 0.8518 | 1.7202 | 23.174 | -9.9455 |
| 41 | 54 | 9.696 | 7.1394 | 0.9715 | 1.9487 | 31.114 | -11.7221 |
| 42 | 54 | 4.606 | 1.9955 | 0.2716 | 0.5447 | 10.593 | -1.3804 |
| 43 | 54 | 2.821 | 1.0816 | 0.1472 | 0.2952 | 6.066 | -0.4241 |
| 44 | 54 | 3.682 | 2.0963 | 0.2853 | 0.5722 | 9.971 | -2.6073 |
| 45 | 60 | 2.900 | 2.4016 | 0.3100 | 0.6204 | 10.104 | -4.3051 |
| 46 | 54 | 4.840 | 3.1033 | 0.4223 | 0.8470 | 14.150 | -4.4697 |
| 47 | 54 | 2.450 | 1.5775 | 0.2147 | 0.4306 | 7.182 | -2.2824 |
| 48 | 54 | 7.210 | 2.2847 | 0.3109 | 0.6236 | 14.064 | 0.3558 |
| 49 | 54 | 3.479 | 4.1156 | 0.5601 | 1.1233 | 15.826 | -8.8679 |
| 50 | 60 | 3.753 | 2.4262 | 0.3132 | 0.6268 | 11.032 | -3.5255 |
| 51 | 54 | 3.807 | 2.2750 | 0.3096 | 0.6210 | 10.632 | -3.0183 |
| 53 | 54 | 3.541 | 2.1515 | 0.2928 | 0.5872 | 9.996 | -2.9130 |
| 54 | 54 | 2.987 | 2.3884 | 0.3250 | 0.6519 | 10.152 | -4.1782 |
| 55 | 54 | 2.911 | 1.0707 | 0.1457 | 0.2922 | 6.123 | -0.3008 |
| 56 | 60 | 9.156 | 5.8324 | 0.7530 | 1.5067 | 26.653 | -8.3414 |
| 57 | 54 | 4.161 | 1.6321 | 0.2221 | 0.4455 | 9.057 | -0.7353 |
| 59 | 54 | 3.898 | 2.4110 | 0.3281 | 0.6581 | 11.131 | -3.3351 |
| 60 | 54 | 3.398 | 0.9006 | 0.1225 | 0.2458 | 6.100 | 0.6966 |
| 61 | 54 | 4.877 | 5.1208 | 0.6969 | 1.3977 | 20.239 | -10.4859 |
| mn001 | 54 | 3.988 | 1.0858 | 0.1478 | 0.2964 | 7.245 | 0.7301 |
| mn002 | 54 | 3.469 | 0.8974 | 0.1221 | 0.2449 | 6.161 | 0.7770 |
| mn003 | 54 | 3.316 | 0.8633 | 0.1175 | 0.2356 | 5.906 | 0.7263 |
| mn004 | 54 | 3.130 | 1.7554 | 0.2389 | 0.4791 | 8.396 | -2.1359 |
| mn005 | 54 | 4.008 | 2.4306 | 0.3308 | 0.6634 | 11.300 | -3.2841 |
| mn006 | 60 | 3.259 | 1.6742 | 0.2161 | 0.4325 | 8.282 | -1.7634 |
| mn007 | 60 | 4.629 | 5.1674 | 0.6671 | 1.3349 | 20.131 | -10.8729 |
| mn008 | 54 | 3.947 | 2.0169 | 0.2745 | 0.5505 | 9.998 | -2.1039 |
| mn009 | 54 | 4.250 | 2.3682 | 0.3223 | 0.6464 | 11.354 | -2.8549 |
| mn010 | 54 | 2.598 | 1.3983 | 0.1903 | 0.3817 | 6.793 | -1.5970 |
| mn011 | 54 | 2.699 | 1.4024 | 0.1908 | 0.3828 | 6.906 | -1.5080 |
| mn012 | 21 | 4.487 | 2.6577 | 0.5800 | 1.2098 | 12.460 | -3.4862 |
| mn013 | 54 | 5.068 | 4.6588 | 0.6340 | 1.2716 | 19.044 | -8.9083 |
| mn014 | 60 | 6.815 | 8.0413 | 1.0381 | 2.0773 | 30.939 | -17.3085 |
| mn015 | 54 | 3.617 | 1.0894 | 0.1483 | 0.2974 | 6.885 | 0.3487 |
| mn017 | 60 | 4.732 | 3.6043 | 0.4653 | 0.9311 | 15.545 | -6.0812 |
| mn018 | 54 | 4.136 | 1.8123 | 0.2466 | 0.4947 | 9.573 | -1.3009 |
| mn019 | 60 | 3.775 | 3.8433 | 0.4962 | 0.9928 | 15.305 | -7.7551 |
| mn020 | 60 | 3.899 | 3.7828 | 0.4884 | 0.9772 | 15.247 | -7.4497 |
| mn022 | 54 | 2.007 | 1.2005 | 0.1634 | 0.3277 | 5.609 | -1.5941 |
| ucd1 | 60 | 5.247 | 5.6619 | 0.7309 | 1.4626 | 22.232 | -11.7390 |
| ucd10 | 54 | 3.202 | 1.1679 | 0.1589 | 0.3188 | 6.705 | -0.3020 |
| ucd12 | 54 | 3.085 | 1.4231 | 0.1937 | 0.3884 | 7.354 | -1.1845 |
| ucd13 | 54 | 2.341 | 1.1121 | 0.1513 | 0.3035 | 5.678 | -0.9947 |
| ucd15 | 54 | 2.556 | 1.4481 | 0.1971 | 0.3953 | 6.900 | -1.7888 |
| ucd16 | 54 | 4.500 | 3.8298 | 0.5212 | 1.0453 | 15.989 | -6.9896 |
| ucd17 | 60 | 3.380 | 2.1161 | 0.2732 | 0.5466 | 9.729 | -2.9679 |
| ucd18 | 54 | 4.892 | 4.2891 | 0.5837 | 1.1707 | 17.759 | -7.9758 |
| ucd19 | 54 | 3.399 | 1.9435 | 0.2645 | 0.5305 | 9.230 | -2.4313 |
| ucd2 | 54 | 2.178 | 0.8275 | 0.1126 | 0.2259 | 4.660 | -0.3046 |
| ucd22 | 54 | 3.304 | 2.0108 | 0.2736 | 0.5488 | 9.336 | -2.7286 |
| ucd25 | 54 | 2.774 | 1.0185 | 0.1386 | 0.2780 | 5.830 | -0.2811 |
| ucd26 | 54 | 3.470 | 1.4278 | 0.1943 | 0.3897 | 7.753 | -0.8138 |
| ucd27 | 54 | 4.485 | 1.7072 | 0.2323 | 0.4660 | 9.607 | -0.6365 |
| ucd28 | 54 | 1.880 | 1.4089 | 0.1917 | 0.3845 | 6.106 | -2.3469 |
| ucd3 | 54 | 3.554 | 1.8304 | 0.2491 | 0.4996 | 9.045 | -1.9370 |
| ucd31 | 54 | 5.141 | 2.8923 | 0.3936 | 0.7894 | 13.818 | -3.5353 |
| ucd32 | 54 | 3.117 | 1.9648 | 0.2674 | 0.5363 | 9.011 | -2.7778 |
| ucd33 | 54 | 4.529 | 4.2353 | 0.5764 | 1.1560 | 17.235 | -8.1768 |
| ucd34 | 54 | 4.181 | 1.9274 | 0.2623 | 0.5261 | 9.963 | -1.6012 |
| ucd35 | 54 | 2.541 | 2.0064 | 0.2730 | 0.5476 | 8.560 | -3.4781 |
| ucd36 | 54 | 2.881 | 1.2715 | 0.1730 | 0.3471 | 6.695 | -0.9339 |
| ucd37 | 54 | 3.060 | 1.8170 | 0.2473 | 0.4960 | 8.511 | -2.3915 |
| ucd38 | 54 | 4.152 | 3.2810 | 0.4465 | 0.8955 | 13.995 | -5.6911 |
| ucd39 | 54 | 3.782 | 1.3574 | 0.1847 | 0.3705 | 7.854 | -0.2904 |
| ucd4 | 54 | 3.712 | 2.4195 | 0.3292 | 0.6604 | 10.971 | -3.5463 |
| ucd40 | 54 | 2.736 | 1.1943 | 0.1625 | 0.3260 | 6.319 | -0.8466 |
| ucd41 | 54 | 2.763 | 1.4532 | 0.1978 | 0.3967 | 7.122 | -1.5970 |
| ucd42 | 54 | 2.461 | 1.5777 | 0.2147 | 0.4306 | 7.194 | -2.2716 |
| ucd43 | 54 | 3.079 | 1.4928 | 0.2031 | 0.4075 | 7.557 | -1.3996 |
| ucd44 | 54 | 2.966 | 1.2830 | 0.1746 | 0.3502 | 6.815 | -0.8830 |
| ucd45 | 54 | 3.112 | 2.2976 | 0.3127 | 0.6271 | 10.005 | -3.7806 |
| ucd46 | 54 | 1.912 | 1.8757 | 0.2552 | 0.5120 | 7.539 | -3.7150 |
| ucd47 | 54 | 3.895 | 2.7919 | 0.3799 | 0.7621 | 12.271 | -4.4808 |
| ucd48 | 54 | 2.192 | 1.1465 | 0.1560 | 0.3129 | 5.631 | -1.2477 |
| ucd49 | 54 | 2.274 | 1.2146 | 0.1653 | 0.3315 | 5.918 | -1.3695 |
| ucd5 | 54 | 2.219 | 0.9241 | 0.1257 | 0.2522 | 4.991 | -0.5530 |
| ucd50 | 54 | 3.092 | 1.2568 | 0.1710 | 0.3430 | 6.863 | -0.6782 |
| ucd52 | 54 | 3.048 | 2.3615 | 0.3214 | 0.6446 | 10.133 | -4.0361 |
| ucd53 | 54 | 2.597 | 1.4646 | 0.1993 | 0.3998 | 6.991 | -1.7969 |
| ucd54 | 54 | 3.062 | 2.0072 | 0.2731 | 0.5478 | 9.084 | -2.9593 |
| ucd55 | 54 | 2.624 | 1.6737 | 0.2278 | 0.4568 | 7.645 | -2.3968 |
| ucd56 | 54 | 3.460 | 2.3735 | 0.3230 | 0.6478 | 10.580 | -3.6606 |
| ucd6 | 54 | 4.690 | 4.0743 | 0.5544 | 1.1121 | 16.913 | -7.5332 |
| ucd7 | 54 | 3.140 | 1.5168 | 0.2064 | 0.4140 | 7.690 | -1.4106 |
| ucd9 | 54 | 3.543 | 1.0636 | 0.1447 | 0.2903 | 6.734 | 0.3523 |
#
df_acc["rt_2"]=df_acc["rt"]
#Recodes missing trials from 99 to NA
df_acc$rt[is.na(df_acc$rt)] <- 99
#Replace values +-3SD for NAs
for(i in 1:nrow(df_acc)){
dummy=match(df_acc$participant[i], summary_participant$participant)
if(df_acc[i,"rt"] > summary_participant[dummy,"sd3_sup"]){
df_acc[i,"rt"] = NA
} else {
df_acc[i,"rt"] = df_acc[i,"rt"]
}
}
#| df_acc[i,"rt"] < summary_participant[dummy,"sd2_inf"] #to exclude lower limit
#Excludes outliers from RT
df_acc_noout=df_acc
df_acc_noout=df_acc[-which(is.na(df_acc[,"rt"] & df_acc[,"choice"]!="")),]
kable(table(df_acc_noout$participant), table.attr = "style = \"color: white;\"")
| Var1 | Freq |
|---|---|
| 36 | 58 |
| 37 | 53 |
| 38 | 52 |
| 39 | 54 |
| 40 | 41 |
| 41 | 52 |
| 42 | 54 |
| 43 | 51 |
| 44 | 53 |
| 45 | 59 |
| 46 | 52 |
| 47 | 52 |
| 48 | 53 |
| 49 | 52 |
| 50 | 59 |
| 51 | 53 |
| 53 | 52 |
| 54 | 53 |
| 55 | 53 |
| 56 | 58 |
| 57 | 52 |
| 59 | 53 |
| 60 | 53 |
| 61 | 53 |
| mn001 | 52 |
| mn002 | 54 |
| mn003 | 53 |
| mn004 | 53 |
| mn005 | 52 |
| mn006 | 59 |
| mn007 | 59 |
| mn008 | 53 |
| mn009 | 53 |
| mn010 | 52 |
| mn011 | 52 |
| mn012 | 20 |
| mn013 | 52 |
| mn014 | 58 |
| mn015 | 53 |
| mn017 | 59 |
| mn018 | 53 |
| mn019 | 59 |
| mn020 | 58 |
| mn022 | 52 |
| ucd1 | 58 |
| ucd10 | 53 |
| ucd12 | 53 |
| ucd13 | 53 |
| ucd15 | 52 |
| ucd16 | 53 |
| ucd17 | 58 |
| ucd18 | 54 |
| ucd19 | 54 |
| ucd2 | 53 |
| ucd22 | 52 |
| ucd25 | 53 |
| ucd26 | 54 |
| ucd27 | 53 |
| ucd28 | 53 |
| ucd3 | 52 |
| ucd31 | 54 |
| ucd32 | 54 |
| ucd33 | 52 |
| ucd34 | 53 |
| ucd35 | 53 |
| ucd36 | 53 |
| ucd37 | 54 |
| ucd38 | 53 |
| ucd39 | 52 |
| ucd4 | 53 |
| ucd40 | 52 |
| ucd41 | 53 |
| ucd42 | 52 |
| ucd43 | 53 |
| ucd44 | 54 |
| ucd45 | 53 |
| ucd46 | 52 |
| ucd47 | 53 |
| ucd48 | 52 |
| ucd49 | 53 |
| ucd5 | 53 |
| ucd50 | 54 |
| ucd52 | 53 |
| ucd53 | 53 |
| ucd54 | 53 |
| ucd55 | 53 |
| ucd56 | 53 |
| ucd6 | 52 |
| ucd7 | 53 |
| ucd9 | 53 |
#trials by participant
too_slow_trials=subset(df_acc, is.na(df_acc$rt) & df_acc$choice!="")
correct_trials=subset(df_acc, df_acc$accuracy==1 & !is.na(df_acc$rt))
incorrect_trials=subset(df_acc, df_acc$accuracy==0 & !is.na(df_acc$rt) )
trials=as.data.frame(cbind(table(na_trials$participant),table(df_antcipatory$participant),table(too_slow_trials$participant),table(correct_trials$participant),table(incorrect_trials$participant)))
trials["total"]= rowSums(trials[c(1,3,4,5)])
trials["valid_trials"]=trials$V1+trials$V4+trials$V5
names(trials)=c("missed","anticipatory","too_slow","valid_correct","valid_incorrect",
"total","valid_total")
kable(trials, table.attr = "style = \"color: white;\"")
| missed | anticipatory | too_slow | valid_correct | valid_incorrect | total | valid_total | |
|---|---|---|---|---|---|---|---|
| 36 | 0 | 0 | 2 | 30 | 28 | 60 | 58 |
| 37 | 0 | 0 | 1 | 25 | 28 | 54 | 53 |
| 38 | 0 | 0 | 2 | 31 | 21 | 54 | 52 |
| 39 | 0 | 0 | 0 | 38 | 16 | 54 | 54 |
| 40 | 0 | 0 | 1 | 22 | 19 | 42 | 41 |
| 41 | 0 | 0 | 2 | 32 | 20 | 54 | 52 |
| 42 | 0 | 0 | 0 | 39 | 15 | 54 | 54 |
| 43 | 0 | 0 | 3 | 34 | 17 | 54 | 51 |
| 44 | 0 | 0 | 1 | 39 | 14 | 54 | 53 |
| 45 | 0 | 0 | 1 | 33 | 26 | 60 | 59 |
| 46 | 0 | 0 | 2 | 39 | 13 | 54 | 52 |
| 47 | 0 | 0 | 2 | 30 | 22 | 54 | 52 |
| 48 | 0 | 0 | 1 | 25 | 28 | 54 | 53 |
| 49 | 0 | 0 | 2 | 21 | 31 | 54 | 52 |
| 50 | 0 | 0 | 1 | 26 | 33 | 60 | 59 |
| 51 | 0 | 0 | 1 | 33 | 20 | 54 | 53 |
| 53 | 0 | 0 | 2 | 38 | 14 | 54 | 52 |
| 54 | 0 | 0 | 1 | 31 | 22 | 54 | 53 |
| 55 | 0 | 0 | 1 | 40 | 13 | 54 | 53 |
| 56 | 0 | 0 | 2 | 29 | 29 | 60 | 58 |
| 57 | 0 | 0 | 2 | 41 | 11 | 54 | 52 |
| 59 | 0 | 0 | 1 | 33 | 20 | 54 | 53 |
| 60 | 0 | 0 | 1 | 44 | 9 | 54 | 53 |
| 61 | 0 | 0 | 1 | 45 | 8 | 54 | 53 |
| mn001 | 0 | 0 | 2 | 36 | 16 | 54 | 52 |
| mn002 | 0 | 0 | 0 | 47 | 7 | 54 | 54 |
| mn003 | 0 | 0 | 1 | 41 | 12 | 54 | 53 |
| mn004 | 0 | 0 | 1 | 47 | 6 | 54 | 53 |
| mn005 | 0 | 0 | 2 | 42 | 10 | 54 | 52 |
| mn006 | 0 | 0 | 1 | 22 | 37 | 60 | 59 |
| mn007 | 0 | 0 | 1 | 21 | 38 | 60 | 59 |
| mn008 | 0 | 0 | 1 | 41 | 12 | 54 | 53 |
| mn009 | 0 | 0 | 1 | 25 | 28 | 54 | 53 |
| mn010 | 0 | 0 | 2 | 36 | 16 | 54 | 52 |
| mn011 | 0 | 0 | 2 | 26 | 26 | 54 | 52 |
| mn012 | 0 | 0 | 1 | 14 | 6 | 21 | 20 |
| mn013 | 0 | 0 | 2 | 29 | 23 | 54 | 52 |
| mn014 | 0 | 0 | 2 | 25 | 33 | 60 | 58 |
| mn015 | 0 | 0 | 1 | 24 | 29 | 54 | 53 |
| mn017 | 0 | 0 | 1 | 24 | 35 | 60 | 59 |
| mn018 | 0 | 0 | 1 | 30 | 23 | 54 | 53 |
| mn019 | 0 | 0 | 1 | 30 | 29 | 60 | 59 |
| mn020 | 0 | 0 | 2 | 24 | 34 | 60 | 58 |
| mn022 | 0 | 0 | 2 | 27 | 25 | 54 | 52 |
| ucd1 | 0 | 0 | 2 | 33 | 25 | 60 | 58 |
| ucd10 | 0 | 0 | 1 | 22 | 31 | 54 | 53 |
| ucd12 | 0 | 0 | 1 | 30 | 23 | 54 | 53 |
| ucd13 | 0 | 0 | 1 | 38 | 15 | 54 | 53 |
| ucd15 | 0 | 0 | 2 | 35 | 17 | 54 | 52 |
| ucd16 | 0 | 0 | 1 | 40 | 13 | 54 | 53 |
| ucd17 | 0 | 0 | 2 | 31 | 27 | 60 | 58 |
| ucd18 | 0 | 0 | 0 | 26 | 28 | 54 | 54 |
| ucd19 | 0 | 0 | 0 | 27 | 27 | 54 | 54 |
| ucd2 | 0 | 0 | 1 | 39 | 14 | 54 | 53 |
| ucd22 | 0 | 0 | 2 | 40 | 12 | 54 | 52 |
| ucd25 | 0 | 0 | 1 | 29 | 24 | 54 | 53 |
| ucd26 | 0 | 0 | 0 | 29 | 25 | 54 | 54 |
| ucd27 | 0 | 0 | 1 | 29 | 24 | 54 | 53 |
| ucd28 | 0 | 0 | 1 | 39 | 14 | 54 | 53 |
| ucd3 | 0 | 0 | 2 | 29 | 23 | 54 | 52 |
| ucd31 | 0 | 0 | 0 | 34 | 20 | 54 | 54 |
| ucd32 | 0 | 0 | 0 | 36 | 18 | 54 | 54 |
| ucd33 | 0 | 0 | 2 | 37 | 15 | 54 | 52 |
| ucd34 | 0 | 0 | 1 | 44 | 9 | 54 | 53 |
| ucd35 | 0 | 0 | 1 | 24 | 29 | 54 | 53 |
| ucd36 | 0 | 0 | 1 | 24 | 29 | 54 | 53 |
| ucd37 | 0 | 0 | 0 | 32 | 22 | 54 | 54 |
| ucd38 | 0 | 2 | 1 | 32 | 21 | 54 | 53 |
| ucd39 | 0 | 0 | 2 | 37 | 15 | 54 | 52 |
| ucd4 | 0 | 0 | 1 | 41 | 12 | 54 | 53 |
| ucd40 | 0 | 0 | 2 | 33 | 19 | 54 | 52 |
| ucd41 | 0 | 0 | 1 | 25 | 28 | 54 | 53 |
| ucd42 | 0 | 0 | 2 | 28 | 24 | 54 | 52 |
| ucd43 | 0 | 0 | 1 | 32 | 21 | 54 | 53 |
| ucd44 | 0 | 0 | 0 | 27 | 27 | 54 | 54 |
| ucd45 | 0 | 0 | 1 | 30 | 23 | 54 | 53 |
| ucd46 | 0 | 1 | 2 | 32 | 20 | 54 | 52 |
| ucd47 | 0 | 0 | 1 | 43 | 10 | 54 | 53 |
| ucd48 | 0 | 0 | 2 | 33 | 19 | 54 | 52 |
| ucd49 | 0 | 0 | 1 | 35 | 18 | 54 | 53 |
| ucd5 | 0 | 0 | 1 | 25 | 28 | 54 | 53 |
| ucd50 | 0 | 0 | 0 | 29 | 25 | 54 | 54 |
| ucd52 | 0 | 0 | 1 | 30 | 23 | 54 | 53 |
| ucd53 | 0 | 0 | 1 | 46 | 7 | 54 | 53 |
| ucd54 | 0 | 0 | 1 | 40 | 13 | 54 | 53 |
| ucd55 | 0 | 0 | 1 | 35 | 18 | 54 | 53 |
| ucd56 | 0 | 0 | 1 | 39 | 14 | 54 | 53 |
| ucd6 | 0 | 0 | 2 | 34 | 18 | 54 | 52 |
| ucd7 | 0 | 0 | 1 | 37 | 16 | 54 | 53 |
| ucd9 | 0 | 0 | 1 | 29 | 24 | 54 | 53 |
View(trials)
#incomplete = c("120123BM", "13124EW","020624LB","020623LG") First participant is actually complete
a2 = separate(df_acc_noout, image, into = c("age2","trialtype"), sep = "_", remove = F)
## Warning: Expected 2 pieces. Additional pieces discarded in 4199 rows [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, ...].
a2[which(a2$trialtype == "rect.png"), "trialtype"] <- NA
a3 =a2
participant_list = unique(a3$date)
for (x in 1:length(participant_list)) {
#a3[which(a3$date == participant_list[x] & is.na(a3$trialtype)),"age"] = unique(a3[which(a3$date == participant_list[x] & !is.na(a3$trialtype)),"age"])
a3[which(a3$date == participant_list[x] & is.na(a3$trialtype)),"trialtype"] = "practice"
}
length(unique(a3$participant))
## [1] 90
df_acc_noout = a3
df_acc_noout =df_acc
df_acc_noout_practice = subset(df_acc_noout, block == "practice")
df_acc_noout_practice$practice_block = ifelse(df_acc_noout_practice$X <10, "block1","block2")
table(df_acc_noout_practice$participant)
##
## 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 59 60 61 mn001 mn002 mn003 mn004 mn005 mn006 mn007 mn008 mn009 mn010 mn011 mn012 mn013 mn014 mn015 mn017 mn018 mn019 mn020 mn022 ucd1 ucd10 ucd12 ucd13 ucd15 ucd16 ucd17 ucd18 ucd19 ucd2 ucd22 ucd25 ucd26 ucd27 ucd28 ucd3 ucd31 ucd32 ucd33 ucd34 ucd35 ucd36 ucd37 ucd38 ucd39 ucd4 ucd40 ucd41 ucd42 ucd43 ucd44 ucd45 ucd46 ucd47 ucd48 ucd49 ucd5 ucd50 ucd52 ucd53 ucd54 ucd55 ucd56 ucd6 ucd7 ucd9
## 12 6 6 6 6 6 6 6 6 12 6 6 6 6 12 6 6 6 6 12 6 6 6 6 6 6 6 6 6 12 12 6 6 6 6 12 6 12 6 12 6 12 12 6 12 6 6 6 6 6 12 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
agg_ams_task_practice = aggregate(accuracy ~ participant*numRatio*age*practice_block, df_acc_noout_practice, mean)
descriptive_amstask_practice = summarySE(agg_ams_task_practice, "accuracy", c("age","numRatio","practice_block"))
kable(descriptive_amstask_practice, table.attr = "style = \"color: white;\"")
| age | numRatio | practice_block | N | accuracy | sd | se | ci |
|---|---|---|---|---|---|---|---|
| 3 | 3.5 | block1 | 32 | 0.7083 | 0.2504 | 0.0443 | 0.0903 |
| 3 | 3.5 | block2 | 10 | 0.5333 | 0.2811 | 0.0889 | 0.2011 |
| 3 | 4.0 | block1 | 32 | 0.6458 | 0.3161 | 0.0559 | 0.1140 |
| 3 | 4.0 | block2 | 10 | 0.4667 | 0.3583 | 0.1133 | 0.2563 |
| 4 | 3.5 | block1 | 41 | 0.8374 | 0.2251 | 0.0352 | 0.0711 |
| 4 | 3.5 | block2 | 3 | 0.4444 | 0.1925 | 0.1111 | 0.4781 |
| 4 | 4.0 | block1 | 41 | 0.8618 | 0.1969 | 0.0307 | 0.0621 |
| 4 | 4.0 | block2 | 3 | 0.7778 | 0.1925 | 0.1111 | 0.4781 |
| 5 | 3.5 | block1 | 17 | 0.9412 | 0.1762 | 0.0427 | 0.0906 |
| 5 | 4.0 | block1 | 17 | 1.0000 | 0.0000 | 0.0000 | 0.0000 |
agg_ams_task_practice$numRatio = as.factor(agg_ams_task_practice$numRatio)
agg_ams_task_practice$numRatio <- factor(agg_ams_task_practice$numRatio, levels=c('4', '3.5'))
agg_ams_task_practice$type = "Practice Trials"
agg_ams_task_practice$age = as.factor(agg_ams_task_practice$age)
ams_ratio_graph_practice = ggplot(agg_ams_task_practice, aes(x = interaction(practice_block), y = accuracy)) +
#geom_paired_raincloud(aes(fill = as.factor(numRatio))) +
# geom_bar(stat = "identity", data = descriptive_ams_task,
# fill = NA, color = "#f03b20", size = 1, width = 0.55) +
ylab("Accuracy")+
geom_hline(yintercept = 0.5, linetype ="dashed")+
stat_summary(fun.data = data_summary, geom = "errorbar",
position = position_dodge(width = 0.10), width = 0.10, colour = "black", size =.75)+
stat_summary(fun.y = "mean", geom = "point", size = 2.5, shape = 23, colour = "black", aes(fill = age))+
geom_line(aes(group = interaction (participant)), color = "grey",
alpha = 0.4,
size = .5) +
scale_fill_manual(values = c("#0186C7","#E96A01","#FED602"))+
geom_point(aes(group = interaction (participant), color = participant),
alpha = 1.5,
size = .85, shape = 20) +
facet_grid(age~numRatio)+
theme_bw()+
scale_y_continuous(trans = shift_trans(0))+
theme(legend.position="none",
axis.title.x=element_text(size=size_text),
axis.text.x = element_text(size=size_text),
#axis.title.x = element_blank(),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "white", colour = "grey50"),
strip.background =element_rect(fill="#f0f0f0"),
strip.text = element_text(size = size_text),
axis.text.y = element_text(size=size_text),
axis.title.y = element_text(size=size_text),
legend.text=element_text(size=size_text))+
xlab("Ratio")
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
## Warning: The `fun.y` argument of `stat_summary()` is deprecated as of ggplot2 3.3.0.
## ℹ Please use the `fun` argument instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#ams_ratio_graph_practice
##
## block1 block2
## 36 2 2
## 37 0 0
## 38 0 0
## 39 0 0
## 40 0 0
## 41 0 0
## 42 0 0
## 43 0 0
## 44 0 0
## 45 2 2
## 46 0 0
## 47 0 0
## 48 0 0
## 49 0 0
## 50 2 2
## 51 0 0
## 53 0 0
## 54 0 0
## 55 0 0
## 56 2 2
## 57 0 0
## 59 0 0
## 60 0 0
## 61 0 0
## mn001 0 0
## mn002 0 0
## mn003 0 0
## mn004 0 0
## mn005 0 0
## mn006 2 2
## mn007 2 2
## mn008 0 0
## mn009 0 0
## mn010 0 0
## mn011 0 0
## mn012 2 2
## mn013 0 0
## mn014 2 2
## mn015 0 0
## mn017 2 2
## mn018 0 0
## mn019 2 2
## mn020 2 2
## mn022 0 0
## ucd1 2 2
## ucd10 0 0
## ucd12 0 0
## ucd13 0 0
## ucd15 0 0
## ucd16 0 0
## ucd17 2 2
## ucd18 0 0
## ucd19 0 0
## ucd2 0 0
## ucd22 0 0
## ucd25 0 0
## ucd26 0 0
## ucd27 0 0
## ucd28 0 0
## ucd3 0 0
## ucd31 0 0
## ucd32 0 0
## ucd33 0 0
## ucd34 0 0
## ucd35 0 0
## ucd36 0 0
## ucd37 0 0
## ucd38 0 0
## ucd39 0 0
## ucd4 0 0
## ucd40 0 0
## ucd41 0 0
## ucd42 0 0
## ucd43 0 0
## ucd44 0 0
## ucd45 0 0
## ucd46 0 0
## ucd47 0 0
## ucd48 0 0
## ucd49 0 0
## ucd5 0 0
## ucd50 0 0
## ucd52 0 0
## ucd53 0 0
## ucd54 0 0
## ucd55 0 0
## ucd56 0 0
## ucd6 0 0
## ucd7 0 0
## ucd9 0 0
## age practice_block N accuracy sd se ci
## 1 3 block1 10 0.4167 0.08784 0.02778 0.06284
## 2 3 block2 10 0.5000 0.28328 0.08958 0.20265
## 3 4 block1 3 0.4444 0.09623 0.05556 0.23904
## 4 4 block2 3 0.6111 0.09623 0.05556 0.23904
##
## Paired t-test
##
## data: accuracy by practice_block
## t = -1.5, df = 12, p-value = 0.2
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## -0.25385 0.04872
## sample estimates:
## mean difference
## -0.1026
df_acc_noout_experimental = subset(df_acc_noout, block != "practice")
df_acc_noout_experimental$age = as.factor(as.character(df_acc_noout_experimental$age))
distinct(df_acc_noout_experimental[c("participant","age")]) %>%
{table(.$age)}
##
## 3 4 5
## 32 41 17
ratio_condition_model <- glmer(accuracy ~
+ age * numRatio * block+
+ (1|participant), data = df_acc_noout_experimental, family = binomial, control = glmerControl(optimizer = "bobyqa"))
summary(ratio_condition_model)
## Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
## Family: binomial ( logit )
## Formula: accuracy ~ +age * numRatio * block + +(1 | participant)
## Data: df_acc_noout_experimental
## Control: glmerControl(optimizer = "bobyqa")
##
## AIC BIC logLik deviance df.resid
## 5619 5740 -2790 5581 4250
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.907 -1.044 0.606 0.849 1.262
##
## Random effects:
## Groups Name Variance Std.Dev.
## participant (Intercept) 0.132 0.363
## Number of obs: 4269, groups: participant, 90
##
## Fixed effects:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 0.00224 0.38305 0.01 0.9953
## age4 -0.24065 0.50091 -0.48 0.6309
## age5 -1.10374 0.79378 -1.39 0.1644
## numRatio 0.12240 0.16285 0.75 0.4523
## blockblock2 -0.10470 0.53384 -0.20 0.8445
## blockblock3 -0.16441 0.53398 -0.31 0.7582
## age4:numRatio 0.27295 0.23642 1.15 0.2483
## age5:numRatio 1.30303 0.50412 2.58 0.0097 **
## age4:blockblock2 0.12637 0.69753 0.18 0.8562
## age5:blockblock2 -0.77204 1.14709 -0.67 0.5009
## age4:blockblock3 -0.03023 0.69684 -0.04 0.9654
## age5:blockblock3 -0.22688 1.10619 -0.21 0.8375
## numRatio:blockblock2 -0.06268 0.23032 -0.27 0.7855
## numRatio:blockblock3 -0.06931 0.23035 -0.30 0.7635
## age4:numRatio:blockblock2 0.04316 0.33411 0.13 0.8972
## age5:numRatio:blockblock2 0.71719 0.74789 0.96 0.3376
## age4:numRatio:blockblock3 0.05426 0.33332 0.16 0.8707
## age5:numRatio:blockblock3 0.25190 0.70896 0.36 0.7224
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation matrix not shown by default, as p = 18 > 12.
## Use print(x, correlation=TRUE) or
## vcov(x) if you need it
em=emtrends(ratio_condition_model, pairwise ~ age|block, var="numRatio", mult.name = "age")
summary(em, infer=c(TRUE,TRUE), null=0, type = "response", adjust = "none")
## $emtrends
## block = block1:
## age numRatio.trend SE df asymp.LCL asymp.UCL z.ratio p.value
## 3 0.1224 0.163 Inf -0.1968 0.442 0.752 0.4523
## 4 0.3954 0.172 Inf 0.0593 0.731 2.306 0.0211
## 5 1.4254 0.477 Inf 0.4905 2.360 2.988 0.0028
##
## block = block2:
## age numRatio.trend SE df asymp.LCL asymp.UCL z.ratio p.value
## 3 0.0597 0.163 Inf -0.2595 0.379 0.367 0.7139
## 4 0.3758 0.171 Inf 0.0405 0.711 2.197 0.0280
## 5 2.0799 0.528 Inf 1.0449 3.115 3.938 0.0001
##
## block = block3:
## age numRatio.trend SE df asymp.LCL asymp.UCL z.ratio p.value
## 3 0.0531 0.163 Inf -0.2662 0.372 0.326 0.7445
## 4 0.3803 0.170 Inf 0.0481 0.713 2.244 0.0249
## 5 1.6080 0.471 Inf 0.6845 2.531 3.413 0.0006
##
## Confidence level used: 0.95
##
## $contrasts
## block = block1:
## contrast estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## age3 - age4 -0.273 0.236 Inf -0.736 0.1904 -1.155 0.2483
## age3 - age5 -1.303 0.504 Inf -2.291 -0.3150 -2.585 0.0097
## age4 - age5 -1.030 0.507 Inf -2.023 -0.0366 -2.032 0.0421
##
## block = block2:
## contrast estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## age3 - age4 -0.316 0.236 Inf -0.779 0.1468 -1.338 0.1808
## age3 - age5 -2.020 0.553 Inf -3.103 -0.9370 -3.655 0.0003
## age4 - age5 -1.704 0.555 Inf -2.792 -0.6161 -3.070 0.0021
##
## block = block3:
## contrast estimate SE df asymp.LCL asymp.UCL z.ratio p.value
## age3 - age4 -0.327 0.235 Inf -0.788 0.1335 -1.392 0.1640
## age3 - age5 -1.555 0.499 Inf -2.532 -0.5777 -3.119 0.0018
## age4 - age5 -1.228 0.501 Inf -2.209 -0.2464 -2.452 0.0142
##
## Confidence level used: 0.95
emeans=emmeans(ratio_condition_model, pairwise ~ age|block|numRatio, mult.name = "age", at=list(numRatio=c(1.5,2,2.5,3)))
summary(emeans, infer=c(TRUE,TRUE), null=0, type = "response", adjust = "none")
## $emmeans
## block = block1, numRatio = 1.5:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.546 0.0410 Inf 0.466 0.625 0.5 1.123 0.2613
## 4 0.588 0.0270 Inf 0.534 0.639 0.5 3.184 0.0015
## 5 0.738 0.0328 Inf 0.669 0.797 0.5 6.107 <.0001
##
## block = block2, numRatio = 1.5:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.497 0.0414 Inf 0.416 0.577 0.5 -0.078 0.9380
## 4 0.586 0.0270 Inf 0.532 0.638 0.5 3.117 0.0018
## 5 0.758 0.0327 Inf 0.688 0.816 0.5 6.402 <.0001
##
## block = block3, numRatio = 1.5:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.479 0.0414 Inf 0.400 0.560 0.5 -0.498 0.6185
## 4 0.534 0.0277 Inf 0.480 0.588 0.5 1.235 0.2169
## 5 0.715 0.0342 Inf 0.643 0.777 0.5 5.484 <.0001
##
## block = block1, numRatio = 2.0:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.561 0.0292 Inf 0.504 0.618 0.5 2.081 0.0375
## 4 0.635 0.0245 Inf 0.585 0.681 0.5 5.226 <.0001
## 5 0.852 0.0409 Inf 0.753 0.916 0.5 5.400 <.0001
##
## block = block2, numRatio = 2.0:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.504 0.0298 Inf 0.446 0.562 0.5 0.143 0.8865
## 4 0.631 0.0246 Inf 0.581 0.677 0.5 5.073 <.0001
## 5 0.899 0.0333 Inf 0.812 0.948 0.5 5.964 <.0001
##
## block = block3, numRatio = 2.0:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.486 0.0297 Inf 0.428 0.544 0.5 -0.470 0.6383
## 4 0.581 0.0255 Inf 0.531 0.630 0.5 3.132 0.0017
## 5 0.849 0.0412 Inf 0.749 0.913 0.5 5.374 <.0001
##
## block = block1, numRatio = 2.5:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.577 0.0290 Inf 0.519 0.632 0.5 2.597 0.0094
## 4 0.679 0.0342 Inf 0.609 0.742 0.5 4.778 <.0001
## 5 0.921 0.0393 Inf 0.802 0.971 0.5 4.534 <.0001
##
## block = block2, numRatio = 2.5:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.512 0.0297 Inf 0.454 0.570 0.5 0.393 0.6940
## 4 0.673 0.0344 Inf 0.603 0.737 0.5 4.620 <.0001
## 5 0.962 0.0226 Inf 0.883 0.988 0.5 5.259 <.0001
##
## block = block3, numRatio = 2.5:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.493 0.0298 Inf 0.435 0.551 0.5 -0.247 0.8047
## 4 0.627 0.0361 Inf 0.553 0.694 0.5 3.352 0.0008
## 5 0.926 0.0368 Inf 0.814 0.973 0.5 4.705 <.0001
##
## block = block1, numRatio = 3.0:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.591 0.0400 Inf 0.511 0.667 0.5 2.234 0.0255
## 4 0.721 0.0463 Inf 0.622 0.802 0.5 4.124 <.0001
## 5 0.960 0.0298 Inf 0.840 0.991 0.5 4.104 <.0001
##
## block = block2, numRatio = 3.0:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.519 0.0414 Inf 0.438 0.599 0.5 0.463 0.6434
## 4 0.713 0.0469 Inf 0.613 0.796 0.5 3.976 0.0001
## 5 0.986 0.0119 Inf 0.928 0.997 0.5 4.901 <.0001
##
## block = block3, numRatio = 3.0:
## age prob SE df asymp.LCL asymp.UCL null z.ratio p.value
## 3 0.499 0.0414 Inf 0.419 0.580 0.5 -0.017 0.9861
## 4 0.670 0.0500 Inf 0.566 0.760 0.5 3.130 0.0017
## 5 0.966 0.0255 Inf 0.862 0.992 0.5 4.354 <.0001
##
## Confidence level used: 0.95
## Intervals are back-transformed from the logit scale
## Tests are performed on the logit scale
##
## $contrasts
## block = block1, numRatio = 1.5:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.8447 0.1684 Inf 0.5715 1.2486 1 -0.847 0.3972
## age3 / age5 0.4271 0.1012 Inf 0.2684 0.6795 1 -3.590 0.0003
## age4 / age5 0.5056 0.1026 Inf 0.3397 0.7526 1 -3.361 0.0008
##
## block = block2, numRatio = 1.5:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.6978 0.1392 Inf 0.4719 1.0317 1 -1.804 0.0713
## age3 / age5 0.3152 0.0767 Inf 0.1956 0.5078 1 -4.745 <.0001
## age4 / age5 0.4517 0.0949 Inf 0.2992 0.6820 1 -3.781 0.0002
##
## block = block3, numRatio = 1.5:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.8026 0.1602 Inf 0.5427 1.1868 1 -1.102 0.2705
## age3 / age5 0.3672 0.0866 Inf 0.2314 0.5828 1 -4.250 <.0001
## age4 / age5 0.4576 0.0921 Inf 0.3085 0.6787 1 -3.886 0.0001
##
## block = block1, numRatio = 2:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.7369 0.1171 Inf 0.5397 1.0062 1 -1.921 0.0548
## age3 / age5 0.2226 0.0768 Inf 0.1132 0.4377 1 -4.355 <.0001
## age4 / age5 0.3021 0.1029 Inf 0.1549 0.5890 1 -3.514 0.0004
##
## block = block2, numRatio = 2:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.5957 0.0947 Inf 0.4362 0.8136 1 -3.257 0.0011
## age3 / age5 0.1148 0.0442 Inf 0.0540 0.2439 1 -5.628 <.0001
## age4 / age5 0.1927 0.0733 Inf 0.0914 0.4063 1 -4.327 <.0001
##
## block = block3, numRatio = 2:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.6814 0.1080 Inf 0.4995 0.9297 1 -2.420 0.0155
## age3 / age5 0.1688 0.0577 Inf 0.0863 0.3299 1 -5.202 <.0001
## age4 / age5 0.2477 0.0835 Inf 0.1279 0.4796 1 -4.138 <.0001
##
## block = block1, numRatio = 2.5:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.6429 0.1265 Inf 0.4372 0.9454 1 -2.245 0.0248
## age3 / age5 0.1160 0.0645 Inf 0.0390 0.3449 1 -3.875 0.0001
## age4 / age5 0.1805 0.1020 Inf 0.0596 0.5463 1 -3.030 0.0024
##
## block = block2, numRatio = 2.5:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.5086 0.1000 Inf 0.3460 0.7477 1 -3.439 0.0006
## age3 / age5 0.0418 0.0261 Inf 0.0123 0.1420 1 -5.088 <.0001
## age4 / age5 0.0822 0.0520 Inf 0.0238 0.2837 1 -3.953 0.0001
##
## block = block3, numRatio = 2.5:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.5786 0.1128 Inf 0.3948 0.8479 1 -2.806 0.0050
## age3 / age5 0.0776 0.0427 Inf 0.0264 0.2280 1 -4.647 <.0001
## age4 / age5 0.1340 0.0749 Inf 0.0448 0.4008 1 -3.596 0.0003
##
## block = block1, numRatio = 3:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.5609 0.1588 Inf 0.3221 0.9768 1 -2.043 0.0411
## age3 / age5 0.0605 0.0478 Inf 0.0128 0.2851 1 -3.546 0.0004
## age4 / age5 0.1078 0.0870 Inf 0.0222 0.5243 1 -2.760 0.0058
##
## block = block2, numRatio = 3:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.4343 0.1228 Inf 0.2495 0.7558 1 -2.951 0.0032
## age3 / age5 0.0152 0.0135 Inf 0.0027 0.0863 1 -4.728 <.0001
## age4 / age5 0.0351 0.0315 Inf 0.0060 0.2042 1 -3.727 0.0002
##
## block = block3, numRatio = 3:
## contrast odds.ratio SE df asymp.LCL asymp.UCL null z.ratio p.value
## age3 / age4 0.4913 0.1377 Inf 0.2836 0.8509 1 -2.536 0.0112
## age3 / age5 0.0356 0.0279 Inf 0.0077 0.1653 1 -4.259 <.0001
## age4 / age5 0.0726 0.0579 Inf 0.0152 0.3465 1 -3.289 0.0010
##
## Confidence level used: 0.95
## Intervals are back-transformed from the log odds ratio scale
## Tests are performed on the log odds ratio scale
plot(ggpredict(ratio_condition_model, terms=c("numRatio","age","block")))
| age | numRatio | N | accuracy | sd | se | ci |
|---|---|---|---|---|---|---|
| 3 | 1.50 | 32 | 0.5208 | 0.1680 | 0.0297 | 0.0606 |
| 3 | 2.00 | 32 | 0.5156 | 0.1562 | 0.0276 | 0.0563 |
| 3 | 2.50 | 32 | 0.5339 | 0.1568 | 0.0277 | 0.0565 |
| 3 | 3.00 | 32 | 0.5417 | 0.1720 | 0.0304 | 0.0620 |
| 4 | 1.25 | 41 | 0.5440 | 0.1455 | 0.0227 | 0.0459 |
| 4 | 1.50 | 41 | 0.5630 | 0.1204 | 0.0188 | 0.0380 |
| 4 | 2.00 | 41 | 0.6220 | 0.1526 | 0.0238 | 0.0482 |
| 4 | 2.50 | 41 | 0.6491 | 0.1942 | 0.0303 | 0.0613 |
| 5 | 1.17 | 17 | 0.6127 | 0.1348 | 0.0327 | 0.0693 |
| 5 | 1.25 | 17 | 0.6569 | 0.1611 | 0.0391 | 0.0828 |
| 5 | 1.50 | 17 | 0.7059 | 0.1617 | 0.0392 | 0.0831 |
| 5 | 2.00 | 17 | 0.8676 | 0.1956 | 0.0474 | 0.1006 |
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
df_acc_noout_experimental_age = subset(df_acc_noout_experimental, numRatio== 1.5 | numRatio== 2)
df_acc_noout_experimental_age_overall = aggregate(accuracy ~ participant*age, df_acc_noout_experimental_age, mean)
df_acc_noout_experimental_age_overall$task = "AMS Task - Age Effects"
ams_age = ggplot(df_acc_noout_experimental_age_overall, aes(x = as.factor(age), y = accuracy, group = as.factor(age), color =as.factor(age))) +
geom_bar(stat = "identity", data = summarySE(df_acc_noout_experimental_age, "accuracy", c("age")),
aes(fill = as.factor(age) ), color = "black", size = .75, width = 0.55) +
geom_dotplot(binaxis = "y", stackdir = "center", fill ="#737373", color = NA, dotsize =.5)+
# geom_point(aes(group = interaction (participant)),
# alpha = 1,
# size = .75, colour = "#737373") +
#geom_abline(slope = 1, intercept = 0, color = "#615e62", linetype = "dashed") +
stat_summary(fun.data = data_summary, geom = "errorbar", width=.01, size =0.5, color = "black")+
#stat_summary(fun.y = "mean", geom = "point", size = 2, colour = "black", shape = 21, alpha =.85)+
ylab("Accuracy")+
geom_hline(yintercept = 0.5, linetype ="dashed")+
theme_bw()+
scale_fill_manual(values = c("#0186C7","#E96A01","#FED602"))+
scale_y_continuous(breaks=seq(0, 1, .1), limits=c(0,1.01),trans = shift_trans(0), expand = c(0,0))+
theme(legend.position="none",
axis.title.x=element_blank(),
axis.text.x = element_text(size=size_text),
#axis.title.x = element_text(size = size_text),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "white", colour = "grey50"),
strip.background =element_rect(fill="#f0f0f0"),
strip.text = element_text(size = size_text),
axis.text.y = element_text(size=size_text),
axis.title.y = element_text(size=size_text),
legend.text=element_text(size=size_text)) +
facet_grid(task~.)
#scale_y_continuous(breaks=seq(0, 1, .1), limits=c(0,1.01))
ams_age
## Bin width defaults to 1/30 of the range of the data. Pick better value with `binwidth`.