Welcome to the LimeSurvey Community Forum

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

Randomize versions or matrix questions

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 3 days ago #251441 by Vic1107
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Version 5.6.38
Own server or LimeSurvey hosting:
Survey theme/template:
==================
(Write here your question/remark)

 Hello everyone I am trying to ask a question with some promotions, what I am looking for is to have 6 promotions as I show in my image,



Each promotion is made up of 3 categories, 1- Benefits2- Term3- Amount That is to say, in a promotion it may appear: Benefit - Annual rate of 7% for the first 3 months (3 additional points to the base rate)Term - Have the investment for at least 1 monthAmount - From $1,000 to less than $5,000 Thus, what is sought is to show 6 promotions on a single screen and for the interviewee to select 1 promotion or, if applicable, "None of these" But what is really stopping me is that for these promotions I have a file with 50 versions and scenarios that I must show depending on the version, to randomize the 50 versions that I have for the promotions I can use the expression if(is_empty(randnumber.NAOK) , rand(1, 50), randnumber.NAOK) which creates a random number between 1 and 50. but in each version and scenario different promotions are shown. I could set the 50 versions and with their scenarios and show them depending on the version that gives me the expression "randnumber" but this will make my survey become huge and more complicated to read. Does anyone have an idea to know if it is possible to reduce this? That is, how to have a few versions and expressly show my promotions depending on my file. I attach the file where I have the version hosted and what codes each promotion consists of so that you can have a better overview of the problem.Excuse me, my English is not very good.

Thank you all
Attachments:

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 2 days ago #251453 by Joffm
Replied by Joffm on topic Randomize versions or matrix questions
Hi, some more questions.
In your pdf you show 5 Conjoints, each with 5 scenarios. -> 25 

What do you want to display at the end?
You wrote about a random number (1-50)

Each combination of conjoint and scenario (always the same random number)?
Or what?


To display the randomly selected values you nearly have everything you need
Create a question of type long text (QPool) and insert your  "cards" of the pdf as "default values"
Like this 
Conjoint 1, scenario 1, row 01-50
1101B23341112256944535
1102532925714451C16843
...
1150C46355812524431133

You see - to avoid two digits - I used 10 = A, 11 = B 12 = C

To find the row according to conjoint scenario and randon number, use  equations like
a. identifier: {join(conjoint,scenario,if(randomnumber<10,'0',''),randomnumber)}
b. row: {substr(QPool,strpos(QPool,identifier)+4,18)}

And in your HTML table you also use ExpressionScript to pipe the correct text (with nested IFs)
{if(substr(row,0,1)=="1","Sin regalo",​​​​​​​if(substr(row,0,1)=="2","Boletos de cine",​​​​​​​if(substr(row,0,1)=="3","Artículos electrónicos sin marca (Ej: bocina)",...., ​​​​​​​if(substr(row,0,1)=="C","Tasa anual de 8% los primeros 3 meses (4 puntos adicionales a la tasa base)",""))))))))))))}

{if(substr(row,1,1)=="1","Sin restricción del tiempo que deben dejar el dinero ahorrado",​​​​​​​if(substr(row,1,1)=="2","Tener la inversión al menos 1 mes",​​​​​​​if(substr(row,1,1)=="3","Tener la inversión al menos 3 meses",...., ​​​​​​​
...
​​​​​​​This way you only need to create as many pages as you want to show.

This is very rough.
Therefore you'd explain better the meaning of conjoint (1-5) and scenatio (1-5)

And provide a lss export of these relevant questions.
Then we can show better.
I think nobody will construct this HTML table.

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 2 days ago #251472 by Vic1107
Replied by Vic1107 on topic Randomize versions or matrix questions
Hello Joffm.

Thank you very much for your response, it helps a lot to find the way.

Answering your question, the 5 scenarios are only fixed, what I really want is to show randomly are the "versions" so I thought I could set those 50 versions in fixed questions and show them randomly with the rannumber between 1 and 50.

but I think that is not the way because it would make the variables enormous.

On the other hand seeing your great help.

I have some doubts, what is really going to be done is that the interviewees do not select the codes

That is, the interviewee will see 25 scenarios with 6 promotions each, there are 5 different conjoints with 5 scenarios of possible promotions.

Now the version is how the codes should be displayed, these are already fixed.

The question should be taking Version 1 as an example:

Q1. Do any of these promotions when opening your savings account generate more interest for you?

Promotion 1:
Benefit - (code 11) Annual rate of 7% for the first 3 months (3 additional points to the base rate)
Term - (code 2) Have the investment for at least 1 month
Amount - (Code 3) From $1,000 to less than $5,000

What this does is that it becomes a single response option with this combination of Benefit, Term and Amount.

So you should have 7 possible answers for scenario 1.

1- Promotion 1
2- Promotion 2
3- Promotion 3
4- Promotion 4
5- Promotion 5
6- Promotion 6
7- None of these.


PS: I'm trying to find what question I can use to show promotions.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 2 days ago - 6 months 2 days ago #251476 by Joffm
Replied by Joffm on topic Randomize versions or matrix questions

Answering your question, the 5 scenarios are only fixed, what I really want is to show randomly are the "versions" so I thought I could set those 50 versions in fixed questions and show them randomly with the rannumber between 1 and 50.

This is silly, so forget about it!


So, in short
the interviewee will see 25 scenarios, five of each conjoint, as shown in the pdf, one row of each section.
And this is always the same row?
So one random number is sufficient.

I'm trying to find what question I can use to show promotions.

Sorry, I think you show it in yout HTML table.
Here a screenshot where we selected random pairs out of 100 different routes and entered the values dynamically..
 
So it is rather easy. 


So, as asked before.
Send the lss export.
I won't create the question with the table to show you an example.

Help us to help you.

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 months 2 days ago by Joffm.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago - 6 months 1 day ago #251528 by Joffm
Replied by Joffm on topic Randomize versions or matrix questions
Here a small example of the logic.
 

 

File Attachment:

File Name: limesurvey...8899.lss
File Size:95 KB


I did not use your model, but created it randomly with an Excel macro, but with the 12-5-6 vombinations.

Now the presentation.

PS: I'm trying to find what question I can use to show promotions.

Does it mean, the screenshot you showed was notof  your question?
Well, in this case have a look at these many examples
The base of all: "green apple - banana"
[url] forums.limesurvey.org/forum/can-i-do-thi...ions-in-a-box#194429 [/url]

Some more threads about it
[url] forums.limesurvey.org/forum/can-i-do-thi...ther-question#251026 [/url]

[url] forums.limesurvey.org/forum/design-issue...te-choice-experiment [/url]

Now it's your turn.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 6 months 1 day ago by Joffm.

Please Log in to join the conversation.

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 1 day ago #251550 by Vic1107
Replied by Vic1107 on topic Randomize versions or matrix questions
Hello Joffm,

Thank you very much for your great help.

I adjusted the HTML table to achieve the layout of my question.

I imported your example that you shared with me and also adjusted the default responses with my complete model from my PDF.

I have a couple of doubts after this.

I understand that the question

row11
row12
row13
....

row21
row22
row23
...

row31
row32
row33
....


row41
row42
row43
....

row51
row52
row53
....

It shows me the 25 scenarios I have per version. So I need to set all 25 variables for this to be achieved, is that how I create it?

And one more question:
In the ExpressionScript of my table text in HTML, I see that we start with if(substr(row11, 0, 1)

if(substr(row11, 1, 1)

if(substr(row11, 2, 1)

if(substr(row11, 3, 1)

if(substr(row11, 4, 1)

.....

if(substr(row11, 48, 1)

if(substr(row11, 49, 1)

Starting with 0, 1) will take my cap to 49, 1)

Is it also correct how I interpret it?

I share with you my example of a survey in lss, to know if everything is fine.

Again, thank you very much for your great help.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 1 day ago #251561 by Joffm
Replied by Joffm on topic Randomize versions or matrix questions
Hi, looks fine,
but

.....

if(substr(row11, 48, 1)

if(substr(row11, 49, 1)
 

No, you see each row only contaions 18 digits (the 18 items you want to display in one question)
So the end is if(substr(row11, 17, 1)
As you did it.

But you did not enter the script to insert the radio buttons into your table.
This is the first thing. Well, I entered into the first question "Q11"
 

The only things you have to do is:
  • Create the groups (25)
  • Copy the quations "rowXY" and the question "QXY"
  • In the equations "rowXY" exchange  {substr(QPool,strpos(QPool,'#11'+if(rn<10,'0','')+rn)+5,18)} to the actual row.
    Like "row32": {substr(QPool,strpos(QPool,'#32'+if(rn<10,'0','')+rn)+5,18)}
  • In the following questions Q11-Q15,Q21-Q25,...,Q51-Q55 exchange the variable "rowXY" to the actual row.
    Easy done with the "search/replace" button in the source code

    or in the "normal" editor
     

And of course you should revise the code of your table.
This "grandfather" example is really not the very best.
Here a thread (really long) that also starts with "green apple - banana" but then we come to something quite different (page 3ff)
[url] forums.limesurvey.org/forum/design-issue...ased-previous-answer [/url]

Joffm

By the way: Why did you enter "randnumber==400"?

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 months 20 hours ago #251576 by Joffm
Replied by Joffm on topic Randomize versions or matrix questions
Here an idea how it could look like
 
As you can imagine this is hard to handle on smartphones.
Either you use the bootstrap class "table-responsive", meaning you surround your table with
Code:
<div class="table-responsive">
<table class="table">
...
</table>
</div>
This will result in a horizontally scrollable table
 

or a very sophisticated approach.
With the library "tiny-slider"
[url] github.com/ganlanyuan/tiny-slider [/url]

 

To be honest. I really doubt that somebody vcan compare six items.

Joffm



 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 months 17 hours ago #251582 by Vic1107
Replied by Vic1107 on topic Randomize versions or matrix questions
Hello Joffm,

Many thanks for everything.

I'm going to adjust my 25 questions and look for a way to adjust my html table, if I saw that I was missing the script for the spokes.

The randnumber==400 thing was only to hide my quick group, hehe

The last option you give me as an example looks prettier, I'm going to look for the thread to see if I can adjust it like this.

I'm going to work on this and tell you how it goes.

I very much appreciate your valuable time.

Please Log in to join the conversation.

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 months 4 weeks ago #251620 by Vic1107
Replied by Vic1107 on topic Randomize versions or matrix questions
Hello Joffm.

I hope you are well.

I tell you that with your great help everything is going well with my model, I have been working with my html table and everything works very well.

But now a doubt arose in my mind.

We have 50 versions that rotate with each other with what you shared with me:
{if(is_empty(rn),rand(1.50),rn)}

And all very well, but when we are in production I must balance the versions so that they all have the same number of responses.

That is to say: I want each version to have a maximum of 10 responses. How can I achieve this to be able to balance it?

Thanks again for everything.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 4 weeks ago #251635 by Joffm
Replied by Joffm on topic Randomize versions or matrix questions
Hi,
at first: a random number is a random number
You may check in Excel the outcomes of 500 respondents.
I got a variance from 5 to 16, which is what you can expect if you have a look at the confidence intervall of 10 (95%)

Well, there are some other options.
First idea:
1. respondent -> group 1
2. respondent -> group 2
...
50. respondent -> grouip 50
51. respondent -> group 1
...

Here you may use the {SAVEDID} and calculate the group.
{SAVEDID-50*floor((SAVEDID-1)/50)}
BUT: Beware of terminations.

Second idea:
Use only completed surveys.
In your version (5.x.) you have the plugin "statFunctions"
[url] manual.limesurvey.org/StatFunctions [/url]
Count the completed surveys and calculate the group nearly equally.
BUT:
As long as the first respondent didn't complete, all go into group 1.
So it depends a lot on the length if the survey and the way the respondents start to answer.

Third idea:
If you have a closed survey, you may consider to preselect the respondents.
Each gets an additional attribute with the group.
Your grandmother may decide who goes into which group.

Fourth idea:
Add an equation after the randomization, where you may switch respondents to other groups
Like
{if(randnum==12,27,if(randnum==17,31,if(randnum==42,45,randnum)))}
Meaning:
If group 12 is filled, switch these respondents to group 27
If group 17 is filled, switch these respondents to group 31
If group 42 is filled, switch these respondents to group 45
else do nothing.
And use this equation to select the display.

Do you pay your respondents?
If not:
Wait till you got enough reponses.
Remove the overquota at random.

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose