Elegance and randomisation


Author
Message
Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Dear Inquisit forum,

I have a query regarding the aforementioned subject title, and have attached my script.

Firstly, I was wondering if there as a way to make parts of my script more elegant - currently it is functional, but I feel as if I've taken quite a brutal, inelegant approach to it, entirely due to my lack of skills as a programmer. 

For example, in the 'Practice trials' section, I have one of three different stimuli randomly appearing after a key-press (spacebar) - either a green, red, or blue circle, staying on screen for 400ms, and then the participant is asked to judge the time interval between keypress and the image appearing (between 0-900ms). Currently I have these three stimuli in separate trials, but I was wondering if there was a simpler method of having them all in the same 'trial', as it were. No data needs to be recorded during these trials, so I don't require any stimuli values to be recorded.

Equally, I have the same issue with the experimental trials, under 'Scenarios'. There are four possible combinations between a scenario and an outcome - good(scenario)-good(outcome), good-bad, bad-good, and bad-bad. The scenarios are in the stimuli section (both the 'good' and the 'bad' version), as well as both the 'good' and 'bad' outcomes. Currently I have 'Scenario 1' scripted, and it is functional. However, again it feels like an awfully brutal approach. There are 20 scenarios, with good and bad versions (thus, 40 in total), and I was wondering if there was a method to not having an awfully long script. Each participant should only experience one scenario (either the good or bad version) once, such that there should be 20 'trials' (i.e. different scenarios) in total per participant. I am aiming to recruit 80 participants ideally, so, additionally, each possible scenario (both the good and bad versions) should be seen an equal number of times, with both outcomes having been produced equally across all participants (40 possible scenarios x 2 outcomes). 

A final query is the recording of which scenario took place - I currently have values.scenario set as /ontrialend = [values.scenario = good/bad], but I was wondering if it were possible to have this information recorded in the stimuli trial (e.g., trial.trialS01G), so that both the scenario and the stimulus-outcome are recorded on the same data line.

Many thanks, apologies if any of my explanation was confusing - I will happily clarify if required.
Josh
Attachments
Justice_Binding_1509.iqx (566 views, 42.00 KB)
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: 98K
> For example, in the 'Practice trials' section, I have one of three different stimuli randomly appearing after a key-press (spacebar) - either a
> green, red, or blue circle, staying on screen for 400ms, and then the participant is asked to judge the time interval between keypress and
> the image appearing (between 0-900ms). Currently I have these three stimuli in separate trials, but I was wondering if there was a simpler > method of having them all in the same 'trial', as it were. No data needs to be recorded during these trials, so I don't require any stimuli
> values to be recorded.

You can alter a <shape>'s color at runtime by setting the shape.shapename.color property. I.e, your practice phase can be reduced to:

<block PracticeBlock>
/trials = [1-30 = practice]
</block>

<trial practice>
/stimulustimes = [500 = cross]
/correctresponse = (" ")
/pretrialpause = 500
/branch = [trial.practicedot]
/recorddata = false
</trial>

<trial practicedot>
/stimulustimes = [1 = whiterectangle]
/ ontrialbegin = [shape.circle.color = list.colors.nextvalue]
/ontrialbegin = [trial.practicedot.insertstimulustime(shape.circle, list.targetdurationP.nextvalue)]
/ontrialbegin = [trial.practicedot.insertstimulustime(shape.whiterectangle, list.targetdurationP.currentvalue+400)]
/ontrialend = [trial.practicedot.setstimulustime(shape.whiterectangle, list.targetdurationP.currentvalue)]
/ontrialend = [trial.practicedot.resetstimulusframes(100)]
/timeout = (list.targetdurationP.currentvalue+1000)
/recorddata = false
</trial>

<shape circle>
/shape = circle
/size = (1% * 3/4 * 10, 10%)
/position = (50%, 50%)
/erase = false
</shape>

<list colors>
/ items = (red, green, blue)
/ poolsize = 30
</list>

<list targetdurationP>
/items = (0, 100, 200, 300, 400, 500, 600, 700, 800, 900)
/replace = false
</list>

<shape whiterectangle>
/shape = rectangle
/size = (70%, 70%)
/color = white
/position = (50%, 50%)
/erase = false
</shape>

<text cross>
/items = ("+")
/color = (0,0,0)
</text>

> [... ] There are 20 scenarios, with good and bad versions (thus, 40 in total), and I was wondering if there was a method to not having an
> awfully long script. Each participant should only experience one scenario (either the good or bad version) once, such that there should
> be 20 'trials' (i.e. different scenarios) in total per participant.

You'd simply need to make sure that the two versions are sampled from the same pool of 20 item number: Once e.g. item number 5 has been selected in the "good" condition, it cannot be selected anymore for the "bad" condition. Simple example:

<block myblock>
/ trials = [1-20 = noreplace(goodscenario, badscenario)]
</block>

<trial goodscenario>
/ stimulusframes = [1=good]
/ validresponse = (57)
</trial>

<trial badscenario>
/ stimulusframes = [1=bad]
/ validresponse = (57)
</trial>

<text good>
/ items = gooditems
/ txcolor = green
/ select = list.scenariolist.nextindex
</text>

<text bad>
/ items = baditems
/ txcolor = red
/ select = list.scenariolist.nextindex
</text>

<item gooditems>
/ 1 = "s1 - good"
/ 2 = "s2 - good"
/ 3 = "s3 - good"
/ 4 = "s4 - good"
/ 5 = "s5 - good"
/ 6 = "s6 - good"
/ 7 = "s7 - good"
/ 8 = "s8 - good"
/ 9 = "s9 - good"
/ 10 = "s10 - good"
/ 11 = "s11 - good"
/ 12 = "s12 - good"
/ 13 = "s13 - good"
/ 14 = "s14 - good"
/ 15 = "s15 - good"
/ 16 = "s16 - good"
/ 17 = "s17 - good"
/ 18 = "s18 - good"
/ 19 = "s19 - good"
/ 20 = "s20 - good"
</item>

<item baditems>
/ 1 = "s1 - bad"
/ 2 = "s2 - bad"
/ 3 = "s3 - bad"
/ 4 = "s4 - bad"
/ 5 = "s5 - bad"
/ 6 = "s6 - bad"
/ 7 = "s7 - bad"
/ 8 = "s8 - bad"
/ 9 = "s9 - bad"
/ 10 = "s10 - bad"
/ 11 = "s11 - bad"
/ 12 = "s12 - bad"
/ 13 = "s13 - bad"
/ 14 = "s14 - bad"
/ 15 = "s15 - bad"
/ 16 = "s16 - bad"
/ 17 = "s17 - bad"
/ 18 = "s18 - bad"
/ 19 = "s19 - bad"
/ 20 = "s20 - bad"
</item>

<list scenariolist>
/ poolsize = 20
</list>

> I am aiming to recruit 80 participants ideally, so, additionally, each possible scenario (both the good and bad versions) should be seen
> an equal number of times, with both outcomes having been produced equally across all participants (40 possible scenarios x 2
> outcomes).

This is not possible -- when a participant takes the experiment, Inquisit has no way of knowing how often a given scenario has already occurred in either the good or bad version with other / previous participants. Hence, there can be no guarantee whatsoever that, say, scenario #4 is administered equally often in the bad as well as good version across participants (and so forth for all the other scenarios).

To ensure such a distribution, you'd have to abandon randomization and define different "sets" of scenarios satisfying that requirement (equal distribution of all scenarios in good vs. bad version across all participants). You would have to implement / administer those sets as between-subjects conditions.

> A final query is the recording of which scenario took place - I currently have values.scenario set as /ontrialend = [values.scenario =
>  good/bad], but I was wondering if it were possible to have this information recorded in the stimuli trial (e.g., trial.trialS01G), so that both
> the scenario and the stimulus-outcome are recorded on the same data line.

I don't understand this question.

#1: The syntax in the script you attached is broken:

<trial S01G_Scenario_Good>
/stimulustimes = [1 = good_1]
/correctresponse = (57)
ontrialend = [values.scenario = good]
/branch = [trial.trialS01G]
</trial>
...
<trial S01B_Scenario_Good>
/stimulustimes = [1 = bad_1]
/correctresponse = (57)
ontrialend = [values.scenario = bad]
/branch = [trial.trialS01G]
</trial>

ought to read

<trial S01G_Scenario_Good>
/stimulustimes = [1 = good_1]
/correctresponse = (57)
/ ontrialend = [values.scenario = "good"]
/branch = [trial.trialS01G]
</trial>
...
<trial S01B_Scenario_Good>
/stimulustimes = [1 = bad_1]
/correctresponse = (57)
/ ontrialend = [values.scenario = "bad"]
/branch = [trial.trialS01G]
</trial>

#2: When you set values.scenario to, say,  "bad" in <trial S01B_Scenario_Good>, it will still say exactly that in the data file's "next line", the one for <trial trialS01G>. In other words, you have the scenario and stimulus information on the same data line.
Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
Hi Dave,

Many thanks for your assistance. I followed your advice and created a successful script.

I have another a follow-up experiment script that is similar, but I'm also at a loss. Essentially, I have the same 20 scenarios with a good/bad variation for each scenario (thus 40 in total). In this experiment, the participant has two buttons to press - one that produces a good outcome and the other that produces the bad, after they have read the scenario (participants will be trained previously to associate each of the two buttons with either the good/bad outcome), where the idea is is that the participant will choose the outcome they think should deservingly be the result of the scenario.

For example, here is scenario 1:

*********
Scenario 1
*********

<trial S01G_Scenario>
/stimulustimes = [1 = good_1]
/validresponse = (16, 25)
/responsetrial = (16 = trialS01G)
/responsetrial = (25 = trialS01B)
/ontrialend = [values.scenario = "good"]
/recorddata = true
</trial>

<trial S01B_Scenario>
/stimulustimes = [1 = bad_1]
/validresponse = (16, 25)
/responsetrial = (16 = trialS01G)
/responsetrial = (25 = trialS01B)
/ontrialend = [values.scenario = "bad"]
/recorddata = true
</trial>


<trial trialS01G>
/stimulustimes = [1 = whiterectangle]
/ontrialbegin = [trial.trialS01G.insertstimulustime(picture.S01G, list.targetdurationE.nextvalue)]
/ontrialbegin = [trial.trialS01G.insertstimulustime(text.s01g_r, list.targetdurationE.currentvalue+1000)]
/ontrialbegin = [trial.trialS01G.insertstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue+5000)]
/ontrialend = [trial.trialS01G.setstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue)]
/ontrialend = [values.onset = list.targetdurationE.currentvalue]
/ontrialend = [trial.trialS01G.resetstimulusframes(100)]
/ontrialend = [values.stimuli = S01G]
/timeout = (list.targetdurationE.currentvalue+5000)
/branch = [surveypage.te]
/recorddata = true
</trial>

<trial trialS01B>
/stimulustimes = [1 = whiterectangle]
/ontrialbegin = [trial.trialS01B.insertstimulustime(picture.S01B, list.targetdurationE.nextvalue)]
/ontrialbegin = [trial.trialS01B.insertstimulustime(text.s01b_r, list.targetdurationE.currentvalue+1000)]
/ontrialbegin = [trial.trialS01B.insertstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue+5000)]
/ontrialend = [trial.trialS01B.setstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue)]
/ontrialend = [values.onset = list.targetdurationE.currentvalue]
/ontrialend = [trial.trialS01B.resetstimulusframes(100)]
/ontrialend = [values.stimuli = S01B]
/timeout = (list.targetdurationE.currentvalue+5000)
/branch = [surveypage.te]
/recorddata = true
</trial>

However, I need two conditions. One in which that the participant's response has a 50-50 chance to produce either outcome (i.e., random, despite their button press-association training), and one in which the participant's response has a 75-25 chance to produce the outcome they intended with their response. I haven't found a way to manipulate this using the responsetrial element, so I imagine it is something to do with lists (which I'm terrible at). Thus far I have:

<list Scenario_1_50>
/items = (S01G, S01B)
/itemprobabilities = (0.5, 0.5)
/replace = true
</list>

<list Scenario_1_75_Good>
/items = (S01G, S01B)
/itemprobabilities = (0.75, 0.25)
/replace = true
</list>

<list Scenario_1_75_Bad>
/items = (S01G, S01B)
/itemprobabilities = (0.25, 0.75)
/replace = true
</list>

- but I'm unable to incorporate them into the trial sequence properly, especially as I need to ensure that both the scenario, the participant's response, the probability to which they can produce their desire outcome, and the outcome itself, all need to be recorded properly.

I hope there's a way to resolve this, and I apologise if there's an easy solution that I haven't realised. Please let me know if you need any more information, or if you'd like me to attach the whole script.

Many thanks,
Josh
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: 98K
You cannot use the /responsetrial attribute. You need to use /branch and set up your lists properly.

<trial sometrial>
...
/ branch = [if (trial.sometrial.response == 16) list.example.nextvalue]
...
</trial>

<list example>
/ items = (trial.good, trial.bad)
...
</list>

<trial good>
...
</trial>

<trial bad>
...
</trial>

Psych_Josh
Psych_Josh
Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)Guru (11K reputation)
Group: Forum Members
Posts: 85, Visits: 397
That's brilliant, thanks Dave.

Josh
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search