Millisecond Forums

Question about randomisation

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

By Hanna_Wolf2022 - 12/4/2022

I am struggling with implementing randomization in my experiment. 
The layout of the study is the following: 
My participants must be randomly assigned to start with one sequence of trials. After that, they still have to complete the sequence that hasn't been chosen to ensure counterbalancing in the long run. 
Currently, my script looks like this for the randomization:

<expt>
/ blocks =
if(values.selector == 0){
    return [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
}    
else{
    return [1 = Practice_EmotionalStroop;2 = EmotionalStroopGerman;3 = EmotionalStroopEnglish; 4 = finish;]
}
</expt>

I also changed something in the value section to ensure the randomization of the selector:

/selector = round(rand(0, 1))

At the moment my experiment always starts in English.

In general, all participants have to go through the practice trial first, then they should be randomly allocated to start the experiment in English or German first. Afterward, they still have to go through the trial/block that they haven't been allocated to in the first place.
I have no experience in programming and I chose an already-written script from the millisecond library and changed it to my needs. Except for this part, all is working fine.

Thanks for any help! 
By Dave - 12/5/2022

Hanna_Wolf2022 - 12/4/2022
I am struggling with implementing randomization in my experiment. 
The layout of the study is the following: 
My participants must be randomly assigned to start with one sequence of trials. After that, they still have to complete the sequence that hasn't been chosen to ensure counterbalancing in the long run. 
Currently, my script looks like this for the randomization:

<expt>
/ blocks =
if(values.selector == 0){
    return [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
}    
else{
    return [1 = Practice_EmotionalStroop;2 = EmotionalStroopGerman;3 = EmotionalStroopEnglish; 4 = finish;]
}
</expt>

I also changed something in the value section to ensure the randomization of the selector:

/selector = round(rand(0, 1))

At the moment my experiment always starts in English.

In general, all participants have to go through the practice trial first, then they should be randomly allocated to start the experiment in English or German first. Afterward, they still have to go through the trial/block that they haven't been allocated to in the first place.
I have no experience in programming and I chose an already-written script from the millisecond library and changed it to my needs. Except for this part, all is working fine.

Thanks for any help! 

The blocks attribute doesn't work like that, you can't do if-else expressions in it.

What you need to do is simply set up two conditions, i.e. two <expts>. Then assign participants randomly to one.

// english first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
/ groups = (1 of 2)
</expt>

// german first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopGerman; 3 = EmotionalStroopEnglish; 4 = finish;]
/ groups = (2 of 2)
</expt>
By Hanna_Wolf2022 - 12/5/2022

Dave - 12/5/2022
Hanna_Wolf2022 - 12/4/2022
I am struggling with implementing randomization in my experiment. 
The layout of the study is the following: 
My participants must be randomly assigned to start with one sequence of trials. After that, they still have to complete the sequence that hasn't been chosen to ensure counterbalancing in the long run. 
Currently, my script looks like this for the randomization:

<expt>
/ blocks =
if(values.selector == 0){
    return [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
}    
else{
    return [1 = Practice_EmotionalStroop;2 = EmotionalStroopGerman;3 = EmotionalStroopEnglish; 4 = finish;]
}
</expt>

I also changed something in the value section to ensure the randomization of the selector:

/selector = round(rand(0, 1))

At the moment my experiment always starts in English.

In general, all participants have to go through the practice trial first, then they should be randomly allocated to start the experiment in English or German first. Afterward, they still have to go through the trial/block that they haven't been allocated to in the first place.
I have no experience in programming and I chose an already-written script from the millisecond library and changed it to my needs. Except for this part, all is working fine.

Thanks for any help! 

The blocks attribute doesn't work like that, you can't do if-else expressions in it.

What you need to do is simply set up two conditions, i.e. two <expts>. Then assign participants randomly to one.

// english first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
/ groups = (1 of 2)
</expt>

// german first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopGerman; 3 = EmotionalStroopEnglish; 4 = finish;]
/ groups = (2 of 2)
</expt>

Thanks for the reply!
My experiment will be completely online and there will be a questionnaire first which leads to the reaction task afterward. I do not manually assign participants myself. Can I tell the script to assign the participants randomly itself?
By Dave - 12/5/2022

Hanna_Wolf2022 - 12/5/2022
Dave - 12/5/2022
Hanna_Wolf2022 - 12/4/2022
I am struggling with implementing randomization in my experiment. 
The layout of the study is the following: 
My participants must be randomly assigned to start with one sequence of trials. After that, they still have to complete the sequence that hasn't been chosen to ensure counterbalancing in the long run. 
Currently, my script looks like this for the randomization:

<expt>
/ blocks =
if(values.selector == 0){
    return [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
}    
else{
    return [1 = Practice_EmotionalStroop;2 = EmotionalStroopGerman;3 = EmotionalStroopEnglish; 4 = finish;]
}
</expt>

I also changed something in the value section to ensure the randomization of the selector:

/selector = round(rand(0, 1))

At the moment my experiment always starts in English.

In general, all participants have to go through the practice trial first, then they should be randomly allocated to start the experiment in English or German first. Afterward, they still have to go through the trial/block that they haven't been allocated to in the first place.
I have no experience in programming and I chose an already-written script from the millisecond library and changed it to my needs. Except for this part, all is working fine.

Thanks for any help! 

The blocks attribute doesn't work like that, you can't do if-else expressions in it.

What you need to do is simply set up two conditions, i.e. two <expts>. Then assign participants randomly to one.

// english first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
/ groups = (1 of 2)
</expt>

// german first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopGerman; 3 = EmotionalStroopEnglish; 4 = finish;]
/ groups = (2 of 2)
</expt>

Thanks for the reply!
My experiment will be completely online and there will be a questionnaire first which leads to the reaction task afterward. I do not manually assign participants myself. Can I tell the script to assign the participants randomly itself?

You can configure that in the web experiment's settings when you upload your files. You'll want to select random group ID generation and indicate the number of groups as 2.
By Hanna_Wolf2022 - 12/5/2022

Dave - 12/5/2022
Hanna_Wolf2022 - 12/5/2022
Dave - 12/5/2022
Hanna_Wolf2022 - 12/4/2022
I am struggling with implementing randomization in my experiment. 
The layout of the study is the following: 
My participants must be randomly assigned to start with one sequence of trials. After that, they still have to complete the sequence that hasn't been chosen to ensure counterbalancing in the long run. 
Currently, my script looks like this for the randomization:

<expt>
/ blocks =
if(values.selector == 0){
    return [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
}    
else{
    return [1 = Practice_EmotionalStroop;2 = EmotionalStroopGerman;3 = EmotionalStroopEnglish; 4 = finish;]
}
</expt>

I also changed something in the value section to ensure the randomization of the selector:

/selector = round(rand(0, 1))

At the moment my experiment always starts in English.

In general, all participants have to go through the practice trial first, then they should be randomly allocated to start the experiment in English or German first. Afterward, they still have to go through the trial/block that they haven't been allocated to in the first place.
I have no experience in programming and I chose an already-written script from the millisecond library and changed it to my needs. Except for this part, all is working fine.

Thanks for any help! 

The blocks attribute doesn't work like that, you can't do if-else expressions in it.

What you need to do is simply set up two conditions, i.e. two <expts>. Then assign participants randomly to one.

// english first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopEnglish; 3 = EmotionalStroopGerman; 4 = finish;]
/ groups = (1 of 2)
</expt>

// german first
<expt>
/ blocks = [1 = Practice_EmotionalStroop; 2 = EmotionalStroopGerman; 3 = EmotionalStroopEnglish; 4 = finish;]
/ groups = (2 of 2)
</expt>

Thanks for the reply!
My experiment will be completely online and there will be a questionnaire first which leads to the reaction task afterward. I do not manually assign participants myself. Can I tell the script to assign the participants randomly itself?

You can configure that in the web experiment's settings when you upload your files. You'll want to select random group ID generation and indicate the number of groups as 2.

Thank you!!