sampling without replacement across blocks?


Author
Message
aghartley
aghartley
Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)Distinguished Member (3.3K reputation)
Group: Awaiting Activation
Posts: 16, Visits: 127
Hello,

I am running an experiment that shows picture stimuli that the participants need to guess the outcome for an incentive (earning money). For example, participants see a picture of someone and needs to guess whether they are left handed or right handed. If they guess right, they receive $.10.

There are at least three blocks of trials in this experiment (the money incentive amount changes for each block). The program selects picture stimuli from an item element that contains all of the pictures. I wrote the code for the picture element to use these items, setting "select" to noreplace. In the resulting experiment, this works well within each block, selecting randomly from the pictures without replacement, but then resets when it gets to the next block of trials. However, I need it to sample without replacement across all blocks. Is there a way to write the code, or maybe use a more simple setting so that the code samples without replacement across all blocks? I've included the code below.

Thanks very much!

Anna.



*********************************************************************
DEFAULT SETTINGS
*********************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ canvasaspectratio = (4,3)
/ minimumversion = "4.0.0.0"
/ screencolor = (grey)
/ fontstyle = ("Gill Sans MT", 3.0%, true, false, false, false, 5, 0)
/ txbgcolor = (transparent)
/ txcolor = (black)
/ inputdevice = keyboard
</defaults>
*********************************************************************

*******************************
MONEY EARNED
*******************************

<values moneyparams>
/ balance_total = 0
/ prevtotal = 0
/ currency = "$"
/ gainincentive = .15
/ loseincentive = .05
/ correctguess = 0
/ correctguessIn = 0
/ correctguessDis = 0
</values>

<expressions>
/ NoInPercentCorr = percentcorrect(trial.targetAguessNo, trial.targetBguessNo, trial.targetCguessNo)
/ InPercentCorr = percentcorrect(trial.targetAguessIn, trial.targetBguessIn, trial.targetCguessIn)
/ DnPercentCorr = percentcorrect(trial.targetAguessDis, trial.targetBguessDis, trial.targetCguessDis)
</expressions>


<data Outcomes>
/ file = "Outcomes_raw.iqdat"
/ columns = [date time subject blockcode blocknum trialcode trialnum response correct latency stimulusnumber stimulusitem stimulusnumber stimulusitem values.correctguessIn
values.correctguessDis values.correctguess expressions.NoInPercentCorr expressions.inpercentcorr expressions.dnpercentcorr]
/ separatefiles = true
</data>

********************
STIMULI
********************
<item targetAlabel>
/1 = "Is this person right-handed or left-handed?"
</item>

<item targetAhand>
/ 1 = "This person is right-handed."
/ 2 = "This person is left-handed."
</item>

****GUESS RIGHT OR LEFT HANDED

<item targetA>
/1 = "righthanded1.jpg"
/2 = "righthanded2.jpg"
/3 = "righthanded3.jpg"
/4 = "righthanded4.jpg"
/5 = "righthanded5.jpg"
/6 = "lefthanded6.jpg"
/7 = "lefthanded7.jpg"
/8 = "lefthanded8.jpg"
/9 = "lefthanded9.jpg"
/10 = "lefthanded15.jpg"
/11 = "righthanded6.jpg"
/12 = "righthanded7.jpg"
/13 = "righthanded8.jpg"
/14 = "righthanded9.jpg"
/15 = "righthanded10.jpg"
/16 = "lefthanded1.jpg"
/17 = "lefthanded2.jpg"
/18 = "lefthanded3.jpg"
/19 = "lefthanded4.jpg"
/20 = "lefthanded5.jpg"
/21 = "righthanded11.jpg"
/22 = "righthanded12.jpg"
/23 = "righthanded13.jpg"
/24 = "righthanded14.jpg"
/25 = "righthanded15.jpg"
/26 = "lefthanded10.jpg"
/27 = "lefthanded11.jpg"
/28 = "lefthanded12.jpg"
/29 = "lefthanded13.jpg"
/30 = "lefthanded14.jpg"
</item>



****GUESS DIAMOND OR CUBIC ZIRCONIUM
<item targetB>
/1 = "CubicZirconium1.jpg"
/2 = "CubicZirconium2.jpg"
/3 = "CubicZirconium3.jpg"
/4 = "CubicZirconium4.jpg"
/5 = "CubicZirconium5.jpg"
/6 = "CubicZirconium6.jpg"
/7 = "CubicZirconium7.jpg"
/8 = "CubicZirconium8.jpg"
/9 = "CubicZirconium9.jpg"
/10 = "CubicZirconium10.jpg"
/11 = "CubicZirconium11.jpg"
/12 = "CubicZirconium12.jpg"
/13 = "CubicZirconium13.jpg"
/14 = "CubicZirconium14.jpg"
/15 = "CubicZirconium15.jpg"
/16 = "Diamond1.jpg"
/17 = "Diamond2.jpg"
/18 = "Diamond3.jpg"
/19 = "Diamond4.jpg"
/20 = "Diamond5.jpg"
/21 = "Diamond6.jpg"
/22 = "Diamond7.jpg"
/23 = "Diamond8.jpg"
/24 = "Diamond9.jpg"
/25 = "Diamond10.jpg"
/26 = "Diamond11.jpg"
/27 = "Diamond12.jpg"
/28 = "Diamond13.jpg"
/29 = "Diamond14.jpg"
/30 = "Diamond15.jpg"
</item>

<item targetBdiamond>
/ 1 = "This is a diamond."
/ 2 = "This is cubic zirconium."
</item>

***GUESS REAL OR FAKE PAINTING

<item targetC>
/1 = "RealPainting1.jpg"
/2 = "RealPainting2.jpg"
/3 = "RealPainting3.jpg"
/4 = "RealPainting4.jpg"
/5 = "RealPainting5.jpg"
/6 = "RealPainting6.jpg"
/7 = "RealPainting7.jpg"
/8 = "RealPainting8.jpg"
/9 = "RealPainting9.jpg"
/10 = "RealPainting10.jpg"
/11 = "RealPainting11.jpg"
/12 = "RealPainting12.jpg"
/13 = "RealPainting13.jpg"
/14 = "RealPainting14.jpg"
/15 = "RealPainting15.jpg"
/16 = "FakePainting1.jpg"
/17 = "FakePainting2.jpg"
/18 = "FakePainting3.jpg"
/19 = "FakePainting4.jpg"
/20 = "FakePainting5.jpg"
/21 = "FakePainting6.jpg"
/22 = "FakePainting7.jpg"
/23 = "FakePainting8.jpg"
/24 = "FakePainting9.jpg"
/25 = "FakePainting10.jpg"
/26 = "FakePainting11.jpg"
/27 = "FakePainting12.jpg"
/28 = "FakePainting13.jpg"
/29 = "FakePainting14.jpg"
/30 = "FakePainting15.jpg"
</item>

<item targetCpainting>
/ 1 = "The painting is authentic."
/ 2 = "The painting is a fake."
</item>


*****************
INSTRUCTION PAGES
*****************

<instruct>
/ nextlabel = "Enter"
/ lastlabel = "Enter"
/ inputdevice = keyboard
/ nextkey = (26)
/ prevkey = (0)
/ windowsize = (90%, 90%)
/ screencolor = (grey)
/ fontstyle = ("Gill Sans MT", 3%)
/ txcolor = (black)
</instruct>

<page summary>
^Thank you for your participation. Please press 'Enter' to end the task.
</page>

--------------------------------------------------------------------------------------------------------
***********************************************************************
Task instruction stimuli
***********************************************************************

<counter instructions>
/ resetinterval = 20
/ select = sequence(1, 2, 3, 4, 5, 6, 7)
</counter>

<trial instructions>
/ stimulustimes = [1=instructions, spacebar]
/ correctresponse = (" ")
/ errormessage = false
/ recorddata = false
</trial>

<text instructions>
/ items = instructions
/ hjustify = center
/ size = (90%, 60%)
/ position = (50%, 85%)
/ valign = bottom
/ select = instructions
/ fontstyle = ("Gill Sans MT", 3.5%)
</text>

<item instructions>
/ 1 = "In this task you will make a series of predictions. You can win up to $3.00. If you correctly predict the outcome, press the 'C' key on your keyboard. Otherwise, press the Space Bar.

We will indicate to you when correctly guessing the outcome allows you to earn money or when it forces you to lose money."

/ 2 = "This task will show faces of right-handed and left-handed people. Predict whether each person is left-handed or right-handed."

/ 3 = "The next task will show pictures of cubic zirconium and diamonds.
Predict whether each stone is a cubic zirconium or a diamond."

/ 4 = "The next task will show authentic and faked famous paintings.
Predict whether each painting is a real, authentic painting or a fake."
</item>

************************************
Location of stimuli and instructions
************************************

<text spacebar>
/ items = ("Press the SPACE BAR to begin.")
/ position = (50%, 95%)
/ valign = bottom
/ fontstyle = ("Gill Sans MT", 3.5%)
</text>

<text targetAlabel>
/ items = ("Is this person left-handed or right-handed?")
/ size = (50%, 25%)
/ position = (50%, 25%)
</text>

<picture targetA>
/ items = targetA
/ size = (40%, 40%)
/ position = (50%, 40%)
/ select = noreplace
</picture>

<text targetAhand>
/ items = targetAhand
/ size = (50%, 50%)
/ position = (50%, 70%)
/ txcolor = (153, 0, 76)
</text>

<text targetBlabel>
/ items = ("Is this Cubic Zirconium or Diamond?")
/ size = (50%, 25%)
/ position = (50%, 25%)
</text>

<picture targetB>
/ items = targetB
/ size = (40%, 40%)
/ position = (50%, 40%)
/ select = noreplace
</picture>

<text targetBdiamond>
/ items = targetBdiamond
/ size = (50%, 50%)
/ position = (50%, 70%)
/ txcolor = (153, 0, 76)
</text>

<text targetClabel>
/ items = ("Is this an authentic painting or a fake painting?")
/ size = (50%, 25%)
/ position = (50%, 25%)
</text>

<text targetCpainting>
/ items = targetCpainting
/ size = (50%, 50%)
/ position = (50%, 70%)
/txcolor = (51, 0, 102)
</text>

<picture targetC>
/ items = targetC
/ size = (40%, 40%)
/ position = (50%, 40%)
/ select = noreplace
</picture>

<text nexttask>
/ items = ("Please continue on to the next task.")
/position = (50, 50)
/txcolor = (0, 0, 0)
</text>

<text incentive>
/ items = ("In the following 10 events, you will gain 15 cents for every correct prediction")
/size = (50%, 50%)
/position = (50, 70)
/txcolor = (0, 0, 0)
</text>

<text disincentive>
/ items = ("For the following 10 events, you will lose 5 cents for every correct prediction")
/size = (50%, 50%)
/position = (50, 70)
/txcolor = (0, 0, 0)
</text>

<text noincentive>
/ items = ("For the following 10 events, you will receive no monetary reward for correct predictions")
/size = (50%, 50%)
/position = (50, 70)
/txcolor = (0, 0, 0)
</text>

<text getready>
/ items = ("(Have your prediction ready!)")
/position = (50%, 70%)
/txcolor = (255, 0, 0)
/ fontstyle = ("Gill Sans MT", 3.5%)
</text>

<text predcorrect>
/ items = ("Press 'C' if your prediction was correct. Otherwise, press the space bar.")
/ position = (50, 75)
/ txcolor = (255, 0, 0)
/ fontstyle = ("Gill Sans MT", 4%)
</text>

<text balance_total>
/ items = ("<%values.currency%> <%values.balance_total%> ")
/ fontstyle = ("Verdana", 4.0%, true, false, false, false, 5, 0)
/ halign = left
/ hjustify = center
/ vjustify = center
/ size = (25%, 10%)
/ position = (80%, 16%)
/ txcolor = (green)
/ txbgcolor = (black)
/ erase = false
</text>

<text currentbalance>
/ items = ("Current Balance")
/ halign = left
/ hjustify = left
/ size = (25%, 5%)
/ position = (82%, 8%)
/ erase = false
</text>

--------------------------------------------------------------------------------------------------
***********************************************************************
Trials
***********************************************************************

<trial incentive>
/ validresponse = (" ")
/ correctresponse = (" ")
/ stimulusframes = [1 = incentive, currentbalance, balance_total, spacebar]
/posttrialpause = 250
</trial>

<trial disincentive>
/ validresponse = (" ")
/ correctresponse = (" ")
/ stimulusframes = [1 = disincentive, currentbalance, balance_total, spacebar]
/posttrialpause = 250
</trial>

<trial noincentive>
/ validresponse = (" ")
/ correctresponse = (" ")
/ stimulusframes = [1 = noincentive, currentbalance, balance_total, spacebar]
/posttrialpause = 250
</trial>

<trial getready>
/ validresponse = (" ")
/ correctresponse = (" ")
/ stimulusframes = [1 = getready, currentbalance, balance_total, spacebar]
/posttrialpause = 250
</trial>

************************************
Target A
************************************
<trial targetA>
/ validresponse = (" ")
/ stimulusframes = [1 = targetA, targetAlabel, currentbalance, balance_total, getready, spacebar]
/ posttrialpause = 250
</trial>

<trial targetAguessNo>
/ ontrialend = [if (trial.targetAguessNo.response == 46) values.balance_total = 0]
/ ontrialend = [if (trial.targetAguessNo.response == 57) values.balance_total = 0]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetAhand, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

