Hello,
I'm trying to use lists to randomize trial type and--within each trial type--its parameters, inspired by the post below (made to the Inquisit 5 forum -- I'm assuming the sample-code works in Inquisit 6 but of course could be wrong!).
https://forums.millisecond.com/Topic40813.aspx?Keywords=randomize%20listBecause there are two trial types: YOU and OTHER, and there will be 12 trials of each type, within onBlockBegin I sampled from another list with items "YOU" and "OTHER" which has poolsize=24, selectionmode=random, selectionrate=always (see the code below).
Additionally, within each trial type, trials can be assigned one out of 12 different parameters. To do that, within onBlockBegin, I sampled from two other lists containing the parameters (poolsize=12, replace=false, selectionmode=random, selectionrate=always).
However, when I try to run the code I'm getting the following message:
Object 'list.you_eff_rewlist.appenditem(list.eff_rew_you.nextvalue)list.you_eff_rewlist' was not found.
I suspect it has something to do with the way I sample values from the list (e.g., 'list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue')?
Any help will be greatly appreciated. On a related topic, I wonder if there are better --less brittle--ways randomize trial types (and its parameters) by sampling without replacement from a list, other than appending N values sampled from a random list like I'm doing below?
Thanks a lot in advance,
EN
--
// Global variables -- these will all be eventually defined in emot_induction.iqx
<values>
/ boxesChecked1 = 0 //Number of boxes clicked in the 1st attempt
/ boxesChecked2 = 0 //Number of boxes clicked in the 2nd attempt
/ sup_boxesChecked = 0 //The larger of the two numbers
/ minimumThreshold = 13 //Arbitrary minimum number of boxes <<-- ADJUSTABLE need to check what is usually achieved
//Thresholds specified by the procedure defined in calibration_time_boxcount.iqx
/ easyThresh50 = 8 //The number of boxes at the 50% level
/ mediumThresh65 = 10 //The number of boxes at the 65% level
/ mediumThresh80 = 13 //The number of boxes at the 80% level
/ hardThresh95 = 15 //The number of boxes at the 95% level
//Color of trial type -- in fact, red (YOU) or blue (OTHER)
/ c_colorname = black
//Stores the selected combination of effort and reward -- e.g., e1_r1 means the lowest effort and the lowest reward
/ eff_rew = "e0_r0" // for filling purposes, this condition DOES NOT EXIST
// Position of the two choices
/ effortX = 0%
/ restX = 0%
// Trial type
/ trialType = null
// Strings to be displayed at every trial
/ centerLabel = null // will be either YOU or OTHER
/ effortCredits = 0
/ effortBoxes = 0
</values>
<parameters> //
//These are the rewards (fixed for all participants)
/ low_pay = 2 //Low reward
/ medium_pay = 6 //Medium reward
/ high_pay = 10 //High reward
/ num_trials = 24 // total number of trials
</parameters>
// These checkboxes will also be defined in emot_induction.iqx -- must comment them when transferring!
<checkboxes row1>
/ caption=" "
/ options=("1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
/ optionvalues = ("1", "2", "3", "4","5", "6", "7", "8", "9", "10")
/ required = true
/ orientation = horizontalequal
</checkboxes>
<checkboxes row2>
/ caption=" "
/ options=("11", "12", "13", "14", "15", "16", "17", "18", "19", "20")
/ optionvalues = ("11", "12", "13", "14","15", "16", "17", "18", "19", "20")
/ required = true
/ orientation = horizontalequal
</checkboxes>
<checkboxes row3>
/ caption=" "
/ options=("21", "22", "23", "24", "25", "26", "27", "28", "29", "30")
/ optionvalues = ("21", "22", "23", "24","25", "26", "27", "28", "29", "30")
/ required = true
/ orientation = horizontalequal
</checkboxes>
<checkboxes row4>
/ caption=" "
/ options=("31", "32", "33", "34", "35", "36", "37", "38", "39", "40")
/ optionvalues = ("31", "32", "33", "34","35", "36", "37", "38", "39", "40")
/ required = true
/ orientation = horizontalequal
</checkboxes>
<checkboxes row5>
/ caption=" "
/ options=("41", "42", "43", "44", "45", "46", "47", "48", "49", "50")
/ optionvalues = ("41", "42", "43", "44","45", "46", "47", "48", "49", "50")
/ required = true
/ orientation = horizontalequal
</checkboxes>
<surveypage box_clicking>
/caption = "<font color='green'>You must click at least <b><u><%values.effortBoxes%></u></b> boxes"
/questions = [1-5=sequence(row1, row2, row3, row4, row5)]
/ itemfontstyle = ("Arial", 2.00%, false, false, false, false, 5, 1)
/ itemspacing = 0.0%
/ showpagenumbers = false
/ showbackbutton = false
/ showquestionnumbers = false
/ responsefontstyle = ("Arial", 2.0%, false, false, false, false, 5, 1)
/ timeout = 10000 // 10 seconds
/ showNextButton = false
</surveypage>
<block SocialEffort_Block>
/ onBlockBegin = [
// Randomized trial type order -- 24 trials
list.trialTypeList.appendItem(list.trialType.nextValue); //1
list.trialTypeList.appendItem(list.trialType.nextValue); //2
list.trialTypeList.appendItem(list.trialType.nextValue); //3
list.trialTypeList.appendItem(list.trialType.nextValue); //4
list.trialTypeList.appendItem(list.trialType.nextValue); //5
list.trialTypeList.appendItem(list.trialType.nextValue); //6
list.trialTypeList.appendItem(list.trialType.nextValue); //7
list.trialTypeList.appendItem(list.trialType.nextValue); //8
list.trialTypeList.appendItem(list.trialType.nextValue); //9
list.trialTypeList.appendItem(list.trialType.nextValue); //10
list.trialTypeList.appendItem(list.trialType.nextValue); //11
list.trialTypeList.appendItem(list.trialType.nextValue); //12
list.trialTypeList.appendItem(list.trialType.nextValue); //13
list.trialTypeList.appendItem(list.trialType.nextValue); //14
list.trialTypeList.appendItem(list.trialType.nextValue); //15
list.trialTypeList.appendItem(list.trialType.nextValue); //16
list.trialTypeList.appendItem(list.trialType.nextValue); //17
list.trialTypeList.appendItem(list.trialType.nextValue); //18
list.trialTypeList.appendItem(list.trialType.nextValue); //19
list.trialTypeList.appendItem(list.trialType.nextValue); //20
list.trialTypeList.appendItem(list.trialType.nextValue); //21
list.trialTypeList.appendItem(list.trialType.nextValue); //22
list.trialTypeList.appendItem(list.trialType.nextValue); //23
list.trialTypeList.appendItem(list.trialType.nextValue); //24
// Randomized YOU effort-reward 12 pairs
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //1
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //2
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //3
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //4
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //5
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //6
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //7
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //8
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //9
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //10
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //11
list.YOU_eff_rewList.appendItem(list.eff_rew_YOU.nextValue) //12
// Randomized OTHER effort-reward 12 pairs
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //1
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //2
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //3
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //4
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //5
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //6
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //7
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //8
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //9
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //10
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //11
list.OTHER_eff_rewList.appendItem(list.eff_rew_OTHER.nextValue) //12
]
// trials = [1-parameters.num_trials = BoxClick_Trial]
/ trials = [1-24 = BoxClick_Trial] // ATTENTION: defining the number of trials manually....
</block>
<trial BoxClick_Trial>
/ onTrialBegin = [
// pick random postion for effort_option
values.effortX = list.x.nextValue;
// pick position for rest_option
values.restX = list.x.nextValue;
// set trial type
//values.trialType = list.trialType.nextValue;
values.trialType = list.trialTypeList.nextValue;
// set center label according to trial type
if (values.trialType == "YOU") {
values.c_colorname = red;
//values.eff_rew = list.eff_rew_YOU.nextValue;
values.eff_rew = list.YOU_eff_rewList.nextValue;
} else { // OTHER
values.c_colorname = blue;
//values.eff_rew = list.eff_rew_OTHER.nextValue;
values.eff_rew = list.OTHER_eff_rewList.nextValue;
}
// set winnings and effort according to the value in eff_rew
if (values.eff_rew == "e1_r1") {
values.effortBoxes = values.easyThresh50;
values.effortCredits = parameters.low_pay;
} else if (values.eff_rew == "e1_r2") {
values.effortBoxes = values.easyThresh50;
values.effortCredits = parameters.medium_pay;
} else if (values.eff_rew == "e1_r3") {
values.effortBoxes = values.easyThresh50;
values.effortCredits = parameters.high_pay;
} else if (values.eff_rew == "e2_r1") {
values.effortBoxes = values.mediumThresh65;
values.effortCredits = parameters.low_pay;
} else if (values.eff_rew == "e2_r2") {
values.effortBoxes = values.mediumThresh65;
values.effortCredits = parameters.medium_pay;
} else if (values.eff_rew = "e2_r3") {
values.effortBoxes = values.mediumThresh65;
values.effortCredits = parameters.high_pay;
} else if (values.eff_rew = "e3_r1") {
values.effortBoxes = values.mediumThresh80;
values.effortCredits = parameters.low_pay;
} else if (values.eff_rew = "e3_r2") {
values.effortBoxes = values.mediumThresh80;
values.effortCredits = parameters.medium_pay;
} else if (values.eff_rew = "e3_r3") {
values.effortBoxes = values.mediumThresh80;
values.effortCredits = parameters.high_pay;
} else if (values.eff_rew = "e4_r1") {
values.effortBoxes = values.hardThresh95;
values.effortCredits = parameters.low_pay;
} else if (values.eff_rew = "e4_r2") {
values.effortBoxes = values.hardThresh95;
values.effortCredits = parameters.medium_pay;
} else if (values.eff_rew = "e4_r3") {
values.effortBoxes = values.hardThresh95;
values.effortCredits = parameters.high_pay;
}
]
/ stimulusframes = [1=effort_option, rest_option, center_label]
/ inputdevice = mouse
/ validresponse = (effort_option, rest_option)
/ branch = [
if (trial.BoxClick_Trial.response=="effort_option") { // if subj chose the effortful option
// run the clicking box survey
return surveyPage.box_clicking
}
]
</trial>
// Stores the order of the 24 trial types -- YOU or OTHER
<list trialTypeList>
/ selectionMode = sequence
</list>
// Stores the order in which the effort/reward pairs will be presented in the 12 YOU trials
<list YOU_eff_rewList>
/ selectionMode = sequence
</list>
// Stores the order in which the effort/reward pairs will be presented in the 12 OTHER trials
<list OTHER_eff_rewList>
/ selectionMode = sequence
</list>
<text effort_option>
/ items = ("<%values.effortCredits%> credits for <%values.effortBoxes%> boxes")
/ hPosition = values.effortX
/ vPosition = 40%
/ fontStyle = ("arial", 12pt)
/ size = (15%, 10%)
/ vJustify = center
/ txBGColor = lightGray
</text>
<text rest_option>
/ items = ("1 credit for Rest")
/ hPosition = values.restX
/ vPosition = 40%
/ fontStyle = ("arial", 12pt)
/ size = (15%, 10%)
/ vJustify = center
/ txBGColor = lightGray
</text>
<text center_label>
// items = ("<%values.trialType%>") // this is the label that should be used in the exp!
/ items = ("<%values.eff_rew%>") // testing the list selection!
/ position = (50%, 30%)
/ txColor = values.c_colorname
/ fontStyle = ("arial", 16pt, true)
</text>
<list trialType>
/ items = ("YOU", "OTHER")
/ poolsize = parameters.num_trials
/ selectionmode = random
/ selectionrate = always
</list>
// This list contains all effort (4) x reward (3) = 12 combinations for the YOU trials
// It will be used to to sample --once-- all the 12 combinations
<list eff_rew_YOU>
/ items = ("e1_r1", "e1_r2", "e1_r3", "e2_r1", "e2_r2", "e2_r3", "e3_r1", "e3_r2", "e3_r3", "e4_r1", "e4_r2", "e4_r3")
/ poolsize = parameters.num_trials/2
/ replace = false
/ selectionmode = random
/ selectionrate = always
</list>
// Likewise for the OTHER trials
<list eff_rew_OTHER>
/ items = ("e1_r1", "e1_r2", "e1_r3", "e2_r1", "e2_r2", "e2_r3", "e3_r1", "e3_r2", "e3_r3", "e4_r1", "e4_r2", "e4_r3")
/ poolsize = parameters.num_trials/2
/ replace = false
/ selectionmode = random
/ selectionrate = always
</list>
<list x>
/ items = (35%, 65%)
/ selectionrate = always
</list>