Return to the Prisoner's Dilemma Task with Outcome Matrices page
						
									Prisoner's Dilemma - 
							PDG matrix presentation procedure
SCRIPT INFO

Script Author: Katja Borchert, Ph.D. (katjab@millisecond.com) for Millisecond Software, LLC
Date: 10-13-2017
last updated: 01-04-2017 by K.Borchert (katjab@millisecond.com) for Millisecond Software LLC

Script Copyright © 01-04-2017 Millisecond Software


BACKGROUND INFO 

											*Purpose*
This script implements a Prisoner's Dilemma Task based on a generic matrix presentation procedure
described by:

Lyn Ellett , Rhani Allen-Crooks , Adele Stevens , Tim Wildschut & Paul
Chadwick (2013) A paradigm for the study of paranoia in the general population: The Prisoner's
Dilemma Game, Cognition and Emotion, 27:1, 53-62, DOI: 10.1080/02699931.2012.689757


											  *Task*
Participants play a 'game' for points with a co-player (computer).
An outcome matrix is presented that outlines the gains in points if participant and co-player choose
cooperative (simply labeled as "strategy X") or competitive (simply labeled "strategy Y")
strategies.
All numbers in the outcome matrix follow the general pattern (= Prisoner's Dilemma Game Matrix or short: PDG Matrix):
Cooperation loss (participant cooperates, computer competes) <
Competitive loss (participant AND computer compete) <
Cooperation win (participant AND computer cooperate) <
Competitive win (participant competes, computer cooperates)

Participant has to make a decision without knowing which strategy the co-player will choose.
Number of games played as well as strategy selection of computer can be set by experimenter.
By default, only one game is played (to change, go to section Editable Parameters)

In this script, following the procedure described by Ellett et al (2013), no contextual 
game story is provided along with the PDG matrix nor are explicit instructions such as 
"maximize your gains" given. The words 'cooperative' vs. 'competitive' are NOT mentioned
to participant.


DATA FILE INFORMATION: 
The default data stored in the data files are:

(1) Raw data file: 'prisonerdilemma_pdgmatrix_raw*.iqdat' (a separate file for each participant)*

build:							Inquisit build
computer.platform:				the platform the script was run on
date, time, subject, group:		date and time script was run with the current subject/groupnumber 
blockcode, blocknum:			the name and number of the current block
trialcode, trialnum: 			the name and number of the currently recorded trial
									(Note: not all trials that are run might record data; by default data is collected unless /recorddata = false is set for a particular trial/block) 

/computerStrategy:				the strategy the computer uses to make its choice (determined by experimenter)
									1 = 'cooperation': selects the cooperative strategy X on every round									
									2 = 'competition': simply defects on every round of every game by choosing the non-cooperative strategy Y
									3 = 'random': selects randomly
									4 = 'tit-for-tat': cooperates on first round then mirrors the players choices from the previous rounds
									5 = 'tit-for-two-tats': computer cooperates until 2 defects in a row and does not cooperate again until player does
									6 = 'probabilistic': cooperates on first round, then selects the strategy that is most often used by player
									(Note: if player has selected the cooperative strategy exactly 50% of the time, computer selects cooperative strategy)
																		
/countRounds:					counts the number of game rounds played
/pattern:						this script uses 3 formulas to calculate the PDG matrix values (1-3)
									see below (section Experimental SetUp to get more information on the patterns)

/player1Xplayer2X:				stores the points won by participant if participant (player1 ) chooses X and computer (player2) chooses X
/player2Xplayer1X:				stores the points won by computer if participant chooses X and computer chooses X

/player1Xplayer2Y:				stores the points won by participant if participant chooses X and computer chooses Y
/player2Yplayer1X:				stores the points won by computer if participant chooses X and computer chooses Y

/player1Yplayer2Y:				stores the points won by participant if participant chooses Y and computer chooses Y
/player2Yplayer1Y:				stores the points won by computer if participant chooses Y and computer chooses Y

/player1Yplayer2X:				stores the points won by participant if participant chooses Y and computer chooses X
/player2Xplayer1Y:				stores the points won by computer if participant chooses Y and computer chooses X									
																		
response:						the participant's response (response box selected: X vs. Y)
correct:						accuracy of response: 1 = correct response; 0 = otherwise
list.practiceACC.mean:			proportion correct during the current/last practice block
latency: 						the response latency (in ms); measured from:
/selectedStrategy:				stores the participant selected strategy (X or Y) on the current trial
/coplayerStrategy:				stores the computer strategy selected on the current trial (X or Y)
/totalPlayer:					stores the total points won by participant at the end of the current trial
/totalCoPlayer:					stores the total points won by computer at the end of the current trial
/countConsecutiveY:				counts the number of consecutive selections of competitive strategy (Y)
/previousPlayerStrategy:		stores the strategy participant selected on the previous trial (X or Y)
/previousCoplayerStrategy:		stores the computer strategy selected on the previous trial (X or Y)
/propCooperation:				proportion of cooperation strategy (X) selections
/propCompetition:				proportion of competition strategy (Y) selections


(2) Summary data file: 'prisonerdilemma_pdgmatrix_summary*.iqdat' (a separate file for each participant)*

script.startdate:					date script was run
script.starttime:					time script was started
script.subjectid:					subject id number
script.groupid:						group id number
script.elapsedtime:					time it took to run script (in ms)
computer.platform:					the platform the script was run on
/completed:							0 = script was not completed (prematurely aborted); 1 = script was completed (all conditions run)

/computerStrategy:					the strategy the computer uses to make its choice (determined by experimenter)
									1 = 'cooperation': selects the cooperative strategy X on every round									
									2 = 'competition': simply defects on every round of every game by choosing the non-cooperative strategy Y
									3 = 'random': selects randomly
									4 = 'tit-for-tat': cooperates on first round then mirrors the players choices from the previous rounds
									5 = 'tit-for-two-tats': computer cooperates until 2 defects in a row and does not cooperate again until player does
									6 = 'probabilistic': cooperates on first round, then selects the strategy that is most often used by player
									(Note: if player has selected the cooperative strategy exactly 50% of the time, computer selects cooperative strategy)

/countPracticeBlocks:				number of practice blocks run
list.practiceACC.mean:				proportion correct during the last practice block

/countRounds:						the number of games played
/totalPlayer:						stores the total points won by participant
/totalCoPlayer:						stores the total points won by computer
/numberCooperation:					absolute number of selecting cooperation strategy (X)
/propCooperation:					proportion of cooperation strategy (X) selections
/numberCompetition:				 	absolute number of selecting competition strategy (Y)
/propCompetition:					proportion of competition strategy (Y) selections

/meanRT:							mean overall response time (in ms)
/meanRT_Cooperation:				mean response time (in ms) of selecting cooperation strategy (X)
/meanRT_Competition:				mean response time (in ms) of selecting cooperation strategy (Y)

/countResponses_afterCompetition:		number of responses made after the computer previously chose competition 
/propCooperation_afterCompetition:		proporation cooperation after the computer previously chose competition
/numberCooperation_afterCompetition: 	absolute number of cooperations after the computer previously chose competition
/meanRT_afterCompetition:				mean response time (in ms) after the computer previously chose competition
/meanRT_cooperation_afterCompetition:	mean response time (in ms) of cooperative responses after the computer previously chose competition
/meanRT_competition_afterCompetition: 	mean response time (in ms) of competitive responses after the computer previously chose competition

/countResponses_afterCooperation:		number of responses made after the computer previously chose cooperation
/propCooperation_afterCooperation:		proporation cooperation after the computer previously chose cooperation
/numberCooperation_afterCooperation: 	absolute number of cooperations after the computer previously chose cooperation
/meanRT_afterCooperation:				mean response time (in ms) after the computer previously chose cooperation
/meanRT_cooperation_afterCooperation:	mean response time (in ms) of cooperative responses after the computer previously chose cooperation
/meanRT_competition_afterCooperation: 	mean response time (in ms) of competitive responses after the computer previously chose cooperation


* separate data files: to change to one data file for all participants (on Inquisit Lab only), go to section
"DATA" and follow further instructions


EXPERIMENTAL SET-UP

1. Instructions
The instruction blocks gives general information about the task and walks participants through
the PDG outcome matrix.

2. Practice
The practice blocks practices and tests participant's understanding of the value matrix.
(Note: In this script, values used during practice can either follow the PDG pattern (default) or can be
assigned randomly. See section Editable Parameters)
Each practice blocks presents 4 trials that pose a question regarding each of the 4 matrix quadrants:
"If you select strategy: A and your co-player selects strategy: B
How many points will {you/co-player} get?"
Participants have to get all four questions of a practice block correct before moving on to the test block.
Practice is repeated until all 4 questions are answered correctly or 10 practice blocks have run.
After 10 practice blocks the script aborts if participant does not provide perfect understanding of the matrix set-up.

3. Test
The test runs as many games as specified by parameters.numberOfGames (default: 1, see Ellett et al, 2013)
Participant are told they are paired with a co-player. By default, the 'pairing' takes 5s (editable parameter).
For each round a new PDG matrix is presented and participants have to make a choice.
After they make their choice, a random delay is introduced that simulates the decision time of the coplayer
(sometimes the co-player takes more time, sometimes less).
Once both decisions are 'known', feedback is provided and the participant is told what strategy the co-player chose,
and how many points they both won. The feedback also includes an update of the total number of points won across all games played.

PDG Matrix Values:
This script implements three patterns to calculate the values presented in the PDG matrices. By default, the pattern is
selected randomly without replacement by list.patterns (see section Editable Lists)
pattern 1 => 
COOPERATION LOSS = COOP - 2* 1/3COOP
COMPETITION LOSS = COOP - 1* 1/3COOP 
COOPERATION WIN = COOP
COMPETITION WIN = COOP + 1* 1/3COOP

pattern2 =>
COOPERATION LOSS = COOP - 2* 1/2COOP = 0
COMPETITION LOSS = COOP - 1* 1/2COOP
COOPERATION WIN = COOP
COMPETITION WIN = COOP + 1* 1/2COOP

pattern3 =>
COOPERATION LOSS = COOP - 3.5* 1/4COOP
COMPETITION LOSS = COOP - 3* 1/4COOP
COOPERATION WIN = COOP
COMPETITION WIN = COOP + 3* 1/4COOP

The cooperation win number (COOP) is randomly selected by list.cooperativeWinNumber (see section Editable List).
By default, numbers from 1-100 are selected randomly without replacement.


STIMULI
provided by Millisecond Software - can be edited under section Editable Stimuli

INSTRUCTIONS
provided by Millisecond Software - can be edited under section Editable Instructions

EDITABLE CODE:
check below for (relatively) easily editable parameters, stimuli, instructions etc. 
Keep in mind that you can use this script as a template and therefore always "mess" with the entire code to further customize your experiment.

The parameters you can change are:

/maxPracticeBlocks:				the maximum number of times participants have to go through the matrix practice block before
								the script aborts due to low understanding (participants move on from practice only with 100% correct
								understanding of matrix) (default: 10)
								
/usePDGmatrix_practice:			true (1): the practice session uses PDG outcome matrices (default)
								false (0): the practice session uses randomly outcome matrices

/numberOfGames:					the number of games played (see also expressions.numberGamesInstruct) (default: 1)

/computerStrategy:				the strategy the computer uses to make its choice
									1 = 'cooperation': selects the cooperative strategy X on every round									
									2 = 'competition': simply defects on every round of every game by choosing the non-cooperative strategy Y
									3 = 'random': selects randomly
									4 = 'tit-for-tat': cooperates on first round then mirrors the players choices from the previous rounds
									5 = 'tit-for-two-tats': computer cooperates until 2 defects in a row and does not cooperate again until player does
									6 = 'probabilistic': cooperates on first round, then selects the strategy that is most often used by player
									(Note: if player has selected the cooperative strategy exactly 50% of the time, computer selects cooperative strategy)
									
/waitDuration:					the duration (in ms) that participant has to wait to get 'paired' (default: 5000ms)									
/iti:							intertrial interval (in ms) (default: 1000ms)														
Copyright © Millisecond Software. All rights reserved.
Contact | Terms of Service | Security Statement | Employment