Millisecond Forums

Coding values to enable easier data analysis

https://forums.millisecond.com/Topic19954.aspx

By Psych_Josh - 10/25/2016

Dear Inquisit Forum,

I was wondering if I could have some help regarding the subject title in question. I have run several Inquisit-powered experiments, and often I spend a few hours after data collection restructuring the data into an easier format to analyse (specifically, trying to restructure long into wide data sets) to calculate average scores and standard deviations.

Please see attached for my script. Essentially, there will be 20 data points per participant. In a 'long' data set, this will obviously mean 20 rows for each participant. As I understand it, this is simply how Inquisit displays your data (however, if there is a way around this, please correct me). However, another way to help with data analysis is for Inquisit to calculate averages and standard deviations as values. 

Essentially, the participant will read a scenario (of which there are 20), either a 'good' version, or a 'bad' version of the scenario. The participant presses the spacebar, and this can produce either a 'good' or a 'bad' outcome to the scenario. Thus, there are four possible combinations between a scenario and an outcome - good(scenario)-good(outcome), good-bad, bad-good, and bad-bad. The participant will then estimate the time interval between pressing the spacebar, and the image appearing. Linking this back to my question, this would then lead to each participant have 4 average time interval estimations (and SDs) - one for each possible combination (e.g., good-good). I could do this in Excel, but I'm not especially apt at restructuring data to do this in less than a few hours.

If anyone has the time to read my script and offer me any advice, I would be very grateful. I apologise in advance if any of my explanation isn't clear.

Best,
Josh
By Dave - 10/26/2016

> Linking this back to my question, this would then lead to each participant have 4 average time interval estimations (and SDs) - one for each
> possible combination (e.g., good-good).

You need four <values> entries -- one for each condition / combination -- where you sum up the respective time estimations provided by the participant. You divide by the number of estimations in the respective condition to get the average (you can use the <expressions> element for that). Similarly, to calculate the respective SDs, you track the respective sum of squares in <values> entries (one per condition) and you can then have an <expression> calculate the running SD.

See any of the IAT scripts in the library as examples, which do precisely that.
By Psych_Josh - 10/30/2016

Thanks for your help Dave, once again!

Josh
By Psych_Josh - 11/13/2016

Hi Dave,

After trialing some pilot participants, I have encountered a minor problem. Sorry to bring this script to your attention again. Essentially, I'm trying to equalise the presentation time of stimuli (the outcome, at either 100, 400, or 700ms) with the (now 24) scenarios and their combinations (good-good, good-bad, bad-good, and bad-bad), such that there is 6 of each combination (6 x 4 = 24, just for clarity). Ideally, this would be 2 of each presentation time per combination, however, I am struggling to create this without further pseudo-randomising my script even more. Currently, participants can receive a random (non-replaced) time for each combination, such that some combinations are occasionally presented only with one or two of the presentation times, through pure chance. Without posting the unnecessarily long script, here is a main section:

<list targetdurationE>
/items = (100, 400, 700)
/poolsize = 24
/replace = false
</list>

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

<trial S01G_Scenario_Good>
/stimulustimes = [2000 = good_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "good"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01G]
/recorddata = false
</trial>

<trial S01G_Scenario_Bad>
/stimulustimes = [2000 = good_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "good"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01B]
/recorddata = false
</trial>

<trial S01B_Scenario_Good>
/stimulustimes = [2000 = bad_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "bad"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01G]
/recorddata = false
</trial>

<trial S01B_Scenario_Bad>
/stimulustimes = [2000 = bad_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "bad"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01B]
/recorddata = false
</trial>

<trial trialS01G>
/stimulustimes = [1 = whiterectangle]
/ontrialbegin = [trial.trialS01G.insertstimulustime(picture.S01G, list.targetdurationE.nextvalue)]
/ontrialbegin = [trial.trialS01G.insertstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue+1000)]
/ontrialend = [trial.trialS01G.setstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue)]
/ontrialend = [values.onset = list.targetdurationE.currentvalue]
/ontrialend = [trial.trialS01G.resetstimulusframes(100)]
/ontrialend = [values.outcome = "good"]
/timeout = (list.targetdurationE.currentvalue+2000)
/branch = [surveypage.te]
/recorddata = false
</trial>

