Problem with randomized subjectid numbers


Author
Message
barsad
barsad
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 12, Visits: 1

Hello --


I am using the standard randomized Subject ID script to assign subject numbers for a Web experiment, which is the following:


function GetSubjectNumber()
{
var snum = Math.floor(Math.random() * 1000000000);
   return snum.toString();
}

But for some reason several subjects (about 10) were given the same subject number when taking the survey. I know this isn't supposed to happen when it's randomly assigning numbers between 1 and 1000000000, but it is. Has anyone had this bug, and how might I correct it?
I need to have an even number of evenly-numbered and odd-numbered subject IDs.

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: 13K, Visits: 104K

Was the script hosted at millisecond.com or at your own server? This makes a difference and is explained at length in this help topic: http://www.millisecond.com/support/docs/v3/html/articles/websubjectnumbers.htm. Possibly relevant quote:


"Subject number assignment for scripts hosted on other servers


[...]



In the source code for the page is a javascript method called
"GetSubjectNumber"
that is responsible for generating the subject number. For
random generation, the
method looks like this:



Figure 2.


function GetSubjectNumber() 
{
return (Math.floor(Math.random() * 1000000000));
}

[...]

Note that we are selecting numbers with replacement, so it is theoretically possible that two participants might be assigned the
same subject number. However, the chances are slim indeed, and if it does happen, you can use the time of the session as
logged in the "date" and "time" data columns to distinguish the subjects' data."

Also note that the mere fact that some subjects have the same number does not necessarily skew the distribution of even and odd numbers.

Hope this helps,
~Dave

barsad
barsad
Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)Esteemed Member (2.2K reputation)
Group: Forum Members
Posts: 12, Visits: 1

Hi Dave --


Thanks for the link... yes, it was hosted on the millisecond.com server, so it's still a mystery why there would be identical subject IDs. I'm less worried about the even-odd distribution than the merging of datasets (unfortunately I get four different output files from my survey, I haven't figured out how to get just one data file). I merge by comparing subject IDs, so they have to be unique.


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: 13K, Visits: 104K

Hmm, weird. Maybe several subjects have taken the study from the same PC without refreshing the launch page -- this used to be a potential issue a while back, if I remember correctly. However, nowadays the launch page should prevent this from happening, I think. Anyway, given the huge variety in browsers, ad- and scriptblockers people are running in the wild, there might be a few combinations out there throwing things off. Back on topic, though: I'd prepend time and / or date information to the subject id in order to make each one unique (easily done in SPSS via concat()) -- in case of just one between-subjects condition with two levels (odd vs. even) this will keep the condition assignment encoded in the subject id intact while getting rid of the duplicate ids. E.g. subject 3 run on 10-10-2009 at 13:00 might become 1010200913003 while subject 3 run on 10-15-2009 at 08:32 might become 1015200908323, etc.


Hope this helps,


~Dave


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search