Skip to content

Commit

Permalink
task
Browse files Browse the repository at this point in the history
  • Loading branch information
kianooshhosseini committed Oct 17, 2024
1 parent c2a775e commit 1f681c5
Show file tree
Hide file tree
Showing 842 changed files with 9,732 additions and 43 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions code/mfe_c_object_data_organizer_v1.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ library(stringr)


#Working directory should be the Psychopy experiment directory.
proje_wd <- "/Users/kihossei/Documents/GitHub/mfe_c_object"
proje_wd <- "/Users/kihossei/Library/CloudStorage/[email protected]/My Drive/My Digital Life/Professional/GitHub_Repos/mfe-c-object-dataset"
setwd(proje_wd)

# Defining the input and output folders.
input_path <- paste(proje_wd, "sourcedata", "raw", "psychopy", sep ="/", collapse = NULL) # input data directory
input_path <- paste(proje_wd, "sourcedata", "checked", "psychopy", sep ="/", collapse = NULL) # input data directory
output_path <- paste(proje_wd, "derivatives", "psychopy", "csv_output", sep ="/", collapse = NULL) # Directory that each new csv file will be stored
flanker_csv_fileName <- "_mfe_c_object_flankerDat_v1.csv" # each output csv file will have this on its filename
surprise_csv_fileName <- "_mfe_c_object_surpriseDat_v1.csv" # each output csv file will have this on its filename
Expand Down
17 changes: 13 additions & 4 deletions code/mfe_c_object_measure_computations_v1.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ library(stringr)
library(psycho) # to compute d' measures, etc.

#Working directory should be the Psychopy experiment directory.
proje_wd <- "/Users/kihossei/Documents/GitHub/mfe_c_object"
proje_wd <- "/Users/kihossei/Library/CloudStorage/[email protected]/My Drive/My Digital Life/Professional/GitHub_Repos/mfe-c-object-dataset"
setwd(proje_wd)

