Multipliers and Feedback Response


Author
Message
raven
raven
Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)
Group: Forum Members
Posts: 36, Visits: 78
Hi Dave,

I would really appreciate if you can help me solve the following issue with my script.

It uses a list of multipliers at / items = (1, 1, -1) to set probabilities for the score to go up or down. However, it says "Guess was Correct" in the feedback screen after a trial had a multiplier of -1, but I want it to say "Guess was Incorrect" for -1 multipliers and "Guess was Correct" for +1 multipliers.

It reports the difference in the feedback screen correctly, so that's not an issue.

I've tried to add && values.multiplier = 1 to the condition in the first line of /ontrialend, so it becomes:  if (trial.trial1.correct && values.multiplier =1), but that doesn't seem to resolve the issue either.

The script is as follows:

<values>
/ score = 0
/ multiplier = 0
/ diff = 0
/ acc = ""
/ ncorrect = 0
/ n = 0
/ cx = 50%
</values>

<list prob>
/ items = (1, 1, -1)
/ selectionmode = random
/ replace = true
</list>

<trial trial1>
/ ontrialbegin = [    
    values.n += 1;
  values.ncorrect += trial.trial1.correct;
    
    values.multiplier = list.prob.nextvalue;
]
/ ontrialend = [
        if (trial.trial1.correct) {
        values.multiplier = list.prob.nextvalue;
   values.score += values.multiplier * 10;
        values.diff = 0;
        values.diff = values.multiplier * 10;
        values.acc = "Correct";
  }
    
    else {
        values.score += values.multiplier * 5;
        values.diff = 0;
        values.diff += values.multiplier * 5;
        values.acc = "Incorrect";
    }
    
]
/ stimulusframes = [1=stim, score]
/ inputdevice = keyboard
/ validresponse = ("z", "x")
/ correctresponse = ("z")
/ branch = [
    {
        trial.feedback
    }
]
</trial>

<text stim>
/ items = ("A", "E", "I", "O", "U")
/ hposition = values.cx
</text>

<list x>
/ items = (50%)
/ selectionrate = always
</list>

<trial feedback>
/ stimulusframes = [1=clearscreen, fb, score, diff, acc]
/ timeout = 3500
</trial>

<text fb>
/ items = ("Performance: <%values.ncorrect%> out of <%values.n%> trials correct.")
/ fontstyle = ("Arial", 21pt, true)
/ size = (80%, 10%)
/ erase = false
/ position = (50%, 85%)
</text>

<text diff>
/ items = ("Score changed by: <%values.diff%>")
/ fontstyle = ("Arial", 21pt, true)
/ position = (50%, 50%)
</text>

<text acc>
/ items = ("Guess was: <%values.acc%>")
/ fontstyle = ("Arial", 21pt, true)
/ color = black
/ size = (80%, 20%)
/ position = (50%, 35%)
</text>

<text score>
/ items = ("Score: <%values.score%>")
/ fontstyle = ("Arial", 21pt, true)
/ size = (80%, 20%)
/ erase = false
/ position = (50%, 75%)
</text>

<block start>
/ trials = [1-30 = trial1]
</block>

Your help will be much appreciated!

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 100K
raven - 7/24/2023
Hi Dave,

I would really appreciate if you can help me solve the following issue with my script.

It uses a list of multipliers at / items = (1, 1, -1) to set probabilities for the score to go up or down. However, it says "Guess was Correct" in the feedback screen after a trial had a multiplier of -1, but I want it to say "Guess was Incorrect" for -1 multipliers and "Guess was Correct" for +1 multipliers.

It reports the difference in the feedback screen correctly, so that's not an issue.

I've tried to add && values.multiplier = 1 to the condition in the first line of /ontrialend, so it becomes:  if (trial.trial1.correct && values.multiplier =1), but that doesn't seem to resolve the issue either.

The script is as follows:

<values>
/ score = 0
/ multiplier = 0
/ diff = 0
/ acc = ""
/ ncorrect = 0
/ n = 0
/ cx = 50%
</values>

<list prob>
/ items = (1, 1, -1)
/ selectionmode = random
/ replace = true
</list>

<trial trial1>
/ ontrialbegin = [    
    values.n += 1;
  values.ncorrect += trial.trial1.correct;
    
    values.multiplier = list.prob.nextvalue;
]
/ ontrialend = [
        if (trial.trial1.correct) {
        values.multiplier = list.prob.nextvalue;
   values.score += values.multiplier * 10;
        values.diff = 0;
        values.diff = values.multiplier * 10;
        values.acc = "Correct";
  }
    
    else {
        values.score += values.multiplier * 5;
        values.diff = 0;
        values.diff += values.multiplier * 5;
        values.acc = "Incorrect";
    }
    
]
/ stimulusframes = [1=stim, score]
/ inputdevice = keyboard
/ validresponse = ("z", "x")
/ correctresponse = ("z")
/ branch = [
    {
        trial.feedback
    }
]
</trial>

<text stim>
/ items = ("A", "E", "I", "O", "U")
/ hposition = values.cx
</text>

<list x>
/ items = (50%)
/ selectionrate = always
</list>

<trial feedback>
/ stimulusframes = [1=clearscreen, fb, score, diff, acc]
/ timeout = 3500
</trial>

<text fb>
/ items = ("Performance: <%values.ncorrect%> out of <%values.n%> trials correct.")
/ fontstyle = ("Arial", 21pt, true)
/ size = (80%, 10%)
/ erase = false
/ position = (50%, 85%)
</text>

<text diff>
/ items = ("Score changed by: <%values.diff%>")
/ fontstyle = ("Arial", 21pt, true)
/ position = (50%, 50%)
</text>

<text acc>
/ items = ("Guess was: <%values.acc%>")
/ fontstyle = ("Arial", 21pt, true)
/ color = black
/ size = (80%, 20%)
/ position = (50%, 35%)
</text>

<text score>
/ items = ("Score: <%values.score%>")
/ fontstyle = ("Arial", 21pt, true)
/ size = (80%, 20%)
/ erase = false
/ position = (50%, 75%)
</text>

<block start>
/ trials = [1-30 = trial1]
</block>

Your help will be much appreciated!

Oviously, this makes no sense if what you want is the feedback saying correct for positive and incorrect for negative multipliers



so that's what you need to change. Set values.acc on the basis of the multiplier value, not on the basis of the trial's correct property.
raven
raven
Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)
Group: Forum Members
Posts: 36, Visits: 78
Hi Dave,

Thanks for your reply.

I'm not sure how to do that other than using the if/else conditional statements.

Would you be able to give an example showing how I could set values.acc on the basis of the multiplier value in this instance?



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 100K
raven - 7/24/2023
Hi Dave,

Thanks for your reply.

I'm not sure how to do that other than using the if/else conditional statements.

Would you be able to give an example showing how I could set values.acc on the basis of the multiplier value in this instance?



Well, yes, of course you use if else statements, no different than those you already have. I'm having trouble understanding where the hang-up is.

You have the multiplier in values.multiplier. If it's less than 0, set values.acc to "Incorrect". Otherwise set it to "Correct".

<trial trial1>
/ ontrialbegin = [
    values.n += 1;
    values.multiplier = list.prob.nextvalue;
]
/ ontrialend = [
    values.ncorrect += trial.trial1.correct;
    
    if (trial.trial1.correct) {
        values.score += values.multiplier * 10;
        values.diff = 0;
        values.diff = values.multiplier * 10;
        if (values.multiplier < 0) {
            values.acc = "Incorrect";
        } else {
            values.acc = "Correct";
        };
    }
    else {
        values.score += values.multiplier * 5;
        values.diff = 0;
        values.diff += values.multiplier * 5;
        values.acc = "Incorrect";
    };
]
/ stimulusframes = [1=stim, score]
/ inputdevice = keyboard
/ validresponse = ("z", "x")
/ correctresponse = ("z")
/ branch = [
    return trial.feedback;
]
</trial>

Edited Last Year by Dave
raven
raven
Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)Respected Member (466 reputation)
Group: Forum Members
Posts: 36, Visits: 78
Thanks Dave, you've pointed me in the right direction, using nested if/else statements makes sense.

I will check the support docs for further details on nested expressions.

Much appreciated! :)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search