<trial trialS01B>
/stimulustimes = [1 = whiterectangle]
/ontrialbegin = [trial.trialS01B.insertstimulustime(picture.S01B, list.targetdurationE.nextvalue)]
/ontrialbegin = [trial.trialS01B.insertstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue+1000)]
/ontrialend = [trial.trialS01B.setstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue)]
/ontrialend = [values.onset = list.targetdurationE.currentvalue]
/ontrialend = [trial.trialS01B.resetstimulusframes(100)]
/ontrialend = [values.outcome = "bad"]
/timeout = (list.targetdurationE.currentvalue+2000)
/branch = [surveypage.te0]
/recorddata = false
</trial>

<block Scenario_List_1>
/trials = [1 = noreplace(S01G_scenario_Good); 2-4 = noreplace(S02G_scenario_Bad, S03B_scenario_Good, S04B_scenario_Bad); 5 = noreplace(S05G_scenario_Good); 6-7 = noreplace(S06G_scenario_Bad, S07B_scenario_Good); 8 = noreplace(S08B_scenario_Bad); 9-12 = noreplace(S09G_scenario_Good, S10G_scenario_Bad, S11B_scenario_Good, S12B_scenario_Bad); 13 = noreplace(S13G_scenario_Good); 14-16 = noreplace(S14G_scenario_Bad, S15B_scenario_Good, S16B_scenario_Bad); 17 = noreplace(S17G_scenario_Good); 18-24 = noreplace(S18G_scenario_Bad, S19B_scenario_Good, S20B_scenario_Bad, S21G_scenario_Good, S22G_scenario_Bad, S23B_scenario_Good, S24B_scenario_Bad)]
</block>

(some trials are in specific locations because they are followed by an attention task)

<expt>
/subjects = (1 of 4)
/blocks = [1 = Scenario_List_1]
</expt>

I imagine this can be achieved through the list function, however, going through the various list attributes hasn't enlightened me as to a possible solution.

Thank you for your time, once again.

Josh
By Dave - 11/13/2016

Psych_Josh - Monday, November 14, 2016
Hi Dave,

After trialing some pilot participants, I have encountered a minor problem. Sorry to bring this script to your attention again. Essentially, I'm trying to equalise the presentation time of stimuli (the outcome, at either 100, 400, or 700ms) with the (now 24) scenarios and their combinations (good-good, good-bad, bad-good, and bad-bad), such that there is 6 of each combination (6 x 4 = 24, just for clarity). Ideally, this would be 2 of each presentation time per combination, however, I am struggling to create this without further pseudo-randomising my script even more. Currently, participants can receive a random (non-replaced) time for each combination, such that some combinations are occasionally presented only with one or two of the presentation times, through pure chance. Without posting the unnecessarily long script, here is a main section:

<list targetdurationE>
/items = (100, 400, 700)
/poolsize = 24
/replace = false
</list>

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

<trial S01G_Scenario_Good>
/stimulustimes = [2000 = good_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "good"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01G]
/recorddata = false
</trial>

<trial S01G_Scenario_Bad>
/stimulustimes = [2000 = good_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "good"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01B]
/recorddata = false
</trial>

<trial S01B_Scenario_Good>
/stimulustimes = [2000 = bad_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "bad"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01G]
/recorddata = false
</trial>

<trial S01B_Scenario_Bad>
/stimulustimes = [2000 = bad_1; 7000 = space]
/correctresponse = (57)
/beginresponsetime = 7000
/ontrialend = [values.scenario = "bad"]
/ontrialend = [values.scenario_number = "1"]
/branch = [trial.trialS01B]
/recorddata = false
</trial>

<trial trialS01G>
/stimulustimes = [1 = whiterectangle]
/ontrialbegin = [trial.trialS01G.insertstimulustime(picture.S01G, list.targetdurationE.nextvalue)]
/ontrialbegin = [trial.trialS01G.insertstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue+1000)]
/ontrialend = [trial.trialS01G.setstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue)]
/ontrialend = [values.onset = list.targetdurationE.currentvalue]
/ontrialend = [trial.trialS01G.resetstimulusframes(100)]
/ontrialend = [values.outcome = "good"]
/timeout = (list.targetdurationE.currentvalue+2000)
/branch = [surveypage.te]
/recorddata = false
</trial>

<trial trialS01B>
/stimulustimes = [1 = whiterectangle]
/ontrialbegin = [trial.trialS01B.insertstimulustime(picture.S01B, list.targetdurationE.nextvalue)]
/ontrialbegin = [trial.trialS01B.insertstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue+1000)]
/ontrialend = [trial.trialS01B.setstimulustime(shape.whiterectangle, list.targetdurationE.currentvalue)]
/ontrialend = [values.onset = list.targetdurationE.currentvalue]
/ontrialend = [trial.trialS01B.resetstimulusframes(100)]
/ontrialend = [values.outcome = "bad"]
/timeout = (list.targetdurationE.currentvalue+2000)
/branch = [surveypage.te0]
/recorddata = false
</trial>

<block Scenario_List_1>
/trials = [1 = noreplace(S01G_scenario_Good); 2-4 = noreplace(S02G_scenario_Bad, S03B_scenario_Good, S04B_scenario_Bad); 5 = noreplace(S05G_scenario_Good); 6-7 = noreplace(S06G_scenario_Bad, S07B_scenario_Good); 8 = noreplace(S08B_scenario_Bad); 9-12 = noreplace(S09G_scenario_Good, S10G_scenario_Bad, S11B_scenario_Good, S12B_scenario_Bad); 13 = noreplace(S13G_scenario_Good); 14-16 = noreplace(S14G_scenario_Bad, S15B_scenario_Good, S16B_scenario_Bad); 17 = noreplace(S17G_scenario_Good); 18-24 = noreplace(S18G_scenario_Bad, S19B_scenario_Good, S20B_scenario_Bad, S21G_scenario_Good, S22G_scenario_Bad, S23B_scenario_Good, S24B_scenario_Bad)]
</block>

(some trials are in specific locations because they are followed by an attention task)

<expt>
/subjects = (1 of 4)
/blocks = [1 = Scenario_List_1]
</expt>

I imagine this can be achieved through the list function, however, going through the various list attributes hasn't enlightened me as to a possible solution.

Thank you for your time, once again.

Josh

Given how you've set up the script generally, you'll need several lists: One for each combination. Then sample from the applicable list.

<trial trialS01G>
/stimulustimes = [1 = whiterectangle]
/ ontrialbegin = [if (values.scenario == "good") values.onset = list.targetdurationE_good_good.nextvalue]
/ ontrialbegin = [if (values.scenario == "bad") values.onset = list.targetdurationE_bad_good.nextvalue]

/ontrialbegin = [trial.trialS01G.insertstimulustime(picture.S01G, values.onset)]
/ontrialbegin = [trial.trialS01G.insertstimulustime(shape.whiterectangle, values.onset+1000)]
/ontrialend = [trial.trialS01G.setstimulustime(shape.whiterectangle, values.onset)]
/ontrialend = [trial.trialS01G.resetstimulusframes(100)]
/ontrialend = [values.outcome = "good"]
/timeout = (values.onset+2000)
/branch = [surveypage.te]
/recorddata = false
</trial>

<list targetdurationE_good_good>
/items = (100, 400, 700)
/poolsize = 6

/replace = false
</list>

<list targetdurationE_bad_good>
/items = (100, 400, 700)
/poolsize = 6

/replace = false
</list>

and so forth.