Constrained randomisation trouble


Author
Message
LMK
LMK
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 15, Visits: 5

Dear forum,


I’m a little trapped by a tricky design for a false memory experiment.  The issue is that I have 60 sets of 5 associates (e.g., ADD: subtract, sum, plus, multiply, maths), half of which will be presented randomly (i.e., any associate from any list can be presented as part of a 5 stimuli sequence before a textbox appears for recall), and half of which need to be presented as complete sets (i.e., “lists”)  in the sequence specified (e.g.,  1 = subtract, 2 =  sum, 3 = plus, 4 =  multiply, 5 = maths). Unfortunately, the sets that become “random” and those that become “lists” are ideally random too, however, to satisfy the constraints (the researchers would REALLY like for all stimuli to be presented to each participant, and NEVER to appear more than once) this assignment seems to need to be done at the beginning of the experiment.


For completeness, there is also a picture element. Specifically, the design is 2 (random, list) by 3 (no picture, matched picture, unmatched picture). This works fine.


So, I hit problems if I have “random” sequences presented first –because single items are chosen from too many whole sets (e.g., 10 random sequences can draw from 50 “lists”, leaving only 10 unsampled lists rather than the 30 needed) . This will be true for 50% of participant. I figure that if I could randomly assign sets to be used for “random” versus “lists”, I could fix this, but I can’t seem to work out how to do this (probably at the experiment level).  


The code is huge (and includes 300 images too) so I have left it out. Any suggestions on how this could be achieved would be GREATLY appreciated!


Thanks, Leah


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

You will have to use conditional logic to determine a given set's selection mode (random vs. list) and then sample from the set's items accordingly. Here's a simple example which should hopefully provide some pointers:


<values>
/ set1selectionmode = ""
/ set2selectionmode = ""
/ set1item = 0
/ set2item = 0
</values>

<counter setselectionmodes>
/ items = ("random", "list")
/ select = noreplace
/ selectionrate = always
</counter>

<expt>
/ onexptbegin = [values.set1selectionmode=counter.setselectionmodes.selectedvalue;
    values.set2selectionmode=counter.setselectionmodes.selectedvalue]
/ blocks = [1-2=noreplace(set1block, set2block)]
</expt>

<block set1block>
/ trials = [1-4=set1trial]
</block>

<block set2block>
/ trials = [1-4=set2trial]
</block>

<trial set1trial>
/ ontrialbegin = [if(values.set1selectionmode=="random")values.set1item=counter.set1random.selectedvalue else
    values.set1item=counter.set1sequence.selectedvalue]
/ stimulusframes = [1=set1]
/ validresponse = (57)
</trial>

<trial set2trial>
/ ontrialbegin = [if(values.set2selectionmode=="random")values.set2item=counter.set2random.selectedvalue else
    values.set2item=counter.set2sequence.selectedvalue]
/ stimulusframes = [1=set2]
/ validresponse = (57)
</trial>

<text set1>
/ items = set1items
/ select = values.set1item
</text>

<text set2>
/ items = set2items
/ select = values.set2item
</text>

<counter set1random>
/ select = noreplace(1-4)
</counter>

<counter set1sequence>
/ select = sequence(1-4)
</counter>

<counter set2random>
/ select = noreplace(1-4)
</counter>

<counter set2sequence>
/ select = sequence(1-4)
</counter>

<item set1items>
/ 1 = "1a"
/ 2 = "1b"
/ 3 = "1c"
/ 4 = "1d"
</item>

<item set2items>
/ 1 = "2a"
/ 2 = "2b"
/ 3 = "2c"
/ 4 = "2d"
</item>


Regards,


~Dave


LMK
LMK
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 15, Visits: 5

Dear Dave,


This looks great, and I think I get it..... but will have to wait until the weekend to try it out.  Just wanted to say thanks.


Cheers, Leah


LMK
LMK
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 15, Visits: 5

Dear Forum (Dave),


The above code works beautifully. I have filled in a subset of the 60 lists and it’s perfect. Unfortunately, it won’t let me use the cheat I had developed to assign the images, so having tried all the things I could think of, I’m stuck again!


So, following on from my previous message, I have successfully assigned each of my sets to a random versus sequence mode (using your code), so I am now trying to also set these to a picture mode (related, unrelated, none – using a shape). I have guessed that the / onexptbegin is the best option, using an empty item which I have tried to fill with the correct picture items.  Again, the tricky thing here is that if the pictures are “related” they should be linked (I have a counter with /select = current(related set), whereas if they are unrelated they can be anything from the set, presented without replacement). I’m not sure if it’s possible, but it seems like it would be.


I think the issue is that I don’t really know what I am doing (or can do) with / onexptbegin.



One last point, it would be ideal if this, like the random/list assignment was equal (i.e., of my 60 sets, 10 would be presented random with related pics, 10 would be presented random with UNrelated pics, 10 would be presented random without pics, 10 would be presented list with related pics, 10 would be presented list with UNrelated pics, 10 would be presented list without pics).



I would (again) appreciate any assistance. This time I have attached the subset of image (zipped folder) and script* I have been working with. I have uploaded these to my files. I didn’t find an option to attach it directly to this post.


Many thanks, Leah


*Note I have been working in phases so some bits of the script are in older phases.


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

You should first fix the various syntax issues in your <picture> elements' /items attribute. E.g.


<picture ballpic>
/ items = (1 = "bounce.jpg",2 = "soccer.jpg",3 = "bat.jpg",4 = "throw.jpg",5 = "round.jpg")
[...]
</picture>


is wrong. Correct syntax would be


<picture ballpic>

/ items = ("bounce.jpg","soccer.jpg","bat.jpg","throw.jpg","round.jpg")

[...]

</picture>


Unfortunately you didn't include all required pics, so your script can't be run. Regardless, very much the same strategies as outlined previously should apply: Assign the correct type of picture to each set based on conditional logic. See e.g. https://www.millisecond.com/forums/Topic3960.aspx for one way to do such things with pics.


Regards,


~Dave


LMK
LMK
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 15, Visits: 5

Dave,


Thanks for the super quick response again.


I have had a look at https://www.millisecond.com/forums/Topic3960.aspx  and tried to download DynamicPictureLoading.zip but keep getting the message "The Compressed (zipped) Folder is invalid or corrupted." when downloading or attempting to extract.


Is there any way I could access just the example script (without the .zip)?


Cheers, Leah



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

The respective zip file downloads and extracts perfectly fine for me -- I'm re-attaching it here.


Attachments
DynamicPictureLoading.zip (702 views, 149.00 KB)
LMK
LMK
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 15, Visits: 5

Dear  Dave,


I'm still having trouble which must mean its an issue of an old PC. I will try again from work tomorrow.


Thanks, Leah


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

Weird. Anyway, I'm pasting the syntax from the respective script below for reference:


### Some initialization
<defaults>
/ screencolor = (255, 255, 255)
/ inputdevice = keyboard
</defaults>


### Counter to select one of the pictures in the sets ITEM_male and ITEM_female
<counter COUNTER_pic>
/ items = (1, 2, 3)
/ select = noreplace
/ selectionrate = trial
</counter>


### Counter to select the gender of the picture to be displayed
<counter COUNTER_gender>
/ items = (0, 1)
/ select = noreplace
/ selectionrate = trial
</counter>


### Items with the file names of the pictures to be displayed
<item ITEM_male>
/ 1 = "..\pic\img_male_asia_001.gif"
/ 2 = "..\pic\img_male_blac_001.gif"
/ 3 = "..\pic\img_male_cauc_001.gif"
</item>

<item ITEM_female>
/ 1 = "..\pic\img_feml_asia_001.gif"
/ 2 = "..\pic\img_feml_blac_001.gif"
/ 3 = "..\pic\img_feml_cauc_001.gif"
</item>


### Picture stimuli referring to the just declared picture file names
### These stimuli won't be needed anywhere else in the script but
### are mandatory to have Inquisit preload and store the picture
### files at startup.
<picture PIC_male>
/ items = ITEM_male
</picture>

<picture PIC_female>
/ items = ITEM_female
</picture>


### The canvas picture that will be used to display any given
### picture during a trial. The key concept is the empty item
### which will be loaded with the file name of the picture to
### be displayed.
<item ITEM_canvas>
</item>

<picture PIC_canvas>
/ items = ITEM_canvas
/ position = (50, 50)
/ transparentcolor = (255, 255, 255)
</picture>


### This is where the magic happens. First, the canvas item is
### cleared from the picture file name assigned to it during the
### previous trial. Then, a new picture file name is loaded into
### the canvas item depending on the gender counter.
### The canvas picture is finally processed by Inquisit. It will
### find the just loaded picture file name in the canvas item
### and display the according picture.
<trial TRIAL_showall>
/ ontrialbegin = [clear(item.ITEM_canvas)]
/ ontrialbegin = [if(counter.COUNTER_gender.selectedvalue==0)
                             {item.ITEM_canvas.item=getitem(item.ITEM_male,counter.COUNTER_pic.selectedvalue)}
                           else
                             {item.ITEM_canvas.item=getitem(item.ITEM_female,counter.COUNTER_pic.selectedvalue)}]
/ validresponse = (anyresponse)
/ responseinterrupt = trial
/ stimulusframes = [1 = PIC_canvas]
</trial>


### Block to repeat the trial
<block BLOCK_showall>
/ trials = [1-10 = TRIAL_showall]
</block>


### Experiment
<expt>
/ blocks = [1 = BLOCK_showall]
</expt>


Regards,


~Dave


LMK
LMK
Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)Distinguished Member (2.6K reputation)
Group: Forum Members
Posts: 15, Visits: 5

Dave,


Greatly appreciated! 


Thanks, Leah


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search