- Posts: 15
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
randomization a group of questions and limiting with quota
- Surveyteam7
- Topic Author
- Offline
- New Member
Less
More
4 years 1 month ago #195500
by Surveyteam7
randomization a group of questions and limiting with quota was created by Surveyteam7
Hi;
we are going to conduct a social research and I need serious help on a problem that we couldn't find a solution.
we prepared our questionnaire with no problem but for a specific social test model we need to create a group of questions including 216 questions and see how people will react to these situations.
what is requested from us is to ask each participant only 6 of those questions chosen randomly among 216.
Our test group will be 2.200 participants. with a quick calculation if we can limit each question to be asked maximum 61 times and close to not to be asked/shown again will be helpful for equal distribution among 216.
FYI: this is a project about immigrants in coordination with a university.
If you have any kind of solution for this we would really appreciate.
Is this something can be done.
Thanks in advance for all your kind help.
we are going to conduct a social research and I need serious help on a problem that we couldn't find a solution.
we prepared our questionnaire with no problem but for a specific social test model we need to create a group of questions including 216 questions and see how people will react to these situations.
what is requested from us is to ask each participant only 6 of those questions chosen randomly among 216.
Our test group will be 2.200 participants. with a quick calculation if we can limit each question to be asked maximum 61 times and close to not to be asked/shown again will be helpful for equal distribution among 216.
FYI: this is a project about immigrants in coordination with a university.
If you have any kind of solution for this we would really appreciate.
Is this something can be done.
Thanks in advance for all your kind help.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
4 years 1 month ago #195506
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic randomization a group of questions and limiting with quota
Hi,
this question is often answered here.
Create two groups of questions (G1 & G2)
Group G2 is set to "hidden" (relevance equation "0")
In G1 you create the first six questions, in G2 the rest (210).
All questions get the same "randomization group name".
That's all for the first part.
Your second question is more complicated and you had to use a more sophisticated approach.
Unfortunately LimeSurvey has not the best quota management.
Therefore you may use an ajax call to query the database and return randomly six questions - skipping questions asked already 61 times.
I'd recommend to do this manually.
Watch the naswer table.
If one question has already 61 answers, remove the "randomization group name" and set the relevance to "0".
Joffm
this question is often answered here.
Create two groups of questions (G1 & G2)
Group G2 is set to "hidden" (relevance equation "0")
In G1 you create the first six questions, in G2 the rest (210).
All questions get the same "randomization group name".
That's all for the first part.
Your second question is more complicated and you had to use a more sophisticated approach.
Unfortunately LimeSurvey has not the best quota management.
Therefore you may use an ajax call to query the database and return randomly six questions - skipping questions asked already 61 times.
I'd recommend to do this manually.
Watch the naswer table.
If one question has already 61 answers, remove the "randomization group name" and set the relevance to "0".
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 1 month ago #195514
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic randomization a group of questions and limiting with quota
LimeSUrvey 4.X can get the number of answered answers :
github.com/LimeSurvey/LimeSurvey/blob/4f...tions/config.xml#L14
But i don't see how to manage it with the 6 question in not hidden group ...
if you use countIf(qcode.sgqa) <= 61 : it was hidden even if it's the group to be shown.
Maybe an alternate solution
1. Survey in question by question mode (or 1 question by group)
2.. Add a numeric hidden question at 1st position, code COUNT
3. Set all your questions randomized
4. Between each question : add 2 equation question (not randomized), X is the number incremented
4a. 1st is incrementX {COUNT=if(doneX,COUNT,sum(COUNT,1))}
4b. 2nd is doneX with equation 1
5. Each ransomize question (randX) have relevance set to «COUNT <= 6 and countIf(randX.sgqa) <= 61»
To be tested, start by a more simple survey (5/6 questions).
But i don't see how to manage it with the 6 question in not hidden group ...
if you use countIf(qcode.sgqa) <= 61 : it was hidden even if it's the group to be shown.
Maybe an alternate solution
1. Survey in question by question mode (or 1 question by group)
2.. Add a numeric hidden question at 1st position, code COUNT
3. Set all your questions randomized
4. Between each question : add 2 equation question (not randomized), X is the number incremented
4a. 1st is incrementX {COUNT=if(doneX,COUNT,sum(COUNT,1))}
4b. 2nd is doneX with equation 1
5. Each ransomize question (randX) have relevance set to «COUNT <= 6 and countIf(randX.sgqa) <= 61»
To be tested, start by a more simple survey (5/6 questions).
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- Surveyteam7
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
4 years 1 month ago #195524
by Surveyteam7
Replied by Surveyteam7 on topic randomization a group of questions and limiting with quota
Thank you so much for your kind help although it seems a little complicated to me but I will try to do your suggestions.
In the meantime I have another question regarding this issue.
What if we create this question as only 1 question? is it easier to solve this issue?
below there is a picture prepared as Array type F.
Can this work and done?
Thanks
In the meantime I have another question regarding this issue.
What if we create this question as only 1 question? is it easier to solve this issue?
below there is a picture prepared as Array type F.
Can this work and done?
Thanks
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
4 years 1 month ago #195527
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic randomization a group of questions and limiting with quota
You CAN do that.
Then you may have a small javascript snippet, that selects the 6 out of 216.
In a question of type "short text" (Q1)
like this:
and set the relevance of each subquestion to
1st. strpos(Q1,',1,')>0
2nd. strpos(Q1,',2,')>0
3rd. strpos(Q1,',3,')>0
...
last strpos(Q1,',216,')>0
But to be honest.
In my opinion my first solution is easy to handle and is faster than this one.
Because it takes time to load the page with 216 items and then calculate the relevance and hide 210 of them.
And the counting of answers is the same.
In this example you could remove the code of the "full" questions from the array in the javascript manually.
Joffm
Then you may have a small javascript snippet, that selects the 6 out of 216.
In a question of type "short text" (Q1)
like this:
Code:
<script type="text/javascript" charset="utf-8"> function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ // Fill the array var arr1 =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,...,210,211,212,213,214,215,216]; arr1 = shuffle(arr1); anumbers = '#,' + arr1.slice(0,6).join(',')+ ','; // $('#question{QID} input[type="text"]').val(anumbers); $('#question{QID} input[type="text"]').val(anumbers).trigger('keyup'); $('#question{QID}').hide(); }); </script>
and set the relevance of each subquestion to
1st. strpos(Q1,',1,')>0
2nd. strpos(Q1,',2,')>0
3rd. strpos(Q1,',3,')>0
...
last strpos(Q1,',216,')>0
But to be honest.
In my opinion my first solution is easy to handle and is faster than this one.
Because it takes time to load the page with 216 items and then calculate the relevance and hide 210 of them.
And the counting of answers is the same.
In this example you could remove the code of the "full" questions from the array in the javascript manually.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Surveyteam7
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
4 years 1 month ago #195543
by Surveyteam7
Replied by Surveyteam7 on topic randomization a group of questions and limiting with quota
Dear Joffm;
I tried your script but somehow I couldn't make it work, I think am doing something wrong.
Could you please be so kind to help I attached the questionnaire.
Thanks a lot in advance.
I tried your script but somehow I couldn't make it work, I think am doing something wrong.
Could you please be so kind to help I attached the questionnaire.
Thanks a lot in advance.
Attachments:
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
4 years 1 month ago #195551
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic randomization a group of questions and limiting with quota
Well, that's obvious.
You saw this in the script.
var arr1 =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,...,210,211,212,213,214,215,216];
Here you have to add the missing values.
Okay, in the attached example I inserted the values 1-100. The rest is up to you.
BUT:
As I said before, the display of your grid takes a long time.
about 6 seconds to calculate the random values, then the entire grid is displayed, and 50 seconds to display the correct grid (only six questions)
So I do not understand why you do not use the first solution
Therefore I added a small example about that (2 out of 10)
Joffm
You saw this in the script.
var arr1 =[1,2,3,4,5,6,7,8,9,10,11,12,13,14,...,210,211,212,213,214,215,216];
Here you have to add the missing values.
Okay, in the attached example I inserted the values 1-100. The rest is up to you.
BUT:
As I said before, the display of your grid takes a long time.
about 6 seconds to calculate the random values, then the entire grid is displayed, and 50 seconds to display the correct grid (only six questions)
So I do not understand why you do not use the first solution
Therefore I added a small example about that (2 out of 10)
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Surveyteam7
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
4 years 1 month ago #195555
by Surveyteam7
Replied by Surveyteam7 on topic randomization a group of questions and limiting with quota
Thank you so much. I will import your revised file immediately.
In your 1st solution I was afraid of not randomizing all options because we have to choose first 6 and it sounded more complicated to solve for me.
after testing with a pilot survey of your second solution and if it does take too much time I will try your suggestion.
Thanks again.
In your 1st solution I was afraid of not randomizing all options because we have to choose first 6 and it sounded more complicated to solve for me.
after testing with a pilot survey of your second solution and if it does take too much time I will try your suggestion.
Thanks again.
The topic has been locked.
- Surveyteam7
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
4 years 1 month ago #195556
by Surveyteam7
Replied by Surveyteam7 on topic randomization a group of questions and limiting with quota
Thanks for your kind reply and help DenisChenu.
It is always nice to know that we can ask for help here and always get best support.
It is always nice to know that we can ask for help here and always get best support.
The topic has been locked.
- Surveyteam7
- Topic Author
- Offline
- New Member
Less
More
- Posts: 15
- Thank you received: 0
4 years 1 month ago #195557
by Surveyteam7
Replied by Surveyteam7 on topic randomization a group of questions and limiting with quota
And Joffm thank you so much for your support and sharing your know-how. It is good to know that people like you are always helping when we need it.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 1 month ago #195587
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic randomization a group of questions and limiting with quota
In an array : it can be different.
Can you tell us your LimeSurvey version ?
Can you tell us your LimeSurvey version ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.