Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

discrepancy between manual and example datasets #2

Open
Alan-Pickering opened this issue Apr 28, 2020 · 1 comment
Open

discrepancy between manual and example datasets #2

Alan-Pickering opened this issue Apr 28, 2020 · 1 comment

Comments

@Alan-Pickering
Copy link

We have been using the utility but there are some minor issues in the examples and the data provided
First the manual says
"Suppose you have 40 subjects' choice data in a 2-armed bandit task, in which subjects chose between two actions and received binary outcomes.
All data have been stored in a mat-file called all_data.mat in a cell format, in which each cell contains choice data and outcomes for one subject."

The data file all_data.mat has only 20 Ss in it.

Second, when I run the example as per the example
% data of subject 1
subj1 = data{1};
parameters = randn(1,2);
F1 = model_RL(parameters,subj1)

it fails because the data for subject1, extracted from all_data.mat do not have a field called actions in the subj1 structure. (There are fields like subj1.choice1 and subj1.choice2 plus numerous other fields.)

So I added a field to subj1 thus
subj1.actions=subj1.choice1

but then the commands from the manual here
parameters = randn(1,2);
F1 = model_RL(parameters,subj1)

fail with this error message
Array indices must be positive integers or logical values.
Error in model_RL (line 41)
delta = o - q(a); % prediction error

So I wonder if the subj structure needs to contain ONLY the actions and outcome fields
so I make a new subject structure like that, but it crashes with the same error message when I run
F1 = model_RL(parameters,subj1)

@Alan-Pickering
Copy link
Author

This turns out to be an issue caused by having the same file name for each dataset in the two examples:- all_data.mat
Working from the cbm_master directory/folder means that, when you load the data, the way Matlab paths work (and their priority rules) mean that you load the all_data.mat file from the 2-step task directory!

To be fair your instructions in the manual did say
% enter the example_RL_task folder,
% which contains data and models for this example
% (assuming that you are in the directory of the manual)
cd(fullfile('example_RL_task'));

This was a step I didn't follow as I hadn't noticed that the data files had the same name in each example (why would they!?) and I knew that all subfolders were in my Matlab path.

Maybe just worth stressing in the manual that you really do need to do this directory step because of the filenames you have used. Renaming the datafiles to have different names would be good practice, but it would need a lot more editing of the manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant