Assigning subjects randomly to groups

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Assigning subjects randomly to groups

JOHN ANTONAKIS
Hi:

I am executing the below program (from Shadish, Cook &
Campbell's book) to assign 20 subjects randomly to an
experimental and control group

input program.
loop #I=1 to 20.
if (#I<10) group=0.
if (#I>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
print table/ $casenum group.
execute.

When I run the program (in SPSS ver 14.0), it gives me a
missing value for some of the members of the group. Any
thoughts?

Thanks,
J.

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Meyer, Gregory J
John, I believe it's because your grouping is not exhaustive in that
values of 10 are not classified. Try

if (#I<11) group=0.

rather than

if (#I<10) group=0.

Greg

| -----Original Message-----
| From: SPSSX(r) Discussion [mailto:[hidden email]]
| On Behalf Of John Antonakis
| Sent: Saturday, October 28, 2006 11:18 AM
| To: [hidden email]
| Subject: Assigning subjects randomly to groups
|
| Hi:
|
| I am executing the below program (from Shadish, Cook &
| Campbell's book) to assign 20 subjects randomly to an
| experimental and control group
|
| input program.
| loop #I=1 to 20.
| if (#I<10) group=0.
| if (#I>10) group=1.
| compute x=normal(1).
| end case.
| end loop.
| end file.
| end input program.
| sort cases by x.
| print table/ $casenum group.
| execute.
|
| When I run the program (in SPSS ver 14.0), it gives me a
| missing value for some of the members of the group. Any
| thoughts?
|
| Thanks,
| J.
|
| ___________________________________
|
| Prof. John Antonakis
| School of Management and Economics
| University of Lausanne
| Internef #527
| CH-1015 Lausanne-Dorigny
| Switzerland
|
| Tel: ++41 (0)21 692-3438
| Fax: ++41 (0)21 692-3305
|
| http://www.hec.unil.ch/jantonakis
| ___________________________________
|
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Oliver, Richard
In reply to this post by JOHN ANTONAKIS
Well, first of all, there's nothing particularly random about group assignment itself. Cases 1-9 will be in group 0, and cases 11-20 will be in group 1. The randomness is in the values of x, and then sorting by x produces the appearance of random group assignment.
 
As for missing data, if you ran Execute  (or some other command that reads the data) prior to Sort, you'd see that the 10th case is missing a group assignment. Why? Because your two IF statements exclude the value of 10. You probably want the first IF statement to be:
 
if (#I <=10) group=0.
 
 

________________________________

From: SPSSX(r) Discussion on behalf of John Antonakis
Sent: Sat 10/28/2006 11:18 AM
To: [hidden email]
Subject: Assigning subjects randomly to groups



Hi:

I am executing the below program (from Shadish, Cook &
Campbell's book) to assign 20 subjects randomly to an
experimental and control group

input program.
loop #I=1 to 20.
if (#I<10) group=0.
if (#I>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
print table/ $casenum group.
execute.

When I run the program (in SPSS ver 14.0), it gives me a
missing value for some of the members of the group. Any
thoughts?

Thanks,
J.

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Dominic Lusinchi
In reply to this post by JOHN ANTONAKIS
John,

Greg is right but your original syntax should read:

input program.
loop #I=1 to 20.
if (#I LE 10) group=0.
if (#I GT 10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
print table/ $casenum group.
execute.

Richard is also correct in saying there's nothing particularly random about
the way your syntax makes the assignment. I think what you are looking for
is the following:

input program.
loop #I=1 to 20.
compute x=uniform(1).
end case.
end loop.
end file.
end input program.
formats x (F8.2).
sort cases by x.
compute id=$casenum .
if (id LE 10) group=0.
if (id GT 10) group=1.
print table/ $casenum group.
execute.

Hope it makes sense.

Cheers,
Dominic

Dominic Lusinchi
Statistician
Far West Research
Statistical Consulting
San Francisco, California
415-664-3032
www.farwestresearch.com
-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
John Antonakis
Sent: Saturday, October 28, 2006 9:18 AM
To: [hidden email]
Subject: Assigning subjects randomly to groups

Hi:

I am executing the below program (from Shadish, Cook &
Campbell's book) to assign 20 subjects randomly to an
experimental and control group

input program.
loop #I=1 to 20.
if (#I<10) group=0.
if (#I>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
print table/ $casenum group.
execute.

When I run the program (in SPSS ver 14.0), it gives me a
missing value for some of the members of the group. Any
thoughts?

Thanks,
J.

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

JOHN ANTONAKIS
Hi Dominic:

Thanks for the comments and the new code. Why precisely, does the old code
not assign randomly?  It seems to me that it generates random numbers,
sorts the numbers, and then assigns individuals to groups based on the
random numbers. For example, I get:

   Group                x
      .00           -1.46
     1.00           -1.40
      .00           -1.16
     1.00            -.51
      .00            -.46
     1.00            -.35
      .00            -.10
      .00             .14
     1.00             .34
     1.00             .56
      .00             .68
      .00             .73
      .00             .76
      .00             .95
     1.00             .97
      .00            1.03
     1.00            1.18
     1.00            1.40
     1.00            1.42
     1.00            2.05

So based on the above, person 1 is assigned to group 0, person 2 to group
1, person 3 to group zero, and so forth.

Also, I don't see how your new code works. When I run it, I get for example:

        x                 id                    group
      .01            1.00                         .00
      .19            2.00                         .00
      .19            3.00                         .00
      .24            4.00                         .00
      .27            5.00                         .00
      .38            6.00                         .00
      .48            7.00                         .00
      .54            8.00                         .00
      .58            9.00                         .00
      .60           10.00                 .00
      .66           11.00            1.00
      .67           12.00            1.00
      .67           13.00            1.00
      .71           14.00            1.00
      .84           15.00            1.00
      .87           16.00            1.00
      .93           17.00            1.00
      .95           18.00            1.00
      .98           19.00            1.00
      .99           20.00            1.00

How does the above constitute random assignment?

Best regards,
John.

At 14:45 28.10.2006 -0700, Dominic Lusinchi wrote:

>John,
>
>Greg is right but your original syntax should read:
>
>input program.
>loop #I=1 to 20.
>if (#I LE 10) group=0.
>if (#I GT 10) group=1.
>compute x=normal(1).
>end case.
>end loop.
>end file.
>end input program.
>sort cases by x.
>print table/ $casenum group.
>execute.
>
>Richard is also correct in saying there's nothing particularly random about
>the way your syntax makes the assignment. I think what you are looking for
>is the following:
>
>input program.
>loop #I=1 to 20.
>compute x=uniform(1).
>end case.
>end loop.
>end file.
>end input program.
>formats x (F8.2).
>sort cases by x.
>compute id=$casenum .
>if (id LE 10) group=0.
>if (id GT 10) group=1.
>print table/ $casenum group.
>execute.
>
>Hope it makes sense.
>
>Cheers,
>Dominic
>
>Dominic Lusinchi
>Statistician
>Far West Research
>Statistical Consulting
>San Francisco, California
>415-664-3032
>www.farwestresearch.com
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>John Antonakis
>Sent: Saturday, October 28, 2006 9:18 AM
>To: [hidden email]
>Subject: Assigning subjects randomly to groups
>
>Hi:
>
>I am executing the below program (from Shadish, Cook &
>Campbell's book) to assign 20 subjects randomly to an
>experimental and control group
>
>input program.
>loop #I=1 to 20.
>if (#I<10) group=0.
>if (#I>10) group=1.
>compute x=normal(1).
>end case.
>end loop.
>end file.
>end input program.
>sort cases by x.
>print table/ $casenum group.
>execute.
>
>When I run the program (in SPSS ver 14.0), it gives me a
>missing value for some of the members of the group. Any
>thoughts?
>
>Thanks,
>J.
>
>___________________________________
>
>Prof. John Antonakis
>School of Management and Economics
>University of Lausanne
>Internef #527
>CH-1015 Lausanne-Dorigny
>Switzerland
>
>Tel: ++41 (0)21 692-3438
>Fax: ++41 (0)21 692-3305
>
>http://www.hec.unil.ch/jantonakis
>___________________________________

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Dominic Lusinchi
John,

The goal, if I understand, is to assign 20 individuals to either a control
group (0) or a treatment group (1) with 10 persons in each group.

First, each individual is assigned a random number between 0 and 1, based on
the uniform distribution. Once these numbers have been assigned, they are
sorted here in ascending order, and then the first ten numbers are assigned
to the control group while the last ten to the treatment.

You will agree, will you not, that each individual is as likely to be in the
control group as in the treatment by virtue of the random number associated
with that individual? In other words, an individual is as likely to be among
the first ten as among the last ten.

In you original code, if I'm correct, you assigned the number 1 to 20 to the
individuals, then you told the program to put the first ten in the control
group (0) and the others in the treatment group (1). This is not a random
assignment. The fact that each individual is assigned, after being placed in
one of the two groups, a random number does not make the group assignment
random. The random number should be assigned first, and then the group
assignment can be accomplished.

Yes?

Dominic

-----Original Message-----
From: John Antonakis [mailto:[hidden email]]
Sent: Sunday, October 29, 2006 1:29 AM
To: [hidden email]
Cc: Dominic Lusinchi
Subject: RE: Assigning subjects randomly to groups

Hi Dominic:

Thanks for the comments and the new code. Why precisely, does the old code
not assign randomly?  It seems to me that it generates random numbers,
sorts the numbers, and then assigns individuals to groups based on the
random numbers. For example, I get:

   Group                x
      .00           -1.46
     1.00           -1.40
      .00           -1.16
     1.00            -.51
      .00            -.46
     1.00            -.35
      .00            -.10
      .00             .14
     1.00             .34
     1.00             .56
      .00             .68
      .00             .73
      .00             .76
      .00             .95
     1.00             .97
      .00            1.03
     1.00            1.18
     1.00            1.40
     1.00            1.42
     1.00            2.05

So based on the above, person 1 is assigned to group 0, person 2 to group
1, person 3 to group zero, and so forth.

Also, I don't see how your new code works. When I run it, I get for example:

        x                 id                    group
      .01            1.00                         .00
      .19            2.00                         .00
      .19            3.00                         .00
      .24            4.00                         .00
      .27            5.00                         .00
      .38            6.00                         .00
      .48            7.00                         .00
      .54            8.00                         .00
      .58            9.00                         .00
      .60           10.00                 .00
      .66           11.00            1.00
      .67           12.00            1.00
      .67           13.00            1.00
      .71           14.00            1.00
      .84           15.00            1.00
      .87           16.00            1.00
      .93           17.00            1.00
      .95           18.00            1.00
      .98           19.00            1.00
      .99           20.00            1.00

How does the above constitute random assignment?

Best regards,
John.

At 14:45 28.10.2006 -0700, Dominic Lusinchi wrote:

>John,
>
>Greg is right but your original syntax should read:
>
>input program.
>loop #I=1 to 20.
>if (#I LE 10) group=0.
>if (#I GT 10) group=1.
>compute x=normal(1).
>end case.
>end loop.
>end file.
>end input program.
>sort cases by x.
>print table/ $casenum group.
>execute.
>
>Richard is also correct in saying there's nothing particularly random about
>the way your syntax makes the assignment. I think what you are looking for
>is the following:
>
>input program.
>loop #I=1 to 20.
>compute x=uniform(1).
>end case.
>end loop.
>end file.
>end input program.
>formats x (F8.2).
>sort cases by x.
>compute id=$casenum .
>if (id LE 10) group=0.
>if (id GT 10) group=1.
>print table/ $casenum group.
>execute.
>
>Hope it makes sense.
>
>Cheers,
>Dominic
>
>Dominic Lusinchi
>Statistician
>Far West Research
>Statistical Consulting
>San Francisco, California
>415-664-3032
>www.farwestresearch.com
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>John Antonakis
>Sent: Saturday, October 28, 2006 9:18 AM
>To: [hidden email]
>Subject: Assigning subjects randomly to groups
>
>Hi:
>
>I am executing the below program (from Shadish, Cook &
>Campbell's book) to assign 20 subjects randomly to an
>experimental and control group
>
>input program.
>loop #I=1 to 20.
>if (#I<10) group=0.
>if (#I>10) group=1.
>compute x=normal(1).
>end case.
>end loop.
>end file.
>end input program.
>sort cases by x.
>print table/ $casenum group.
>execute.
>
>When I run the program (in SPSS ver 14.0), it gives me a
>missing value for some of the members of the group. Any
>thoughts?
>
>Thanks,
>J.
>
>___________________________________
>
>Prof. John Antonakis
>School of Management and Economics
>University of Lausanne
>Internef #527
>CH-1015 Lausanne-Dorigny
>Switzerland
>
>Tel: ++41 (0)21 692-3438
>Fax: ++41 (0)21 692-3305
>
>http://www.hec.unil.ch/jantonakis
>___________________________________

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

JOHN ANTONAKIS
In reply to this post by JOHN ANTONAKIS
Dominic:

Thank you for taking the time to explain this to me.
Unfortunately, I still don't get it (I am certainly
misunderstanding or misexplaining something)! I realize that
what I have done is a "restricted random assignment" of
sorts. If it were really random then I would probably have
unbalanced groups with such a small sample (hence I am
forcing equal sample sizes).

I still don't see how your procedure is works. From the
printout below, person 1 to 10 is assigned to group 0 and
person 11 to 20 to group 1. Where is the random assignment?


         x            id           group
       .01            1.00           .00
       .19            2.00           .00
       .19            3.00           .00
       .24            4.00           .00
       .27            5.00           .00
       .38            6.00           .00
       .48            7.00           .00
       .54            8.00           .00
       .58            9.00           .00
       .60           10.00           .00
       .66           11.00            1.00
       .67           12.00            1.00
       .67           13.00            1.00
       .71           14.00            1.00
       .84           15.00            1.00
       .87           16.00            1.00
       .93           17.00            1.00
       .95           18.00            1.00
       .98           19.00            1.00
       .99           20.00            1.00

If I use the following code, will it make any difference to
you (I am telling SPSS to include the case number--I did not
do that before, but assumed row number to be case
number--perhaps there is where I was not explicit)?

input program.
loop #I=1 to 20.
if (#I<=10) group=0.
if (#I>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
compute id=$casenum.
print table/ $casenum group.
execute.


Could you give it one more shot?

Best,
John.

----- Original Message -----
Expéditeur: "Dominic Lusinchi"
<[hidden email]>
à: "'John Antonakis'" <[hidden email]>,
<[hidden email]>
Sujet: RE: Assigning subjects randomly to groups
Date: Sun, 29 Oct 2006 08:57:57 -0800

> John,
>
> The goal, if I understand, is to assign 20 individuals to
> either a control group (0) or a treatment group (1) with
> 10 persons in each group.
>
> First, each individual is assigned a random number between
> 0 and 1, based on the uniform distribution. Once these
> numbers have been assigned, they are sorted here in
> ascending order, and then the first ten numbers are
> assigned to the control group while the last ten to the
> treatment.
>
> You will agree, will you not, that each individual is as
> likely to be in the control group as in the treatment by
> virtue of the random number associated with that
> individual? In other words, an individual is as likely to
> be among the first ten as among the last ten.
>
> In you original code, if I'm correct, you assigned the
> number 1 to 20 to the individuals, then you told the
> program to put the first ten in the control group (0) and
> the others in the treatment group (1). This is not a
> random assignment. The fact that each individual is
> assigned, after being placed in one of the two groups, a
> random number does not make the group assignment random.
> The random number should be assigned first, and then the
> group assignment can be accomplished.
>
> Yes?
>
> Dominic
>
> -----Original Message-----
> From: John Antonakis [mailto:[hidden email]]
> Sent: Sunday, October 29, 2006 1:29 AM
> To: [hidden email]
> Cc: Dominic Lusinchi
> Subject: RE: Assigning subjects randomly to groups
>
> Hi Dominic:
>
> Thanks for the comments and the new code. Why precisely,
> does the old code  not assign randomly?  It seems to me
> that it generates random numbers,  sorts the numbers, and
> then assigns individuals to groups based on the  random
> numbers. For example, I get:
>
>    Group                x
>       .00           -1.46
>      1.00           -1.40
>       .00           -1.16
>      1.00            -.51
>       .00            -.46
>      1.00            -.35
>       .00            -.10
>       .00             .14
>      1.00             .34
>      1.00             .56
>       .00             .68
>       .00             .73
>       .00             .76
>       .00             .95
>      1.00             .97
>       .00            1.03
>      1.00            1.18
>      1.00            1.40
>      1.00            1.42
>      1.00            2.05
>
> So based on the above, person 1 is assigned to group 0,
> person 2 to group  1, person 3 to group zero, and so
> forth.
>
> Also, I don't see how your new code works. When I run it,
> I get for example:
>
>         x                 id                    group
>       .01            1.00                         .00
>       .19            2.00                         .00
>       .19            3.00                         .00
>       .24            4.00                         .00
>       .27            5.00                         .00
>       .38            6.00                         .00
>       .48            7.00                         .00
>       .54            8.00                         .00
>       .58            9.00                         .00
>       .60           10.00                 .00
>       .66           11.00            1.00
>       .67           12.00            1.00
>       .67           13.00            1.00
>       .71           14.00            1.00
>       .84           15.00            1.00
>       .87           16.00            1.00
>       .93           17.00            1.00
>       .95           18.00            1.00
>       .98           19.00            1.00
>       .99           20.00            1.00
>
> How does the above constitute random assignment?
>
> Best regards,
> John.
>
> At 14:45 28.10.2006 -0700, Dominic Lusinchi wrote:
> >John,
> >
> >Greg is right but your original syntax should read:
> >
> >input program.
> >loop #I=1 to 20.
> >if (#I LE 10) group=0.
> >if (#I GT 10) group=1.
> >compute x=normal(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >sort cases by x.
> >print table/ $casenum group.
> >execute.
> >
> >Richard is also correct in saying there's nothing
> particularly random about >the way your syntax makes the
> assignment. I think what you are looking for >is the
> following: >
> >input program.
> >loop #I=1 to 20.
> >compute x=uniform(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >formats x (F8.2).
> >sort cases by x.
> >compute id=$casenum .
> >if (id LE 10) group=0.
> >if (id GT 10) group=1.
> >print table/ $casenum group.
> >execute.
> >
> >Hope it makes sense.
> >
> >Cheers,
> >Dominic
> >
> >Dominic Lusinchi
> >Statistician
> >Far West Research
> >Statistical Consulting
> >San Francisco, California
> >415-664-3032
> >www.farwestresearch.com
> >-----Original Message-----
> >From: SPSSX(r) Discussion
> [mailto:[hidden email]] On Behalf Of >John
> Antonakis >Sent: Saturday, October 28, 2006 9:18 AM
> >To: [hidden email]
> >Subject: Assigning subjects randomly to groups
> >
> >Hi:
> >
> >I am executing the below program (from Shadish, Cook &
> >Campbell's book) to assign 20 subjects randomly to an
> >experimental and control group
> >
> >input program.
> >loop #I=1 to 20.
> >if (#I<10) group=0.
> >if (#I>10) group=1.
> >compute x=normal(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >sort cases by x.
> >print table/ $casenum group.
> >execute.
> >
> >When I run the program (in SPSS ver 14.0), it gives me a
> >missing value for some of the members of the group. Any
> >thoughts?
> >
> >Thanks,
> >J.
> >
> >___________________________________
> >
> >Prof. John Antonakis
> >School of Management and Economics
> >University of Lausanne
> >Internef #527
> >CH-1015 Lausanne-Dorigny
> >Switzerland
> >
> >Tel: ++41 (0)21 692-3438
> >Fax: ++41 (0)21 692-3305
> >
> >http://www.hec.unil.ch/jantonakis
> >___________________________________
>
> ___________________________________
>
> Prof. John Antonakis
> School of Management and Economics
> University of Lausanne
> Internef #527
> CH-1015 Lausanne-Dorigny
> Switzerland
>
> Tel: ++41 (0)21 692-3438
> Fax: ++41 (0)21 692-3305
>
> http://www.hec.unil.ch/jantonakis
> ___________________________________
>
>
>

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Oliver, Richard
Let's go back to your original example, but instead of the scratch variable #I, we'llcreate a permanent variable ID which is set to the current value of the loop counter. As you can seen from the case listings, the first 10 cases are assigned to group 0, and the second ten case are assigned to group 1. There's nothing random about group assignment. In your example, variable X is completely random, but group assignment is not. In a real experiment, this would be like assigning the first 10 people who walked in the door to one group, and the next 10 people to the other group. That's not random. But since you've then randomly assigned test "results" based on nothing, it really doesn't make any difference.
 
input program.
loop ID=1 to 20.
if (ID<=10) group=0.
if (ID>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by ID.
list.
 
Case listing:
      ID    group        x
    1.00      .00      .01
    2.00      .00     -.88
    3.00      .00     1.52
    4.00      .00     -.27
    5.00      .00     -.01
    6.00      .00     1.36
    7.00      .00     -.21
    8.00      .00     -.32
    9.00      .00      .70
   10.00      .00     -.98
   11.00     1.00      .00
   12.00     1.00     1.06
   13.00     1.00    -1.38
   14.00     1.00     -.28
   15.00     1.00     -.78
   16.00     1.00     -.31
   17.00     1.00    -1.14
   18.00     1.00     1.15
   19.00     1.00     1.35
   20.00     1.00    -1.22


 


________________________________

From: SPSSX(r) Discussion on behalf of John Antonakis
Sent: Sun 10/29/2006 2:12 PM
To: [hidden email]
Subject: Re: Assigning subjects randomly to groups



Dominic:

Thank you for taking the time to explain this to me.
Unfortunately, I still don't get it (I am certainly
misunderstanding or misexplaining something)! I realize that
what I have done is a "restricted random assignment" of
sorts. If it were really random then I would probably have
unbalanced groups with such a small sample (hence I am
forcing equal sample sizes).

I still don't see how your procedure is works. From the
printout below, person 1 to 10 is assigned to group 0 and
person 11 to 20 to group 1. Where is the random assignment?


         x            id           group
       .01            1.00           .00
       .19            2.00           .00
       .19            3.00           .00
       .24            4.00           .00
       .27            5.00           .00
       .38            6.00           .00
       .48            7.00           .00
       .54            8.00           .00
       .58            9.00           .00
       .60           10.00           .00
       .66           11.00            1.00
       .67           12.00            1.00
       .67           13.00            1.00
       .71           14.00            1.00
       .84           15.00            1.00
       .87           16.00            1.00
       .93           17.00            1.00
       .95           18.00            1.00
       .98           19.00            1.00
       .99           20.00            1.00

If I use the following code, will it make any difference to
you (I am telling SPSS to include the case number--I did not
do that before, but assumed row number to be case
number--perhaps there is where I was not explicit)?

input program.
loop #I=1 to 20.
if (#I<=10) group=0.
if (#I>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
compute id=$casenum.
print table/ $casenum group.
execute.


Could you give it one more shot?

Best,
John.

----- Original Message -----
Expéditeur: "Dominic Lusinchi"
<[hidden email]>
à: "'John Antonakis'" <[hidden email]>,
<[hidden email]>
Sujet: RE: Assigning subjects randomly to groups
Date: Sun, 29 Oct 2006 08:57:57 -0800

> John,
>
> The goal, if I understand, is to assign 20 individuals to
> either a control group (0) or a treatment group (1) with
> 10 persons in each group.
>
> First, each individual is assigned a random number between
> 0 and 1, based on the uniform distribution. Once these
> numbers have been assigned, they are sorted here in
> ascending order, and then the first ten numbers are
> assigned to the control group while the last ten to the
> treatment.
>
> You will agree, will you not, that each individual is as
> likely to be in the control group as in the treatment by
> virtue of the random number associated with that
> individual? In other words, an individual is as likely to
> be among the first ten as among the last ten.
>
> In you original code, if I'm correct, you assigned the
> number 1 to 20 to the individuals, then you told the
> program to put the first ten in the control group (0) and
> the others in the treatment group (1). This is not a
> random assignment. The fact that each individual is
> assigned, after being placed in one of the two groups, a
> random number does not make the group assignment random.
> The random number should be assigned first, and then the
> group assignment can be accomplished.
>
> Yes?
>
> Dominic
>
> -----Original Message-----
> From: John Antonakis [mailto:[hidden email]]
> Sent: Sunday, October 29, 2006 1:29 AM
> To: [hidden email]
> Cc: Dominic Lusinchi
> Subject: RE: Assigning subjects randomly to groups
>
> Hi Dominic:
>
> Thanks for the comments and the new code. Why precisely,
> does the old code  not assign randomly?  It seems to me
> that it generates random numbers,  sorts the numbers, and
> then assigns individuals to groups based on the  random
> numbers. For example, I get:
>
>    Group                x
>       .00           -1.46
>      1.00           -1.40
>       .00           -1.16
>      1.00            -.51
>       .00            -.46
>      1.00            -.35
>       .00            -.10
>       .00             .14
>      1.00             .34
>      1.00             .56
>       .00             .68
>       .00             .73
>       .00             .76
>       .00             .95
>      1.00             .97
>       .00            1.03
>      1.00            1.18
>      1.00            1.40
>      1.00            1.42
>      1.00            2.05
>
> So based on the above, person 1 is assigned to group 0,
> person 2 to group  1, person 3 to group zero, and so
> forth.
>
> Also, I don't see how your new code works. When I run it,
> I get for example:
>
>         x                 id                    group
>       .01            1.00                         .00
>       .19            2.00                         .00
>       .19            3.00                         .00
>       .24            4.00                         .00
>       .27            5.00                         .00
>       .38            6.00                         .00
>       .48            7.00                         .00
>       .54            8.00                         .00
>       .58            9.00                         .00
>       .60           10.00                 .00
>       .66           11.00            1.00
>       .67           12.00            1.00
>       .67           13.00            1.00
>       .71           14.00            1.00
>       .84           15.00            1.00
>       .87           16.00            1.00
>       .93           17.00            1.00
>       .95           18.00            1.00
>       .98           19.00            1.00
>       .99           20.00            1.00
>
> How does the above constitute random assignment?
>
> Best regards,
> John.
>
> At 14:45 28.10.2006 -0700, Dominic Lusinchi wrote:
> >John,
> >
> >Greg is right but your original syntax should read:
> >
> >input program.
> >loop #I=1 to 20.
> >if (#I LE 10) group=0.
> >if (#I GT 10) group=1.
> >compute x=normal(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >sort cases by x.
> >print table/ $casenum group.
> >execute.
> >
> >Richard is also correct in saying there's nothing
> particularly random about >the way your syntax makes the
> assignment. I think what you are looking for >is the
> following: >
> >input program.
> >loop #I=1 to 20.
> >compute x=uniform(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >formats x (F8.2).
> >sort cases by x.
> >compute id=$casenum .
> >if (id LE 10) group=0.
> >if (id GT 10) group=1.
> >print table/ $casenum group.
> >execute.
> >
> >Hope it makes sense.
> >
> >Cheers,
> >Dominic
> >
> >Dominic Lusinchi
> >Statistician
> >Far West Research
> >Statistical Consulting
> >San Francisco, California
> >415-664-3032
> >www.farwestresearch.com
> >-----Original Message-----
> >From: SPSSX(r) Discussion
> [mailto:[hidden email]] On Behalf Of >John
> Antonakis >Sent: Saturday, October 28, 2006 9:18 AM
> >To: [hidden email]
> >Subject: Assigning subjects randomly to groups
> >
> >Hi:
> >
> >I am executing the below program (from Shadish, Cook &
> >Campbell's book) to assign 20 subjects randomly to an
> >experimental and control group
> >
> >input program.
> >loop #I=1 to 20.
> >if (#I<10) group=0.
> >if (#I>10) group=1.
> >compute x=normal(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >sort cases by x.
> >print table/ $casenum group.
> >execute.
> >
> >When I run the program (in SPSS ver 14.0), it gives me a
> >missing value for some of the members of the group. Any
> >thoughts?
> >
> >Thanks,
> >J.
> >
> >___________________________________
> >
> >Prof. John Antonakis
> >School of Management and Economics
> >University of Lausanne
> >Internef #527
> >CH-1015 Lausanne-Dorigny
> >Switzerland
> >
> >Tel: ++41 (0)21 692-3438
> >Fax: ++41 (0)21 692-3305
> >
> >http://www.hec.unil.ch/jantonakis
> >___________________________________
>
> ___________________________________
>
> Prof. John Antonakis
> School of Management and Economics
> University of Lausanne
> Internef #527
> CH-1015 Lausanne-Dorigny
> Switzerland
>
> Tel: ++41 (0)21 692-3438
> Fax: ++41 (0)21 692-3305
>
> http://www.hec.unil.ch/jantonakis
> ___________________________________
>
>
>

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

Dominic Lusinchi
In reply to this post by JOHN ANTONAKIS
John,

The "misexplaining" could very well be on my end.

Imagine an urn with 20 balls, 10 of which are "0" balls and the other 10 are
"1" balls. If you have each of the 20 people pick a ball in turn (without
replacement), there are 20!/10!10! or 184756 arrangements, each equally
likely: 00000000001111111111 is one such arrangement.

What "compute x=uniform(1)." does is assign a random number between 0 and 1
to each participant. Once this is done: there is the lowest ten numbers (say
the 0s) and the highest ten (the 1s), but they are in a random order: what
the "sort by" does is to arrange them in ascending order, so we can easily
distinguish them.

The fact that we want to obtain two equal-size groups does not affect the
random assignment.

Perhaps, one way to see that this is a random assignment is to do this in
stages. Let's say you have given each of the participants a number from 1 to
20. Let's do this using:
input program.
loop #I=1 to 20.
compute id=$casenum .
end case.
end loop.
end file.
end input program.
formats id (F8.0).
execute.

The result:

Id
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Now we assign a random number to each individual:
compute x=uniform(1).
formats x (F8.3).
execute.

The data file looks like this now:

id      x
1       .206
2       .773
3       .067
4       .527
5       .662
6       .936
7       .316
8       .523
9       .766
10      .127
11      .559
12      .983
13      .325
14      .536
15      .508
16      .282
17      .347
18      .921
19      .408
20      .096

Now let's manually assign a 0 to the lowest 10 numbers. In Variable View
let's create a new variable called "group". Here is what we get:

id      x   group
1       .206    0
2       .773    .
3       .067    0
4       .527    .
5       .662    .
6       .936    .
7       .316    0
8       .523    .
9       .766    .
10      .127    0
11      .559    .
12      .983    .
13      .325    0
14      .536    .
15      .508    0
16      .282    0
17      .347    0
18      .921    .
19      .408    0
20      .096    0

Now, we can replace each period with a 1, and we have our two groups. The
arrangement is: 01011101101101000100.

The syntax does the same thing, except that we use "sort by" to create the
groups syntactically instead of manually.

So John try this to visualize the process:

Stage 1:
input program.
loop #I=1 to 20.
compute id=$casenum .
end case.
end loop.
end file.
end input program.
formats id (F8.0).
execute.

Stage 2:
compute x=uniform(1).
formats x (F8.3).
execute.

Stage 3: In the data file created so far, create a group variable and in the
Data View, and then manually enter 0s next to the lowest 10 numbers, and 1s
next to the remaining numbers (the highest 10).

Stage 4:
sort cases by x.
compute sid=$casenum .
if (sid LE 10) groups=0.
if (sid GT 10) groups=1.
formats sid groups (F8.0).
execute.

The grouping in "group" (done manually) and "groups" (done syntactically)
should correspond - if you did not make a mistake manually :-)

Hope this clarifies things.
Cheers,
Dominic

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
John Antonakis
Sent: Sunday, October 29, 2006 12:12 PM
To: [hidden email]
Subject: Re: Assigning subjects randomly to groups

Dominic:

Thank you for taking the time to explain this to me.
Unfortunately, I still don't get it (I am certainly
misunderstanding or misexplaining something)! I realize that
what I have done is a "restricted random assignment" of
sorts. If it were really random then I would probably have
unbalanced groups with such a small sample (hence I am
forcing equal sample sizes).

I still don't see how your procedure is works. From the
printout below, person 1 to 10 is assigned to group 0 and
person 11 to 20 to group 1. Where is the random assignment?


         x            id           group
       .01            1.00           .00
       .19            2.00           .00
       .19            3.00           .00
       .24            4.00           .00
       .27            5.00           .00
       .38            6.00           .00
       .48            7.00           .00
       .54            8.00           .00
       .58            9.00           .00
       .60           10.00           .00
       .66           11.00            1.00
       .67           12.00            1.00
       .67           13.00            1.00
       .71           14.00            1.00
       .84           15.00            1.00
       .87           16.00            1.00
       .93           17.00            1.00
       .95           18.00            1.00
       .98           19.00            1.00
       .99           20.00            1.00

If I use the following code, will it make any difference to
you (I am telling SPSS to include the case number--I did not
do that before, but assumed row number to be case
number--perhaps there is where I was not explicit)?

input program.
loop #I=1 to 20.
if (#I<=10) group=0.
if (#I>10) group=1.
compute x=normal(1).
end case.
end loop.
end file.
end input program.
sort cases by x.
compute id=$casenum.
print table/ $casenum group.
execute.


Could you give it one more shot?

Best,
John.

----- Original Message -----
Expéditeur: "Dominic Lusinchi"
<[hidden email]>
à: "'John Antonakis'" <[hidden email]>,
<[hidden email]>
Sujet: RE: Assigning subjects randomly to groups
Date: Sun, 29 Oct 2006 08:57:57 -0800

> John,
>
> The goal, if I understand, is to assign 20 individuals to
> either a control group (0) or a treatment group (1) with
> 10 persons in each group.
>
> First, each individual is assigned a random number between
> 0 and 1, based on the uniform distribution. Once these
> numbers have been assigned, they are sorted here in
> ascending order, and then the first ten numbers are
> assigned to the control group while the last ten to the
> treatment.
>
> You will agree, will you not, that each individual is as
> likely to be in the control group as in the treatment by
> virtue of the random number associated with that
> individual? In other words, an individual is as likely to
> be among the first ten as among the last ten.
>
> In you original code, if I'm correct, you assigned the
> number 1 to 20 to the individuals, then you told the
> program to put the first ten in the control group (0) and
> the others in the treatment group (1). This is not a
> random assignment. The fact that each individual is
> assigned, after being placed in one of the two groups, a
> random number does not make the group assignment random.
> The random number should be assigned first, and then the
> group assignment can be accomplished.
>
> Yes?
>
> Dominic
>
> -----Original Message-----
> From: John Antonakis [mailto:[hidden email]]
> Sent: Sunday, October 29, 2006 1:29 AM
> To: [hidden email]
> Cc: Dominic Lusinchi
> Subject: RE: Assigning subjects randomly to groups
>
> Hi Dominic:
>
> Thanks for the comments and the new code. Why precisely,
> does the old code  not assign randomly?  It seems to me
> that it generates random numbers,  sorts the numbers, and
> then assigns individuals to groups based on the  random
> numbers. For example, I get:
>
>    Group                x
>       .00           -1.46
>      1.00           -1.40
>       .00           -1.16
>      1.00            -.51
>       .00            -.46
>      1.00            -.35
>       .00            -.10
>       .00             .14
>      1.00             .34
>      1.00             .56
>       .00             .68
>       .00             .73
>       .00             .76
>       .00             .95
>      1.00             .97
>       .00            1.03
>      1.00            1.18
>      1.00            1.40
>      1.00            1.42
>      1.00            2.05
>
> So based on the above, person 1 is assigned to group 0,
> person 2 to group  1, person 3 to group zero, and so
> forth.
>
> Also, I don't see how your new code works. When I run it,
> I get for example:
>
>         x                 id                    group
>       .01            1.00                         .00
>       .19            2.00                         .00
>       .19            3.00                         .00
>       .24            4.00                         .00
>       .27            5.00                         .00
>       .38            6.00                         .00
>       .48            7.00                         .00
>       .54            8.00                         .00
>       .58            9.00                         .00
>       .60           10.00                 .00
>       .66           11.00            1.00
>       .67           12.00            1.00
>       .67           13.00            1.00
>       .71           14.00            1.00
>       .84           15.00            1.00
>       .87           16.00            1.00
>       .93           17.00            1.00
>       .95           18.00            1.00
>       .98           19.00            1.00
>       .99           20.00            1.00
>
> How does the above constitute random assignment?
>
> Best regards,
> John.
>
> At 14:45 28.10.2006 -0700, Dominic Lusinchi wrote:
> >John,
> >
> >Greg is right but your original syntax should read:
> >
> >input program.
> >loop #I=1 to 20.
> >if (#I LE 10) group=0.
> >if (#I GT 10) group=1.
> >compute x=normal(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >sort cases by x.
> >print table/ $casenum group.
> >execute.
> >
> >Richard is also correct in saying there's nothing
> particularly random about >the way your syntax makes the
> assignment. I think what you are looking for >is the
> following: >
> >input program.
> >loop #I=1 to 20.
> >compute x=uniform(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >formats x (F8.2).
> >sort cases by x.
> >compute id=$casenum .
> >if (id LE 10) group=0.
> >if (id GT 10) group=1.
> >print table/ $casenum group.
> >execute.
> >
> >Hope it makes sense.
> >
> >Cheers,
> >Dominic
> >
> >Dominic Lusinchi
> >Statistician
> >Far West Research
> >Statistical Consulting
> >San Francisco, California
> >415-664-3032
> >www.farwestresearch.com
> >-----Original Message-----
> >From: SPSSX(r) Discussion
> [mailto:[hidden email]] On Behalf Of >John
> Antonakis >Sent: Saturday, October 28, 2006 9:18 AM
> >To: [hidden email]
> >Subject: Assigning subjects randomly to groups
> >
> >Hi:
> >
> >I am executing the below program (from Shadish, Cook &
> >Campbell's book) to assign 20 subjects randomly to an
> >experimental and control group
> >
> >input program.
> >loop #I=1 to 20.
> >if (#I<10) group=0.
> >if (#I>10) group=1.
> >compute x=normal(1).
> >end case.
> >end loop.
> >end file.
> >end input program.
> >sort cases by x.
> >print table/ $casenum group.
> >execute.
> >
> >When I run the program (in SPSS ver 14.0), it gives me a
> >missing value for some of the members of the group. Any
> >thoughts?
> >
> >Thanks,
> >J.
> >
> >___________________________________
> >
> >Prof. John Antonakis
> >School of Management and Economics
> >University of Lausanne
> >Internef #527
> >CH-1015 Lausanne-Dorigny
> >Switzerland
> >
> >Tel: ++41 (0)21 692-3438
> >Fax: ++41 (0)21 692-3305
> >
> >http://www.hec.unil.ch/jantonakis
> >___________________________________
>
> ___________________________________
>
> Prof. John Antonakis
> School of Management and Economics
> University of Lausanne
> Internef #527
> CH-1015 Lausanne-Dorigny
> Switzerland
>
> Tel: ++41 (0)21 692-3438
> Fax: ++41 (0)21 692-3305
>
> http://www.hec.unil.ch/jantonakis
> ___________________________________
>
>
>

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________
Reply | Threaded
Open this post in threaded view
|

Re: Assigning subjects randomly to groups

JOHN ANTONAKIS
Ah ha!  Now this syntax (Syntax 2) certainly does work:

input program.
loop #I=1 to 20.
compute id=$casenum .
end case.
end loop.
end file.
end input program.
formats id (F8.0).
execute.

compute x=uniform(1).
formats x (F8.3).
execute.

sort cases by x.
compute sid=$casenum .
if (sid LE 10) groups=0.
if (sid GT 10) groups=1.
formats sid groups (F8.0).
execute.

I think that the confusion may have stemmed from the fact that Syntax 2
does not do the same thing as the Syntax 1 you gave me:

input program.
loop #I=1 to 20.
compute x=uniform(1).
end case.
end loop.
end file.
end input program.
formats x (F8.2).
sort cases by x.
compute id=$casenum .
if (id LE 10) group=0.
if (id GT 10) group=1.
print table/ $casenum group.
execute.

As I see it, the problem with Syntax 1 is that you assigned the casenum
AFTER the sort and not BEFORE the sort. That is, if we run Syntax 1 and
bring the compute id=$casenum to the third line, the program works just fine!

input program.
loop #I=1 to 20.
compute id=$casenum .
compute x=uniform(1).
end case.
end loop.
end file.
end input program.
formats x (F8.2).
sort cases by x.
if (id LE 10) group=0.
if (id GT 10) group=1.
print table/ $casenum group.
execute.

Running revised Program 1, gives the following example output:
        ID                  X                    Group
      16.00             .01            1.00
       3.00             .05             .00
      12.00             .23            1.00
      10.00             .26             .00
       4.00             .28             .00
       8.00             .34             .00
      17.00             .35            1.00
      13.00             .41            1.00
       1.00             .45             .00
       9.00             .51             .00
       5.00             .53             .00
       7.00             .54             .00
      20.00             .61            1.00
      14.00             .62            1.00
       6.00             .71             .00
      18.00             .71            1.00
      19.00             .83            1.00
      11.00             .90            1.00
       2.00             .93             .00
      15.00             .94            1.00

However, running old Program 1 gives the following example:
      ID                  X                     Group
      .01            1.00             .00
      .04            2.00             .00
      .09            3.00             .00
      .10            4.00             .00
      .13            5.00             .00
      .28            6.00             .00
      .40            7.00             .00
      .45            8.00             .00
      .48            9.00             .00
      .50           10.00             .00
      .62           11.00            1.00
      .72           12.00            1.00
      .75           13.00            1.00
      .83           14.00            1.00
      .84           15.00            1.00
      .84           16.00            1.00
      .85           17.00            1.00
      .96           18.00            1.00
      .97           19.00            1.00
      .98           20.00            1.00

Is my explanation off?  I think am OK with everything now. Thank you very
much for taking the time to explain everything nicely.

Best,
J.

At 17:13 29.10.2006 -0800, Dominic Lusinchi wrote:

>John,
>
>The "misexplaining" could very well be on my end.
>
>Imagine an urn with 20 balls, 10 of which are "0" balls and the other 10 are
>"1" balls. If you have each of the 20 people pick a ball in turn (without
>replacement), there are 20!/10!10! or 184756 arrangements, each equally
>likely: 00000000001111111111 is one such arrangement.
>
>What "compute x=uniform(1)." does is assign a random number between 0 and 1
>to each participant. Once this is done: there is the lowest ten numbers (say
>the 0s) and the highest ten (the 1s), but they are in a random order: what
>the "sort by" does is to arrange them in ascending order, so we can easily
>distinguish them.
>
>The fact that we want to obtain two equal-size groups does not affect the
>random assignment.
>
>Perhaps, one way to see that this is a random assignment is to do this in
>stages. Let's say you have given each of the participants a number from 1 to
>20. Let's do this using:
>input program.
>loop #I=1 to 20.
>compute id=$casenum .
>end case.
>end loop.
>end file.
>end input program.
>formats id (F8.0).
>execute.
>
>The result:
>
>Id
>1
>2
>3
>4
>5
>6
>7
>8
>9
>10
>11
>12
>13
>14
>15
>16
>17
>18
>19
>20
>
>Now we assign a random number to each individual:
>compute x=uniform(1).
>formats x (F8.3).
>execute.
>
>The data file looks like this now:
>
>id      x
>1       .206
>2       .773
>3       .067
>4       .527
>5       .662
>6       .936
>7       .316
>8       .523
>9       .766
>10      .127
>11      .559
>12      .983
>13      .325
>14      .536
>15      .508
>16      .282
>17      .347
>18      .921
>19      .408
>20      .096
>
>Now let's manually assign a 0 to the lowest 10 numbers. In Variable View
>let's create a new variable called "group". Here is what we get:
>
>id      x   group
>1       .206    0
>2       .773    .
>3       .067    0
>4       .527    .
>5       .662    .
>6       .936    .
>7       .316    0
>8       .523    .
>9       .766    .
>10      .127    0
>11      .559    .
>12      .983    .
>13      .325    0
>14      .536    .
>15      .508    0
>16      .282    0
>17      .347    0
>18      .921    .
>19      .408    0
>20      .096    0
>
>Now, we can replace each period with a 1, and we have our two groups. The
>arrangement is: 01011101101101000100.
>
>The syntax does the same thing, except that we use "sort by" to create the
>groups syntactically instead of manually.
>
>So John try this to visualize the process:
>
>Stage 1:
>input program.
>loop #I=1 to 20.
>compute id=$casenum .
>end case.
>end loop.
>end file.
>end input program.
>formats id (F8.0).
>execute.
>
>Stage 2:
>compute x=uniform(1).
>formats x (F8.3).
>execute.
>
>Stage 3: In the data file created so far, create a group variable and in the
>Data View, and then manually enter 0s next to the lowest 10 numbers, and 1s
>next to the remaining numbers (the highest 10).
>
>Stage 4:
>sort cases by x.
>compute sid=$casenum .
>if (sid LE 10) groups=0.
>if (sid GT 10) groups=1.
>formats sid groups (F8.0).
>execute.
>
>The grouping in "group" (done manually) and "groups" (done syntactically)
>should correspond - if you did not make a mistake manually :-)
>
>Hope this clarifies things.
>Cheers,
>Dominic
>
>-----Original Message-----
>From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
>John Antonakis
>Sent: Sunday, October 29, 2006 12:12 PM
>To: [hidden email]
>Subject: Re: Assigning subjects randomly to groups
>
>Dominic:
>
>Thank you for taking the time to explain this to me.
>Unfortunately, I still don't get it (I am certainly
>misunderstanding or misexplaining something)! I realize that
>what I have done is a "restricted random assignment" of
>sorts. If it were really random then I would probably have
>unbalanced groups with such a small sample (hence I am
>forcing equal sample sizes).
>
>I still don't see how your procedure is works. From the
>printout below, person 1 to 10 is assigned to group 0 and
>person 11 to 20 to group 1. Where is the random assignment?
>
>
>          x            id           group
>        .01            1.00           .00
>        .19            2.00           .00
>        .19            3.00           .00
>        .24            4.00           .00
>        .27            5.00           .00
>        .38            6.00           .00
>        .48            7.00           .00
>        .54            8.00           .00
>        .58            9.00           .00
>        .60           10.00           .00
>        .66           11.00            1.00
>        .67           12.00            1.00
>        .67           13.00            1.00
>        .71           14.00            1.00
>        .84           15.00            1.00
>        .87           16.00            1.00
>        .93           17.00            1.00
>        .95           18.00            1.00
>        .98           19.00            1.00
>        .99           20.00            1.00
>
>If I use the following code, will it make any difference to
>you (I am telling SPSS to include the case number--I did not
>do that before, but assumed row number to be case
>number--perhaps there is where I was not explicit)?
>
>input program.
>loop #I=1 to 20.
>if (#I<=10) group=0.
>if (#I>10) group=1.
>compute x=normal(1).
>end case.
>end loop.
>end file.
>end input program.
>sort cases by x.
>compute id=$casenum.
>print table/ $casenum group.
>execute.
>
>
>Could you give it one more shot?
>
>Best,
>John.
>
>----- Original Message -----
>Expéditeur: "Dominic Lusinchi"
><[hidden email]>
>à: "'John Antonakis'" <[hidden email]>,
><[hidden email]>
>Sujet: RE: Assigning subjects randomly to groups
>Date: Sun, 29 Oct 2006 08:57:57 -0800
>
> > John,
> >
> > The goal, if I understand, is to assign 20 individuals to
> > either a control group (0) or a treatment group (1) with
> > 10 persons in each group.
> >
> > First, each individual is assigned a random number between
> > 0 and 1, based on the uniform distribution. Once these
> > numbers have been assigned, they are sorted here in
> > ascending order, and then the first ten numbers are
> > assigned to the control group while the last ten to the
> > treatment.
> >
> > You will agree, will you not, that each individual is as
> > likely to be in the control group as in the treatment by
> > virtue of the random number associated with that
> > individual? In other words, an individual is as likely to
> > be among the first ten as among the last ten.
> >
> > In you original code, if I'm correct, you assigned the
> > number 1 to 20 to the individuals, then you told the
> > program to put the first ten in the control group (0) and
> > the others in the treatment group (1). This is not a
> > random assignment. The fact that each individual is
> > assigned, after being placed in one of the two groups, a
> > random number does not make the group assignment random.
> > The random number should be assigned first, and then the
> > group assignment can be accomplished.
> >
> > Yes?
> >
> > Dominic
> >
> > -----Original Message-----
> > From: John Antonakis [mailto:[hidden email]]
> > Sent: Sunday, October 29, 2006 1:29 AM
> > To: [hidden email]
> > Cc: Dominic Lusinchi
> > Subject: RE: Assigning subjects randomly to groups
> >
> > Hi Dominic:
> >
> > Thanks for the comments and the new code. Why precisely,
> > does the old code  not assign randomly?  It seems to me
> > that it generates random numbers,  sorts the numbers, and
> > then assigns individuals to groups based on the  random
> > numbers. For example, I get:
> >
> >    Group                x
> >       .00           -1.46
> >      1.00           -1.40
> >       .00           -1.16
> >      1.00            -.51
> >       .00            -.46
> >      1.00            -.35
> >       .00            -.10
> >       .00             .14
> >      1.00             .34
> >      1.00             .56
> >       .00             .68
> >       .00             .73
> >       .00             .76
> >       .00             .95
> >      1.00             .97
> >       .00            1.03
> >      1.00            1.18
> >      1.00            1.40
> >      1.00            1.42
> >      1.00            2.05
> >
> > So based on the above, person 1 is assigned to group 0,
> > person 2 to group  1, person 3 to group zero, and so
> > forth.
> >
> > Also, I don't see how your new code works. When I run it,
> > I get for example:
> >
> >         x                 id                    group
> >       .01            1.00                         .00
> >       .19            2.00                         .00
> >       .19            3.00                         .00
> >       .24            4.00                         .00
> >       .27            5.00                         .00
> >       .38            6.00                         .00
> >       .48            7.00                         .00
> >       .54            8.00                         .00
> >       .58            9.00                         .00
> >       .60           10.00                 .00
> >       .66           11.00            1.00
> >       .67           12.00            1.00
> >       .67           13.00            1.00
> >       .71           14.00            1.00
> >       .84           15.00            1.00
> >       .87           16.00            1.00
> >       .93           17.00            1.00
> >       .95           18.00            1.00
> >       .98           19.00            1.00
> >       .99           20.00            1.00
> >
> > How does the above constitute random assignment?
> >
> > Best regards,
> > John.
> >
> > At 14:45 28.10.2006 -0700, Dominic Lusinchi wrote:
> > >John,
> > >
> > >Greg is right but your original syntax should read:
> > >
> > >input program.
> > >loop #I=1 to 20.
> > >if (#I LE 10) group=0.
> > >if (#I GT 10) group=1.
> > >compute x=normal(1).
> > >end case.
> > >end loop.
> > >end file.
> > >end input program.
> > >sort cases by x.
> > >print table/ $casenum group.
> > >execute.
> > >
> > >Richard is also correct in saying there's nothing
> > particularly random about >the way your syntax makes the
> > assignment. I think what you are looking for >is the
> > following: >
> > >input program.
> > >loop #I=1 to 20.
> > >compute x=uniform(1).
> > >end case.
> > >end loop.
> > >end file.
> > >end input program.
> > >formats x (F8.2).
> > >sort cases by x.
> > >compute id=$casenum .
> > >if (id LE 10) group=0.
> > >if (id GT 10) group=1.
> > >print table/ $casenum group.
> > >execute.
> > >
> > >Hope it makes sense.
> > >
> > >Cheers,
> > >Dominic
> > >
> > >Dominic Lusinchi
> > >Statistician
> > >Far West Research
> > >Statistical Consulting
> > >San Francisco, California
> > >415-664-3032
> > >www.farwestresearch.com
> > >-----Original Message-----
> > >From: SPSSX(r) Discussion
> > [mailto:[hidden email]] On Behalf Of >John
> > Antonakis >Sent: Saturday, October 28, 2006 9:18 AM
> > >To: [hidden email]
> > >Subject: Assigning subjects randomly to groups
> > >
> > >Hi:
> > >
> > >I am executing the below program (from Shadish, Cook &
> > >Campbell's book) to assign 20 subjects randomly to an
> > >experimental and control group
> > >
> > >input program.
> > >loop #I=1 to 20.
> > >if (#I<10) group=0.
> > >if (#I>10) group=1.
> > >compute x=normal(1).
> > >end case.
> > >end loop.
> > >end file.
> > >end input program.
> > >sort cases by x.
> > >print table/ $casenum group.
> > >execute.
> > >
> > >When I run the program (in SPSS ver 14.0), it gives me a
> > >missing value for some of the members of the group. Any
> > >thoughts?
> > >
> > >Thanks,
> > >J.
> > >
> > >___________________________________
> > >
> > >Prof. John Antonakis
> > >School of Management and Economics
> > >University of Lausanne
> > >Internef #527
> > >CH-1015 Lausanne-Dorigny
> > >Switzerland
> > >
> > >Tel: ++41 (0)21 692-3438
> > >Fax: ++41 (0)21 692-3305
> > >
> > >http://www.hec.unil.ch/jantonakis
> > >___________________________________
> >
> > ___________________________________
> >
> > Prof. John Antonakis
> > School of Management and Economics
> > University of Lausanne
> > Internef #527
> > CH-1015 Lausanne-Dorigny
> > Switzerland
> >
> > Tel: ++41 (0)21 692-3438
> > Fax: ++41 (0)21 692-3305
> >
> > http://www.hec.unil.ch/jantonakis
> > ___________________________________
> >
> >
> >
>
>___________________________________
>
>Prof. John Antonakis
>School of Management and Economics
>University of Lausanne
>Internef #527
>CH-1015 Lausanne-Dorigny
>Switzerland
>
>Tel: ++41 (0)21 692-3438
>Fax: ++41 (0)21 692-3305
>
>http://www.hec.unil.ch/jantonakis
>___________________________________

___________________________________

Prof. John Antonakis
School of Management and Economics
University of Lausanne
Internef #527
CH-1015 Lausanne-Dorigny
Switzerland

Tel: ++41 (0)21 692-3438
Fax: ++41 (0)21 692-3305

http://www.hec.unil.ch/jantonakis
___________________________________