drbenvincent / delay-discounting-analysis

Hierarchical Bayesian estimation and hypothesis testing for delay discounting tasks
http://www.inferencelab.com/delay-discounting-analysis/
MIT License
23 stars 9 forks source link

add another table to store global level experiment data #181

Open drbenvincent opened 7 years ago

drbenvincent commented 7 years ago

We want a high level table that includes information about participants, id numbers, conditions, age, etc.

Method 1: Pass in the name of an experiment table

This is perhaps the easiest option. If you have a spreadsheet of filenames, participant id's, ages, conditions, etc, then you can pass in the filename so that it will be imported. This extra information can then be used so that the toolbox will essentially export a similar file, but with extra discounting-related information appended to it.

myData = Data(datapath,...
    'files', filenames,...
    'metaTableFile', path_to_experiment_spreadsheet);

so you would have a spreadsheet (.csv format) with something like this...

filename id gender condition
AA-male-A.txt AA male A
JD-male-A.txt JD male A
MP-male-B.txt MP male B
KR-male-B.txt KR male B
OP-female-A.txt OP female A
EW-female-A.txt EW female A
WK-female-B.txt WK female B
CD-female-B.txt CD female B

Requirements

  1. The first column must be called filename, and currently has to include the extension.
  2. The number and names of files in this file, and the list of files passed into Data must be the same.

Method 2: Passing in a table

You can pass in a pre-built matlab Table. This might happen if you have a participant filename scheme which contains information about participant id, gender, age, condition, etc. You can then write your own function to parse all the filenames and build a matlab Table. For example, if you have a naming convention for your discounting files, such as:

AA-male-conditionA.txt
JD-male-conditionA.txt
MP-male-conditionB.txt
KR-male-conditionB.txt
OP-female-conditionA.txt
EW-female-conditionA.txt
WK-female-conditionB.txt
CD-female-conditionB.txt

Then you can write your own function to parse these filenames to result in your own table, eg. metaTable = filenames2table(filenames). In this case it might look something like:

filename id gender condition
AA-male-A.txt AA male A
JD-male-A.txt JD male A
MP-male-B.txt MP male B
KR-male-B.txt KR male B
OP-female-A.txt OP female A
EW-female-A.txt EW female A
WK-female-B.txt WK female B
CD-female-B.txt CD female B

So you'd implement this in this way

metaTable = filenames2table(filenames);
myData = Data(datapath,...
    'files', filenames,...
    'metaTable', metaTable);

This approach is probably only sensible if you have categorical variables that you care about. It would get very messy to encode numerical values in a filename coding scheme.

Todo

drbenvincent commented 7 years ago

This is working reasonably well now. We get an additional table exported (csv file) which includes any experiment-level variables (like condition, id, etc) as well as the discounting parameters and posterior predictive information all in one. This is nice as we can import this file directly into JASP (for example) to run analyses.

Status: