Messing With Branch/ontrialend/stop attributes


Author
Message
cgoetz
cgoetz
Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)Esteemed Member (1.5K reputation)
Group: Forum Members
Posts: 7, Visits: 1

Hi,


So i'm currently trying to write a script for a test in which I present a pattern image with a missing square, and subjects pick the right square which completes the pattern. I've gotten the images to load with the proper positioning and mouse click responses displaying correct/incorrect.


The trick here, however, is that I need to code the stop cue, which occurs when the subject gets 3 out of the last 5 answers incorrect. 


Here's how I have it set up:


Each trial is one question with 5 different answer options. There's currently one block which dictates all these trials to run in order, and the experiment dictates the one block to run. 


To try and solve the scoring issue, I've tried several things:



  1. Coding /branch [if (trial.a25.correct + trial.a26.correct +trial.a27.correct + trial.a28.correct + trial.a29.correct <= 2) trial.endtrial] into trials. This should theoretically count the last 5 answers (#25-29), and if the subject gets only 2 or less right (3 wrong), it would branch to the last trial trial.endtrial. No good.

  2. Coding /ontrialend [if (trial.a25.correct + trial.a26.correct +trial.a27.correct + trial.a28.correct + trial.a29.correct <= 2) trial.endtrial] into trials. Similar result.

  3. Coding /stop [trial.a25.correct + trial.a26.correct +trial.a27.correct + trial.a28.correct + trial.a29.correct <= 2] into block. I believe this similarly didn't stop the block. 

  4. Coding /stop [trial.a25.correct + trial.a26.correct +trial.a27.correct + trial.a28.correct + trial.a29.correct <= 2] into expt. This simply stopped the experiment before a single trial was run.

  5. Coding /branch [if (trial.a25.correct + trial.a26.correct +trial.a27.correct + trial.a28.correct + trial.a29.correct <= 2) page.end] to see if it would jump to an end page after catching the branch, but no good.

  6. Coding /branch [if (trial.a25.correct + trial.a26.correct +trial.a27.correct + trial.a28.correct + trial.a29.correct <= 2) block.endblock] to see if it would jump to an end block after catching the branch, but no good.


Any advice would be lovely, as I'm at my wit's end here trying to figure out how to make this work. I've considered the possibility of creating some sort of vector measurement that would automatically take the last 5 recorded answers and check if percent correct is less than 40%, but I don't know how to code that.



Here are some example codes:



<expt exptest3>


/preinstructions = (intro, getready)


/postinstructions = (end)


/blocks = [1=block1]   


</expt>



<block block1>


/ trials = [1=A20,A21,A22,A23,A24,A25,A26,A27,A28,A29]


</block>



<trial A25>


/ showmousecursor = true


/validresponse = (A25.1,A25.2,A25.3,A25.4,A25.5,A25.6)


/correctresponse = (A25.5)


/ stimulusframes = [1=A25.big; 2=A25.1,A25.2,A25.3,A25.4,A25.5,A25.6]


/errormessage = true(error, 300)


</trial>




Thanks!


Calvin




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: 97K

And here's a quick example of one way to do it via a bit of conditional logic (there are many more options):


<values>
/ responsevector = ""
</values>

<block myblock>
/ stop = [contains(values.responsevector, "0000")]
/ trials = [1-20=mytrial]
</block>

<trial mytrial>
/ ontrialend = [values.responsevector=concat(values.responsevector,trial.mytrial.correct)]
/ stimulusframes = [1=debug]
/ validresponse = ("d", "k")
/ correctresponse = ("d")
</trial>

<text debug>
/ items = ("<%values.responsevector%>")
</text>


And, as an extension of the above, let's consider only the 5 most recent trials and check if incorrect responses occurred in 3 or more:


<values>
/ responsevector = "-----"
</values>

<block myblock>
/ stop = [length(values.responsevector)-length(replaceall(values.responsevector, "0", ""))>=3]
/ trials = [1-20=mytrial]
</block>

<trial mytrial>
/ ontrialend = [values.responsevector=concat(values.responsevector,trial.mytrial.correct);
    values.responsevector=substring(values.responsevector, length(values.responsevector)-5, length(values.responsevector))]
/ stimulusframes = [1=debug]
/ validresponse = ("d", "k")
/ correctresponse = ("d")
</trial>

<text debug>
/ items = ("<%values.responsevector%>")
</text>


Regards,


~Dave


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search