VII. Retrieving Group Member Variables

Retrieving Values From Other Participants In The Same Group

Syntax:

variable = find(condition, item_of_interest);

Explanation:
The find function searches for the item_of_interest belonging to the subject specified by a condition.
Defining conditions can be specified using the same() function (e.g. same(Group), same(Subject), etc.) or logical
conditions (e.g. Subject == 2, Group == 5, group_id ==6, etc).

 

Example:

subject.do{
    partner_payment = find(same(Group), payment);
}

Explanation:
Given that this experiment consists of 4 players whereby subject 1 and 2 are
in group 1, and subject 3 and 4 are in group 2, and payments for each subject
from 1 to 4 is 10, 20, 30, 40 respectively.

Each subject will run the above instructions.

When executed by player 1 the find function locates the payment value for her group member (player 2),
which is 20, and assigns it to her partner_payment variable. When player 2 runs the above
code the partner_payment will be set to 10. For player 3 and 4 the partner_payment will be set to
40 and 30 respectively.

 

Example 2:

// the outcome variable can be set to either set to 0 or 1 (o = loser, 1 = winner) depending on
// whether the subject has won the auction or not.
subject.do{
    if (outcome != winner) {
        Winner_Subject_ID = find ( same(Group) & auction_outcome == winner, Subject);
    }
    else{
        Winner_subject_ID = Subject;
    }
}

Explanation 2:
Given that the experiment consists of an auction between 3 subjects for a good A, and Subject 1
has previously won the auction.

When subject 1 runs the above instructions the first condition fails since she is the winner.
The else portion of the if statement is executed, setting the Winner_subject_ID to 1 (i.e. the winners subject id).

For all other players the first if condition is true (outcome == loser). The find function locates the
subject within their group that has the auction_outcome set to winner (1), and assigns that
value (1, for subject 1) to their Winner_subject_ID variable.