How can I vary assignment of item elements to trial elements?


Author
Message
Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Hi


I want to vary which items get assigned to different trials between subjects (to counterbalance items across conditions). So I have a set of items called PairA, a set of items called PairB, etc. Then I have different types of trials, say Study4X1, Study 8X1, etc. I want subject 1 to see the PairA items in Study4X1 and PairB items in Study8X1, and the reverse for the next subject, PairB in Study4X1 and PairA in Study8X. In the actual experiment there will be more sets of items and types of trials. How can I set which items to use at the beginning of the experiment? I've tried the code below, but then it presents "item.pairA" literally, instead of sampling items from item.pairA. 

<text shortpair>
/select = noreplace
/position = (45%, 40%)
/txcolor = (0, 0, 0)
/txbgcolor = (192, 192, 192)
</text>

<trial trial1sec>
/stimulustimes =[0=shortpair]
/pretrialpause = 200
/posttrialpause = 200
/trialduration = 1000
</trial>

<block study4x1>
/trials = [1-80 = noreplace(trial1sec)]
/preinstructions = (intro4x1)
</block>

<expt >
/blocks = [1=study4x1; 2=somblock]
/onexptbegin = [text.shortpair.item=item.pairA]
/preinstructions = (welcome)
/postinstructions = (endexp)
</expt>


Can anyone help me or point me to a good example in the task library?


Thanks,

Diane

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: 13K, Visits: 108K
You can use the <variables> element to do that:

<block myblock>
/ trials = [1-8=noreplace(lefttrial, righttrial)]
</block>

<variables>
/ group = (1 of 2) (leftitems = aitems, rightitems = bitems)
/ group = (2 of 2) (leftitems = bitems, rightitems = aitems)
/ groupassignment = groupnumber
</variables>

<trial lefttrial>
/ stimulusframes = [1=lefttext]
/ validresponse = (57)
</trial>

<trial righttrial>
/ stimulusframes = [1=righttext]
/ validresponse = (57)
</trial>

<text lefttext>
/ items = leftitems
/ position = (25%, 50%)
</text>

<text righttext>
/ items = rightitems
/ position = (75%, 50%)
</text>

<item aitems>
/ 1 = "A1"
/ 2 = "A2"
/ 3 = "A3"
/ 4 = "A4"
</item>

<item bitems>
/ 1 = "B1"
/ 2 = "B2"
/ 3 = "B3"
/ 4 = "B4"
</item>


Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Thanks!

This solves my problem, but then I ran into the next problem, which is an error message on the openended element below. I think the error is in the expression "item.shorttarget.item(text.shortcuetext.currentindex)". I thought "shorttarget" would be replaced by targetA because of the variables element, but it seems not.

<variables>
/ group = (1 of 2) (shortcue = cueA, shortpair = pairA, shorttarget = targetA)
/ group = (2 of 2) (shortcue = cueB, shortpair = pairB, shorttarget = targetB)
/ groupassignment = groupnumber
</variables>


<openended cuedrecall>
/stimulustimes =[0=shortcuetext]
/ inputdevice = keyboard
/ buttonlabel = "Type your answer and press ENTER"
/iscorrectresponse = [openended.cuedrecall.response == item.shorttarget.item(text.shortcuetext.currentindex)]
/posttrialpause = 200
/required = true
</openended>

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: 13K, Visits: 108K
No, the <variables> element substitutes elements, but not element properties or member functions. It is imperfect in that sense. You should look for another way to retrieve the information you require.

Edited 11 Years Ago by Dave
Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Rather than using the variables element to assign item sets to text elements based on subject number, as you showed in your earlier response, I could try to write item sets to empty item elements (again based on subject number) so that I can then use those item elements. I've tried to find this on the forum, and I've seen references to it, but I can't find the examples. Could you point me to an example of how to write a set of items to an empty item element, and how to do that based on subject number?


Thanks!

Diane

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: 13K, Visits: 108K
> Could you point me to an example of how to write a set of items to an empty item element [...]?

Sure. https://encrypted.google.com/#q=empty+%3Citem%3E+element+site:millisecond.com%2Fforums should give you numerous examples to pick from.

> how to do that based on subject number?

Conditional logic via /onexptbegin or the like. Retrieve the script.subjectid property, compute its mod(), assign items accordingly.

But: None of that should be necessary. The <variables> approach should still be workable, but may require a couple of tweaks. If can provide a simple, stripped-down, self-contained (i.e., runnable) example that accurately reflects the relevant aspects of your procedure, I can most likely show you how to make it work. Can't do that based on the bunch of extant code snippets, though. Too many unknowns.

Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Thanks so much!

Here's a bare experiment, I've removed all instructions etc.

Diane

Attachments
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: 13K, Visits: 108K
You should be able to simply do

<openended cuedrecallshort>
/stimulustimes =[0=shortcuetext]
/ inputdevice = keyboard
/ buttonlabel = "Type your answer and press ENTER"
/iscorrectresponse = [openended.cuedrecallshort.response == text.shorttargettext.item(text.shortcuetext.currentindex)]
/posttrialpause = 200
/required = true
</openended>

<openended cuedrecalllong>
/stimulustimes =[0=shortcuetext]
/ inputdevice = keyboard
/ buttonlabel = "Type your answer and press ENTER"
/iscorrectresponse = [openended.cuedrecalllong.response == text.longtargettext.item(text.longcuetext.currentindex)]
/posttrialpause = 200
/required = true
</openended>

Diane
Diane
Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)Distinguished Member (4.4K reputation)
Group: Forum Members
Posts: 53, Visits: 131
Perfect, this is exactly what I needed. Thank you so much!

Diane

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search