<trial targetAguessIn>
/ ontrialend = [if (trial.targetAguessIn.response == 46) values.balance_total += .15]
/ ontrialend = [if (trial.targetAguessIn.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetAhand, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

<trial targetAguessDis>
/ ontrialend = [if (trial.targetAguessDis.response == 46) values.balance_total -= .05]
/ ontrialend = [if (trial.targetAguessDis.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetAhand, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

************************************
target B
************************************
<trial targetBlabel>
/ validresponse = (" ")
/ stimulusframes = [1 = targetBlabel, targetB, getready, currentbalance, balance_total, spacebar]
</trial>

<trial targetBguessNo>
/ ontrialend = [if (trial.targetBguessNo.response == 46) values.balance_total = values.balance_total]
/ ontrialend = [if (trial.targetBguessNo.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetBdiamond, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

<trial targetBguessIn>
/ ontrialend = [if (trial.targetBguessIn.response == 46) values.balance_total += .15]
/ ontrialend = [if (trial.targetBguessIn.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetBdiamond, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

<trial targetBguessDis>
/ ontrialend = [if (trial.targetBguessDis.response == 46) values.balance_total -= .05]
/ ontrialend = [if (trial.targetBguessDis.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetBdiamond, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

************************************
target C
************************************

<trial targetClabel>
/ validresponse = (" ")
/ stimulusframes = [1 = targetClabel, targetC, getready, currentbalance, balance_total, spacebar]
</trial>

<trial targetCguessNo>
/ ontrialend = [if (trial.targetCguessNo.response == 46) values.balance_total = values.balance_total]
/ ontrialend = [if (trial.targetCguessNo.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetCpainting, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

<trial targetCguessIn>
/ ontrialend = [if (trial.targetCguessIn.response == 46) values.balance_total += .15]
/ ontrialend = [if (trial.targetCguessIn.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetCpainting, currentbalance, balance_total]
/ posttrialpause = 250
</trial>

<trial targetCguessDis>
/ ontrialend = [if (trial.targetCguessDis.response == 46) values.balance_total -= .05]
/ ontrialend = [if (trial.targetCguessDis.response == 57) values.balance_total = values.balance_total]
/ ontrialend = [values.balance_total=max(0,values.balance_total)]
/ validresponse = (" ", "c")
/ correctresponse = ("c")
/ stimulusframes = [1 = predcorrect, targetCpainting, currentbalance, balance_total]
/ posttrialpause = 250
</trial>


****************************************************************

<trial nexttask>
/stimulusframes = [1=nexttask, currentbalance, balance_total]
/validresponse = (" ")
/recorddata= false
</trial>

****************************************************************

****************************************************************
Blocks
****************************************************************

<block targetAnoincentive>
/ trials = [1-2=instructions; 3 = noincentive; 4-14 = sequence(targetA, targetAguessNo)]
/ recorddata = true
</block>

<block targetAincentive>
/ trials = [1=incentive; 2-12 = sequence(targetA, targetAguessIn)]
/ recorddata = true
</block>

<block targetAdisincentive>
/ trials = [1=disincentive;2-12 = sequence(targetA, targetAguessDis); 4=nexttask]
/ recorddata = true
</block>

********************************
********************************

<block targetBnoincentive>
/ trials = [1=instructions; 2 = noincentive; 3-13 = sequence(targetBlabel, targetBguessNo)]]
/ recorddata = true
</block>

<block targetBincentive>
/ trials = [1=incentive;2-12 = sequence(targetBlabel,targetBguessIn)]
/ recorddata = true
</block>

<block targetBdisincentive>
/ trials = [1=disincentive;2-12 = sequence(targetBlabel, targetBguessDis); 4=nexttask]
/ recorddata = true
</block>

********************************
********************************

<block targetCnoincentive>
/ trials = [1=instructions; 2 = noincentive; 3-13 = sequence(targetClabel, targetCguessNo)]]
/ recorddata = true
</block>

<block targetCincentive>
/ trials = [1=incentive;2-12 = sequence(targetClabel,targetCguessIn)]
/ recorddata = true
</block>

<block targetCdisincentive>
/ trials = [1=disincentive;2-12 = sequence(targetClabel, targetCguessDis)]
/ recorddata = true
</block>

***********************************************************************
Experiment
***********************************************************************

<expt>
/ blocks = [1=targetAnoincentive; 2=targetAincentive; 3=targetAdisincentive;
4=targetBnoincentive; 5=targetBincentive; 6=targetBdisincentive; 7=targetCnoincentive; 8=targetCincentive;
9=targetCdisincentive]
/ postinstructions = (summary)
</expt>



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Reading This Topic

Explore
Messages
Mentions
Search