input_raw_path <- paste(proje_wd, "sourcedata", "raw", "psychopy", sep ="/", collapse = NULL) # input data directory
input_raw_path <- paste(proje_wd, "sourcedata", "checked", "psychopy", sep ="/", collapse = NULL) # input data directory
input_organized_path <- paste(proje_wd, "derivatives", "psychopy", "csv_output", sep ="/", collapse = NULL) # input directory for data files generated by the organizer script!
output_path <- paste(proje_wd, "derivatives", "psychopy", "stat_output", sep ="/", collapse = NULL) # output directory
proc_fileName <- "processed_data_mfe_c_object_Proj_v1.csv" # output filename
Expand Down Expand Up @@ -352,7 +352,7 @@ for (subject in 1:length(raw_datafiles_list)){


### Loading RedCap questionnaire data
redcapDat <- read.csv(file = "/Users/kihossei/Documents/GitHub/mfe_c_object/derivatives/redcap/202402v0memoryforerr_SCRD_2024-08-19_1102.csv")
redcapDat <- read.csv(file = "/Users/kihossei/Library/CloudStorage/[email protected]/My Drive/My Digital Life/Professional/GitHub_Repos/mfe-c-object-dataset/derivatives/redcap/202402v0memoryforerr_SCRD_2024-09-10_1142.csv")

# stai state before and after the flanker task were not properly scored on the HPC due to an error in the naming.
# They will be scored here.
Expand All @@ -371,7 +371,7 @@ redcapDat$postTask_d_s1_r1_e1 <- rowSums(redcapDat[ , c("posttaskd_i1_s1_r1_e1",


# Keeping the columns that we need!
redcapDat <- redcapDat[c("record_id", "demo_c_yob_s1_r1_e1", "scaared_b_scrdSoc_s1_r1_e1", "scaared_b_scrdGA_s1_r1_e1", "scaared_b_scrdTotal_s1_r1_e1",
redcapDat <- redcapDat[c("record_id", "scaared_b_scrdSoc_s1_r1_e1", "scaared_b_scrdGA_s1_r1_e1", "scaared_b_scrdTotal_s1_r1_e1",
"bfne_b_scrdTotal_s1_r1_e1", "epepq15_scrdTotal_s1_r1_e1", "phq8_scrdTotal_s1_r1_e1",
"stai5_scrdS_s1_r1_e1", "stai5_scrdS_s1_r1_e2", "stai5_scrdS_diff", "postTask_d_s1_r1_e1")]

Expand Down Expand Up @@ -405,6 +405,15 @@ for (rr in 1:nrow(main_df)){
}
}

# According to the notes the state survey data of the following subjects should be excluded.
# Subject IDs: 260047 (all the state surveys)

matching_rows <- main_df$participant_id == 260047
main_df$epepq15_scrdTotal_s1_r1_e1[matching_rows] <- "NA"
main_df$postTask_d_s1_r1_e1[matching_rows] <- "NA"
main_df$stai5_scrdS_s1_r1_e1[matching_rows] <- "NA"
main_df$stai5_scrdS_s1_r1_e2[matching_rows] <- "NA"
main_df$stai5_scrdS_diff[matching_rows] <- "NA"

####################
# Save the dataset
Expand Down
34 changes: 32 additions & 2 deletions code/mfe_c_object_stats_v1.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ library(effsize)

#Working directory should be the Psychopy experiment directory.

proje_wd <- "/Users/kihossei/Documents/GitHub/mfe_c_object"
proje_wd <- "/Users/kihossei/Library/CloudStorage/[email protected]/My Drive/My Digital Life/Professional/GitHub_Repos/mfe-c-object-dataset"
setwd(proje_wd)

processed_file_input <- paste(proje_wd, "derivatives", "psychopy", "stat_output", sep ="/", collapse = NULL) # input data directory
Expand Down Expand Up @@ -47,7 +47,6 @@ new_main_df[-c(1, ncol(new_main_df))] <- apply(main_df[-c(1, ncol(main_df))], 2,
main_df <- new_main_df



# flanker task stats


Expand Down Expand Up @@ -162,6 +161,37 @@ ggplot(main_df, aes(x=scaared_b_scrdSoc_s1_r1_e1, y=hitRate_error_minus_correct)
labs(x = "SCAARED social anxiety score", y = "Error vs. Correct Hit rate") +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) + theme(axis.text = element_text(size = 15)) + theme(text = element_text(size = 18))
lm_for_cor_fit_line <- lm(error_hitRate ~ scaared_b_scrdSoc_s1_r1_e1, main_df)
summary(lm_for_cor_fit_line)
ggplot(main_df, aes(x=scaared_b_scrdSoc_s1_r1_e1, y=error_hitRate)) + geom_point(size = 4) + geom_smooth(method="lm") +
labs(x = "SCAARED social anxiety score", y = "error_hitRate") +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) + theme(axis.text = element_text(size = 15)) + theme(text = element_text(size = 18))
lm_for_cor_fit_line <- lm(correct_hitRate ~ scaared_b_scrdSoc_s1_r1_e1, main_df)
summary(lm_for_cor_fit_line)
ggplot(main_df, aes(x=scaared_b_scrdSoc_s1_r1_e1, y=correct_hitRate)) + geom_point(size = 4) + geom_smooth(method="lm") +
labs(x = "SCAARED social anxiety score", y = "correct_hitRate") +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) + theme(axis.text = element_text(size = 15)) + theme(text = element_text(size = 18))


lm_for_cor_fit_line <- lm(hitRate_error_minus_correct ~ scaared_b_scrdTotal_s1_r1_e1, main_df)
summary(lm_for_cor_fit_line)
cor.test(main_df$scaared_b_scrdTotal_s1_r1_e1, main_df$hitRate_error_minus_correct, method = 'pearson', na.action = na.omit)
ggplot(main_df, aes(x=scaared_b_scrdSoc_s1_r1_e1, y=hitRate_error_minus_correct)) + geom_point(size = 4) + geom_smooth(method="lm") +
labs(x = "SCAARED total anxiety score", y = "Error vs. Correct Hit rate") +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) + theme(axis.text = element_text(size = 15)) + theme(text = element_text(size = 18))

ggplot(main_df, aes(x=scaared_b_scrdTotal_s1_r1_e1, y=error_hitRate)) + geom_point(size = 4) + geom_smooth(method="lm") +
labs(x = "SCAARED total anxiety score", y = "error_hitRate") +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) + theme(axis.text = element_text(size = 15)) + theme(text = element_text(size = 18))

ggplot(main_df, aes(x=scaared_b_scrdTotal_s1_r1_e1, y=correct_hitRate)) + geom_point(size = 4) + geom_smooth(method="lm") +
labs(x = "SCAARED total anxiety score", y = "correct_hitRate") +
theme_bw() + theme(panel.border = element_blank(), panel.grid.major = element_blank(),
panel.grid.minor = element_blank(), axis.line = element_line(colour = "black")) + theme(axis.text = element_text(size = 15)) + theme(text = element_text(size = 18))

lm_for_cor_fit_line <- lm(hitRate_post_error_minus_correct ~ scaared_b_scrdSoc_s1_r1_e1, main_df)
summary(lm_for_cor_fit_line)
Expand Down
23 changes: 12 additions & 11 deletions data-monitoring/data-dictionary/central-tracker_datadict.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
variable,dataType,description,detail,allowedSuffix,measureUnit,allowedValues,valueInfo,provenance,expectedFileExt
id,id,"Participant ID (file: ""{filename}""; variable: ""{variable name}"")","The participant ID is specific to this study, and is auto-assigned by REDCap.",NA,Integer,{list allowed values separated by commas},One ID per participant (eligible and ineligible),automatic,
consent,consent,Participant consent status,"When data is transferred from raw to checked, value of 1 is assigned based on the value of ""consent_complete"" or ""consentes_complete"" == ""2""(indicating participant consented), otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,
[one row for each psychopy task],psychopy,{task name} task status,"When data is transferred from raw to checked, value of 1 is assigned if ""{task name}"" file exists, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,"{list expected file extensions separated by commas; list allowed file extensions separated by ""|""}"
[if audio/audacity data collected:] {task}_audio/audacity,audio/audacity,{Audio/Audacity} data status,"When hallMonitor is run, value of 1 is assigned if data already exists in checked, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,"{list expected file extensions separated by commas; list allowed file extensions separated by ""|""}"
[if video/zoom data collected:] {task}_video/zoom,video/zoom,{Video/Zoom} data status,"When hallMonitor is run, value of 1 is assigned if data already exists in checked, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,"{list expected file extensions separated by commas; list allowed file extensions separated by ""|""}"
[if EEG data collected:] {task}_eeg,eeg,{Brain Vision/EGI} EEG data status,"When data is transferred from raw to checked, value of 1 is assigned if data exists, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,"{list expected file extensions separated by commas; list allowed file extensions separated by ""|""}"
[if EEG digi data collected:] {task}_digi,digi,Digi data status,"When hallMonitor is run, value of 1 is assigned if data already exists in checked, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,"{list expected file extensions separated by commas; list allowed file extensions separated by ""|""}"
[one row for each REDCap questionnaire task],redcap_data,{questionnaire name} questionnaire status,"When data is transferred from raw to checked, value of 1 is assigned based on the value of ""{questionnaire name}_complete""!=NULL (indicating participant began questionnaire), otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor,
[one row for each score output for each REDCap questionnaire task],redcap_scrd,{questionnaire name} {score name} status,"When data is preprocessed, value of 1 is assigned if preprocessing outputs ""{score name}""; otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-instruments,
[one row for each custom variable from preprocessing scripts],custom,{description of variable} status,"When data is preprocessed, {description of how values are assigned in the script}",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-{script name},
variable,description,detail,allowedSuffix,measureUnit,allowedValues,valueInfo,provenance
id,Participant ID,"The participant ID is specific to this study, and is auto-assigned by REDCap during completion of the eligibility questionnaire.",NA,Integer,,One ID per participant (eligible and ineligible),automatic
consent_s1_r1_e1,consent: Participant consent status,"When data is transferred from raw to checked, value of 1 is assigned based on the value of ""consent_yn""==""y"" (indicating participant consented), otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{one row for each psychopy task},psychopy: {task name} task status,"When data is transferred from raw to checked, value of 1 is assigned if ""{task name}"" file exists, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{if audio data collected:} audioData_s1_r1_e1,audio: Status of audio data,"When hallMonitor is run, value of 1 is assigned if data already exists in checked, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{if video data collected:} videoData_s1_r1_e1,video: Status of video data,"When hallMonitor is run, value of 1 is assigned if data already exists in checked, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{if Brain Vision EEG data collected:} bvData_s1_r1_e1,eeg: Status of Brain Vision EEG data,"When data is transferred from raw to checked, value of 1 is assigned if data exists, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{if EGI EEG data collected:} egiData_s1_r1_e1,eeg: Status of EGI EEG data,"When data is transferred from raw to checked, value of 1 is assigned if data exists, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{if EEG digi data collected:} digiData_s1_r1_e1,digi: Status of digi data,"When hallMonitor is run, value of 1 is assigned if data already exists in checked, otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{one row for each REDCap questionnaire task},redcap_data: {questionnaire name} status,"When data is transferred from raw to checked, value of 1 is assigned based on the value of ""{questionnaire name}_complete""!=NULL (indicating participant began questionnaire), otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-hallMonitor
{one row for each score output for each REDCap questionnaire task},redcap_scrd: {questionnaire name} {score name} status,"When data is preprocessed, value of 1 is assigned if preprocessing outputs ""{score name}""; otherwise 0.",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-instruments
{one row for each custom variable from preprocessing scripts},custom: {description of variable},"When data is preprocessed, {description of how values are assigned in the script}",s1_r1_e1,Logical,"NA, 0, 1","NA, status unknown | 0, no data exists | 1, data exists",code-{script name}
2 changes: 1 addition & 1 deletion data-monitoring/data-dictionary/datadict_definitions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description,"human-readable description of the variable, starting with one of th
detail,"for questionnaire items, content of the specific question; for all other variables, clarification of how the variable value is calculated/derived"
allowedSuffix,"sX_rX_eX, where s=session, r=run, and e=event"
valueType,"indication of the computer-readable value type used for the variable (i.e., Integer, Real, Logical, Char, Time)"
allowedValues,"all allowed values for the variable: Integers and Real numbers as [x,y] (also applies to lower/upper end of a Vector of Integer, Tuple of Real, etc.); Logical as 0, 1; Likert/Categorical as 1, 2, 3; Char as ""text"""
allowedValues,"all allowed values for the variable: Integers and Real numbers as [x,y]; Logical as 0, 1; Likert/Categorical as 1, 2, 3; Char as ""text"""
valueInfo,indication of how allowed values are determined; categorical-type options may be separated by | (vertical bar) or ; (semicolon)
naValueType,"indication of how NA values are flagged (NA, NaN, etc.)"
activeStatus,indication of whether variable is currently being used/collected
Expand Down
13 changes: 13 additions & 0 deletions materials/mfe_c_object/blockSelect.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
whichBlock
flanker_main_block_1.csv
flanker_main_block_2.csv
flanker_main_block_3.csv
flanker_main_block_4.csv
flanker_main_block_5.csv
flanker_main_block_6.csv
flanker_main_block_7.csv
flanker_main_block_8.csv
flanker_main_block_9.csv
flanker_main_block_10.csv
flanker_main_block_11.csv
flanker_main_block_12.csv
2 changes: 2 additions & 0 deletions materials/mfe_c_object/blockSelect_practice.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
whichBlock
flanker_practice_block.csv
Loading

0 comments on commit 1f681c5

Please sign in to comment.