Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Accuracy of multiple variables in the same loop

Hello everybody,

since a few days I try to get the accuracies from different variables in the same loop. The experiment has to be exported to Jatos afterwards, so I am not allowed to use python based inline_script. The javascript can only access variables, but not the accuracy. To explain my problem in detail: I have a loop with two variables wich each consist of three parameters (stimulus1: A, C, E and stimulus2: B, D, F). In the experiment, the test person has to decide between AB, CD and EF. They pairs need to be shown in a random order. After 60 random trials, so 20 trials per pair, I need to know they accuracy for each pair seperatly.

Does anyone have an idea how I can solve this problem?

Best regards

• Hi Aylo,

I don't think this is going to work without some scripting. However, I think the scripting should be fairly doable. For example, consider this code:

```if (vars.presented_pair == 'AB') {
if (vars.correct == 1) {
vars.ab_total_correct = vars.ab_total_correct + 1;
}
vars.ab_accuracy = vars.ab_total_correct / vars.total_trials;
}
else if (vars.presented_pair == 'CD') {
if (vars.correct == 1) {
vars.cd_total_correct = vars.cd_total_correct + 1;
}
vars.cd_accuracy = vars.cd_total_correct / vars.total_trials;
}
else if (vars.presented_pair == 'EF') {
if (vars.correct == 1) {
vars.ef_total_correct = ef_vars.total_correct + 1;
}
vars.ef_accuracy = vars.ef_total_correct / vars.total_trials;
}
```

This script requires that you have a variable (`vars.presented_pair` ) that codes what kind of trial you had and three different counter variables that keep track how often a participant correctly responded to a specific trial type. These three variables (one for each pair) have to be initialized in the beginning of every block or in the beginning of the experiment (depending on how often you want them to be reset). If this works, you can then use the variables `vars.ab_accuracy` etc. to compute the accuracy of each pair. Disclaimer: I have not tested this code and I am lousy in programming javascript. There is a fair chance it won't work, but given your goal, I am quite confident it can be implemented in this way.

Good luck,

Eduard