Millisecond Forums

How to determine which batch or expt was run based on subject id or group id

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

By seandr - 7/25/2014

Inquisit allows you to perform between-subject manipulations at the <batch> or <expt> level using the / subjects attribute. For example, the following varies the order of the script based on groupid:

<batch>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/file="foo.iqx"
/file="bar.iqx"
</batch>

<batch>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/file="bar.iqx"
/file="foo.iqx"
</batch>

When the experiment runs, Inquisit assigns a participant to one or the other <batch> based on the group id, which, depending on configuration, could be a randomly or sequentially generated number, or something entered by the researcher or the participant. Let's say the group id was a randomly generated value of 18843245. How do you determine which <batch> that group id value corresponds to? 

This can be determined with the following formula:

group = ((groupid - 1) % groupcount) + 1

where groupcount is the total number of groups (2 in the above example) and % represents the modulus operator, which returns the remainder after the numerator is divided by the denominator. If we plug the values from our example into the formula, we get:

group = ((18843245 - 1) % 2) + 1

which is equal to 1. In other words, this particular participant ran group 1, where foo.iqx was administered first and bar.iqx was administered second. If /groupassigment = subjectnumber or is unassigned, we would use the same formula but plug in the subject id rather than the group id. 

When analyzing your data, you'll want to calculate a group variable using this formula in order to test or control for order effects or other between-subject manipulations. If you are using Microsoft Excel, the formula is "=MOD(A2-1, 4) +1" where A2 is the cell that has the subject or group id.
By hollysully - 8/31/2017

seandr - Friday, July 25, 2014
Just want to check:  the 4 in the Excel formula:  "=MOD(A2-1, 4) +1"  represents 4 groups, is that correct? The example used 2 groups but the Excel formula represents 4 groups, so I wanted to make sure.
Thanks,
Holly



Inquisit allows you to perform between-subject manipulations at the <batch> or <expt> level using the / subjects attribute. For example, the following varies the order of the script based on groupid:

<batch>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/file="foo.iqx"
/file="bar.iqx"
</batch>

<batch>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/file="bar.iqx"
/file="foo.iqx"
</batch>

When the experiment runs, Inquisit assigns a participant to one or the other <batch> based on the group id, which, depending on configuration, could be a randomly or sequentially generated number, or something entered by the researcher or the participant. Let's say the group id was a randomly generated value of 18843245. How do you determine which <batch> that group id value corresponds to? 

This can be determined with the following formula:

group = ((groupid - 1) % groupcount) + 1

where groupcount is the total number of groups (2 in the above example) and % represents the modulus operator, which returns the remainder after the numerator is divided by the denominator. If we plug the values from our example into the formula, we get:

group = ((18843245 - 1) % 2) + 1

which is equal to 1. In other words, this particular participant ran group 1, where foo.iqx was administered first and bar.iqx was administered second. If /groupassigment = subjectnumber or is unassigned, we would use the same formula but plug in the subject id rather than the group id. 

When analyzing your data, you'll want to calculate a group variable using this formula in order to test or control for order effects or other between-subject manipulations. If you are using Microsoft Excel, the formula is "=MOD(A2-1, 4) +1" where A2 is the cell that has the subject or group id.


By Dave - 8/31/2017

hollysully - Thursday, August 31, 2017
seandr - Friday, July 25, 2014
Just want to check:  the 4 in the Excel formula:  "=MOD(A2-1, 4) +1"  represents 4 groups, is that correct? The example used 2 groups but the Excel formula represents 4 groups, so I wanted to make sure.
Thanks,
Holly



Inquisit allows you to perform between-subject manipulations at the <batch> or <expt> level using the / subjects attribute. For example, the following varies the order of the script based on groupid:

<batch>
/ subjects = (1 of 2)
/ groupassignment = groupnumber
/file="foo.iqx"
/file="bar.iqx"
</batch>

<batch>
/ subjects = (2 of 2)
/ groupassignment = groupnumber
/file="bar.iqx"
/file="foo.iqx"
</batch>

When the experiment runs, Inquisit assigns a participant to one or the other <batch> based on the group id, which, depending on configuration, could be a randomly or sequentially generated number, or something entered by the researcher or the participant. Let's say the group id was a randomly generated value of 18843245. How do you determine which <batch> that group id value corresponds to? 

This can be determined with the following formula:

group = ((groupid - 1) % groupcount) + 1

where groupcount is the total number of groups (2 in the above example) and % represents the modulus operator, which returns the remainder after the numerator is divided by the denominator. If we plug the values from our example into the formula, we get:

group = ((18843245 - 1) % 2) + 1

which is equal to 1. In other words, this particular participant ran group 1, where foo.iqx was administered first and bar.iqx was administered second. If /groupassigment = subjectnumber or is unassigned, we would use the same formula but plug in the subject id rather than the group id. 

When analyzing your data, you'll want to calculate a group variable using this formula in order to test or control for order effects or other between-subject manipulations. If you are using Microsoft Excel, the formula is "=MOD(A2-1, 4) +1" where A2 is the cell that has the subject or group id.



Yes, that is correct. The modulus ought to be equal to the number of groups / conditions you had. In other words:
If you had two conditions, you'd calculate groupnumber modulo 2,
if you had three conditions, you'd calculate the groupnumber modulo 3,
if you had four conditions, you'd calculate the groupnumber modulo 4, and so forth.