#============================================# # Reading in data of Switching Task for # # the measurement of reliability index # #============================================# #----------- # LIBS #----------- library(plyr) source("C://Dropbox//PHD_MultisensoryNeglect//BasicFunctions.R") #----------- # DATA #----------- dp <- "C://Dropbox//EFT_Project//Internship_EFT_HH//CO 12//Data 1.0//SWITCH//" SWITCH <- ReadTextFile(dp, sep = ",") #----------- # OUTLIERS #----------- Participants <- ddply(SWITCH[SWITCH$TrialNum != 0, ], c("PartID"), function(df)c(Acc = mean(df$Accuracy))) length(Participants$PartID[Participants$Acc > (mean(Participants$Acc) - 2.5 * sd(Participants$Acc))]) SWITCH <- SWITCH[SWITCH$PartID %in% Participants$PartID[Participants$Acc > (mean(Participants$Acc) - 2.5 * sd(Participants$Acc))], ] #------------------------------- # SPLIT DATA IN TWO HALVES #------------------------------- # Summarize: RT_Summary <- ddply(SWITCH, c("PartID"), function(df)c(RTSwitch1 = mean(df$RT[df$Accuracy == 1 & df$TrialNum == 0 & df$SwitchNum < 10]), RTSwitch2 = mean(df$RT[df$Accuracy == 1 & df$TrialNum == 0 & df$SwitchNum >= 10]), RTMaintain1 = mean(df$RT[df$Accuracy == 1 & df$TrialNum != 0 & df$SwitchNum < 10]), RTMaintain2 = mean(df$RT[df$Accuracy == 1 & df$TrialNum != 0 & df$SwitchNum >= 10]), RTBase1 = mean(df$RT[df$SwitchNum < 10]), RTBase2 = mean(df$RT[df$SwitchNum >= 10]))) RT_Summary$SwitchCost1 <- (RT_Summary$RTSwitch1 / RT_Summary$RTBase1) - (RT_Summary$RTMaintain1/RT_Summary$RTBase1) RT_Summary$SwitchCost2 <- (RT_Summary$RTSwitch2 / RT_Summary$RTBase2) - (RT_Summary$RTMaintain2/RT_Summary$RTBase2) #------------------------------- # SPEARMAN BROWN #------------------------------- plot(RT_Summary$SwitchCost1, RT_Summary$SwitchCost2) cor.test(RT_Summary$SwitchCost1, RT_Summary$SwitchCost2) spb <- (2 * cor(RT_Summary$SwitchCost1, RT_Summary$SwitchCost2)) / (1 + (2 - 1) * cor(RT_Summary$SwitchCost1, RT_Summary$SwitchCost2))