URL of experiment: https://run.pavlovia.org/oztel/new_global_probfb/html
Description of the problem:
hi,
I am building an experiment where apply a kind of a yoking procedure. My task is a temporal reproduction task where participants receive a feedback regarding the direction of their deviation of the temporal reproduction from a target duration (“short” or “long”,basically).
I am trying to yoke the probability of “short” and “long” feedback appearance to the proportion of correct responses from a previous experiment that i collected data from. So, the congruency of the feedback to be received is defined by the proportion correct of some previous participant (i.e., for example if the correct proportion of the previous participant in “short” response is 0.8, the current participant should receive 80% “short” feedback whenever they make a short reproduction, and 20% “long” feedback whenever they make a short reproduction).
I have an array of correct proportion named “complete_list”. I am retrieving data from that list according to the participant ID
part_no = parseInt(expInfo["participant"]);
via the following line:
correct_probs = complete_list[(part_no - 1)];
where the 0th element of correct_probs is the proportion of correct “long” judgements and 1st of it is the proportion correct “short” of the part_no’th participant in the previous experiment:
long_prob = correct_probs[0];
short_prob = correct_probs[1];
I define these in “experimentInit” section.
In the end of the routine where participants perform the reproduction, I do this to define which feedback the participant will receive:
(i is the number of trial, “KISA” means “short” basically and “UZUN” is long. “reproOffset.rt” is the reproduced duration by the participant. 2 seconds is the target duration. from 10th trial forward, I give feedback according to the zscore of the reproduction).
if ((i < 10)) {
if ((reproOffset.rt < 2)) {
rand_prob = Math.random();
if ((rand_prob < short_prob)) {
feedback_text = "KISA";
} else {
feedback_text = "UZUN";
}
} else {
if ((reproOffset.rt > 2)) {
rand_prob = Math.random();
if ((rand_prob < long_prob)) {
feedback_text = "UZUN";
} else {
feedback_text = "KISA";
}
}
}
} else {
zRepro = arr.zscore(allRepro);
if ((zRepro[i] < 0)) {
rand_prob = Math.random();
if ((rand_prob < short_prob)) {
feedback_text = "KISA";
} else {
feedback_text = "UZUN";
}
psychoJS.experiment.addData("zRepro_1", zRepro[i]);
} else {
if ((zRepro[i] > 0)) {
rand_prob = Math.random();
if ((rand_prob < long_prob)) {
feedback_text = "UZUN";
} else {
feedback_text = "KISA";
}
}
}
psychoJS.experiment.addData("zRepro_1", zRepro[i]);
}
i += 1;
in the beginning of feedback routine, I have:
testFeedback_Text.setText((('Üretiminiz hedef süreye kıyasla ' + feedback_text) + ' idi.'));
where feedback_text is pasted in the sentence.
So according to my code, I should see a feedback like “Üretiminiz hedef süreye kıyasla KISA (or UZUN) idi”, but instead I see this text “Üretiminiz hedef süreye kıyasla undefined idi”.
I declared all the variables with “var” statement and I set the feedback text to be set every repeat (not constant).
I tried moving the definition of variables to the routine end of reproduction as well but nothing has changed.
I have been working on this code for about 10 days now and I couldnt figure out whats happening actually. I created another experiment where I do exactly the same thing where I see the KISA and UZUN words instead of an “undefined” but that code always gives incongruent feedback regardless of the proportions I define (and it reads the probabilities correctly).
I am inserting its link too: https://run.pavlovia.org/oztel/global_probabilisticfb/html
PS: all works fine locally in psychopy Builder.
I know that it sounds a bit complicated but any help would be much appreciated
thanks so much in advance, tutku