Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Randomize using gender and rand(1,2)

  • bridvh
  • bridvh's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #196654 by bridvh
Randomize using gender and rand(1,2) was created by bridvh
Hi! Im trying to figure out a problem with my survey - different question groups should be shown to the participant based on gender and a random number.

My first question (group1) uses the equation {rand(1,2)} to assign the participant a random number, either 1 (photo) or 2 (video). In the next question (sex3), the participant needs to select his/her gender (f=1, m=2). Following the questions, I created 4 question groups, these should be displayed as follows: Group 1 (f, 1), Group 2 (m, 1), Group 3 (f, 2) and Group 4 (m, 2). By this, I aim to only display one of the four groups to the participant.

I used the following relevance equations for the questions assigned to the respective groups:
Group 1: ((sex3 == 1 && group1 == 1))
Group 2: ((sex3 == 2 && group1 == 1))
Group 3: ((sex3 == 1 && group1 == 2))
Group 4: ((sex3 == 2 && group1 == 2))

For some reason, the survey correctly choses the question groups based on gender, but does not take into account the random number created in group1.

I've looked into this forum quite extensively but couldn't manage to find a solution to my problem. Does anyone here know what causes this issue? I would be really thankful, if someone could help me fix this :)

To make it a little easier, I attached the lss file including the 4 question groups:

File Attachment:

File Name: limesurvey...idvh.lss
File Size:274 KB


Thank you!!!
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196656 by holch
Replied by holch on topic Randomize using gender and rand(1,2)
So you are giving us a survey with 83 different questions in 8 different question groups and expect us to work our way through this? Ideally you just provide us with an example that only highlights your problem. Often, this already solves the problem because within your simplified survey, you can see the problem easier yourself.

On the first glimpse what I am seeing is the creation of your random number that could cause problems.

The way you have it, you create a random number, yes. But everytime the question is called, it starts the randomizing process again. So the right code would be something like this:
Code:
{if(is_empty(randnumber.NAOK), rand(1,2), randnumber.NAOK)}

This guarantees that the randomnumber is only created once. First the code checks if the random number has been created. If it is empty, it creates the random number, if it is not empty, it leaves the value as is.

I would bet that this is your problem.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #196664 by Joffm
Replied by Joffm on topic Randomize using gender and rand(1,2)
holch's assumption is absolutely correct.
A random number is generated and displayed in your first question, but since you display "group by group", this random number is changed again when you answer each further question (similar to EXCEL).
This means that at the end of the group the current number no longer has to match the one shown at the beginning.
Therefore we use that construct, which means:
"If the randomnumber is still empty, create one; otherwise leave it as it is".


Some general things to add:
1. As I see your four groups only show different photos/videos. The questions are equal and don't depend on the group.
So it should be sufficient, only to show the photos/videos with relevance equation and the following question general to all.
This eases statistical tests like t-Tests, ANOVA ,etc. because all responses to one question are in one variable.

2. What happens if the user enters 3 as agegroup and after seeing the message "You are too old, Thank you" doesn't care and proceeds entering the next age as 21?
Same with the instagram profile.
Here you ought to use quotas to screen out these respondents.

3. If somebody "feels" as "other" gender, which group?

4. In my opinion a general "group by group" display is not the best.
We recommend to use this, but with only that many questions per group as you want to show one one page.
As you ill see yourself, the display of these story groups with 15 questions is a bit deterrent and entices to look at the questions later asked, which can cause a bias, or even a termination

For more we should discuss this in the German part - if you want to. That's without a language gap.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months ago #196666 by holch
Replied by holch on topic Randomize using gender and rand(1,2)

For more we should discuss this in the German part - if you want to. That's without a language gap.

As if you have a [strike]gender[/strike]* language gap. You answer in the German, English, Spanish and Portuguese forum. I have a suspicion that you also answer in the Dutch and the French forum, but I never look into those. And today you reported a message in Russion as spam... Is there any language you don't at least speak a little bit????

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 3 years 11 months ago by holch. Reason: * hahahaha, of course we are not talking about gender gap...
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months ago #196685 by Joffm
Replied by Joffm on topic Randomize using gender and rand(1,2)
Example (lss) in the German part.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 11 months ago by Joffm.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose