By csteck  1/18/2023
I am doing an experiment where I need to assign participants to one of two prime conditions based on their sub id (even or odd) and response to a question. I am using a branch function to assign this, and all conditions, except for the last work correctly and generate the appropriate prime condition. The branch is
<surveypage TESTpage> / questions = [1=Parent1; 2=Parent2] / branch = [if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent1.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent2.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent2Prime] / branch = [else if(radiobuttons.Parent2.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent2Prime] </surveypage>
this last branch goes to Parent1Prime even though I ask it to go to Parent2Prime condition. All the other branches work, so I am not sure where the issue might be? Any guidance on how to fix this is so appreciated! :)

By Dave  1/18/2023
+xI am doing an experiment where I need to assign participants to one of two prime conditions based on their sub id (even or odd) and response to a question. I am using a branch function to assign this, and all conditions, except for the last work correctly and generate the appropriate prime condition. The branch is <surveypage TESTpage> / questions = [1=Parent1; 2=Parent2] / branch = [if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent1.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent2.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent2Prime] / branch = [else if(radiobuttons.Parent2.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent2Prime] </surveypage> this last branch goes to Parent1Prime even though I ask it to go to Parent2Prime condition. All the other branches work, so I am not sure where the issue might be? Any guidance on how to fix this is so appreciated! :) What you have there is not valid branch syntax. I'm not even sure how
if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0)
is supposed to be interpreted. You can't jumble two ifs together like this. In plain language, what is the conditiion here supposed to be?

By csteck  1/18/2023
The condition is supposed to be if the response to Parent1 question is Black/African American and if the subject id is odd then the page shown should be parent 1 prime. Does that make sense?

By Dave  1/18/2023
+x+xI am doing an experiment where I need to assign participants to one of two prime conditions based on their sub id (even or odd) and response to a question. I am using a branch function to assign this, and all conditions, except for the last work correctly and generate the appropriate prime condition. The branch is <surveypage TESTpage> / questions = [1=Parent1; 2=Parent2] / branch = [if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent1.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent2.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent2Prime] / branch = [else if(radiobuttons.Parent2.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent2Prime] </surveypage> this last branch goes to Parent1Prime even though I ask it to go to Parent2Prime condition. All the other branches work, so I am not sure where the issue might be? Any guidance on how to fix this is so appreciated! :) What you have there is not valid branch syntax. I'm not even sure how if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0) is supposed to be interpreted. You can't jumble two ifs together like this. In plain language, what is the conditiion here supposed to be? Also, the way you use mod() does not make sense. If you want to know whether an ID is odd or even, you take it modulo 2. Always. You then check the remainder, i.e,
if (mod(script.subjectid, 2)==1) > the ID is odd. if (mod(script.subjectid,2)==0) > the ID is even
It never makes sense to take the iD modulo 1. The remainder of any integer taken modulo 1 is always 0. That is mod(script.subjectid, 1) is 0 for any ID, be it odd or even.

By Dave  1/18/2023
+x+x+xI am doing an experiment where I need to assign participants to one of two prime conditions based on their sub id (even or odd) and response to a question. I am using a branch function to assign this, and all conditions, except for the last work correctly and generate the appropriate prime condition. The branch is <surveypage TESTpage> / questions = [1=Parent1; 2=Parent2] / branch = [if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent1.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent1Prime] / branch = [else if(radiobuttons.Parent2.response=="Black / African American") if (mod(script.subjectid, 1)==0)surveypage.Parent2Prime] / branch = [else if(radiobuttons.Parent2.response=="White / Caucasian") if (mod(script.subjectid, 2)==0)surveypage.Parent2Prime] </surveypage> this last branch goes to Parent1Prime even though I ask it to go to Parent2Prime condition. All the other branches work, so I am not sure where the issue might be? Any guidance on how to fix this is so appreciated! :) What you have there is not valid branch syntax. I'm not even sure how if(radiobuttons.Parent1.response=="Black / African American") if (mod(script.subjectid, 1)==0) is supposed to be interpreted. You can't jumble two ifs together like this. In plain language, what is the conditiion here supposed to be? Also, the way you use mod() does not make sense. If you want to know whether an ID is odd or even, you take it modulo 2. Always. You then check the remainder, i.e, if (mod(script.subjectid, 2)==1) > the ID is odd. if (mod(script.subjectid,2)==0) > the ID is even It never makes sense to take the iD modulo 1. The remainder of any integer taken modulo 1 is always 0. That is mod(script.subjectid, 1) is 0 for any ID, be it odd or even. > The condition is supposed to be if the response to Parent1 question is Black/African American and if the subject id is odd then the page shown should be parent 1 prime.
/ branch = [if(radiobuttons.Parent1.response=="Black / African American" && mod(script.subjectid, 2)==1)surveypage.Parent1Prime]

