delay-discounting-analysis
delay-discounting-analysis copied to clipboard
add another table to store global level experiment data
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
- The first column must be called
filename
, and currently has to include the extension. - 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
- [x] enable table to be stored in Data
- [x] enable automatic exporting into a
.csv
file - [x] build in some asserts, because the Table being passed in must fulfil certain requirements
- [x] make this alt param estimate file default behaviour, even if no metaTable inputs are provided. Do this by just setting the filename as the only column in the table
- [ ] document on the wiki
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:
- only one group = this works fine now
- multiple groups, but no hierarchical inference = this works fine now
- otherwise = I need to think more. If we have multiple groups and are doing hierarchical inference, then things will be much more complex. This is the beyond the topic of this issue.