How can I Randomize Groups of Questions? and if possible put weightage to some groups

Hi,

I have successfully implemented ODK with Google App engine and everything
is working fine.

Now, I want to show sub-set of questions with randomness to eliminate the
possibility of biasing for some questions.

I searched and found at some places that I can create groups with different
questions and then randomize them and show just one group in one instance
of survey. I have created the groups, nut, I can not figure out how to
randomly show just one from these groups.

Also it would be great if I can put some weightage (say 40% - 30% -15% -
15%) to groups so it is shown more often than others in the batch of
surveys.

Please guide me how can I randomize the groups.

Thank you.

Regards,
Shobhit

Hi Shobhit,

Maybe this example provides some ideas you could
use: https://docs.google.com/a/enketo.org/spreadsheets/d/1LcZjtD7avaegTsZg8WOYrhqrfNpEdFxwxSDME0W3QJ8/edit#gid=2091024441

Cheers,
Martijn

ยทยทยท On Saturday, April 4, 2015 at 8:10:23 AM UTC-6, Shobhit Prabhakar wrote: > > Hi, > > I have successfully implemented ODK with Google App engine and everything > is working fine. > > Now, I want to show sub-set of questions with randomness to eliminate the > possibility of biasing for some questions. > > I searched and found at some places that I can create groups with > different questions and then randomize them and show just one group in one > instance of survey. I have created the groups, nut, I can not figure out > how to randomly show just one from these groups. > > Also it would be great if I can put some weightage (say 40% - 30% -15% - > 15%) to groups so it is shown more often than others in the batch of > surveys. > > Please guide me how can I randomize the groups. > > Thank you. > > Regards, > Shobhit > > > > > -- -- *Revolutionizing data collection since 2012.*

Enketo https://enketo.org/ | LinkedIn
http://www.linkedin.com/company/enketo-llc | GitHub
https://github.com/enketo | Twitter https://twitter.com/enketo
| Blog http://blog.enketo.org/

Hi Martijn,

Thank you so much for the help. It really helped me understanding how I can
implement random function in ODK.

As an alternative to reduce biasing I was thinking that instead of creating
Group of questions I can create one Single-Select option and using the data
from it to populate further questions. But I want to automatically and
randomly select one option and hide this question from user. I have created
a simple form to show it.
Now, I think selected() can be used to select one option after generating a
random number, but I am pretty confused how to do it. Here is how I want to
implement it:

https://lh3.googleusercontent.com/-o0N1nF6WnqA/VSbESQH46cI/AAAAAAAAQMI/-TVTT92pak4/s1600/random-select.jpg
sample XML file is attached.

Please take a look and guide me if this is possible.

Thanks again. :slight_smile:

Random select one option.xml (2.1 KB)

ยทยทยท On Monday, 6 April 2015 21:24:59 UTC+5:30, Martijn van de Rijdt wrote: > > Hi Shobhit, > > Maybe this example provides some ideas you could use: > https://docs.google.com/a/enketo.org/spreadsheets/d/1LcZjtD7avaegTsZg8WOYrhqrfNpEdFxwxSDME0W3QJ8/edit#gid=2091024441 > > Cheers, > Martijn > > On Saturday, April 4, 2015 at 8:10:23 AM UTC-6, Shobhit Prabhakar wrote: >> >> Hi, >> >> I have successfully implemented ODK with Google App engine and everything >> is working fine. >> >> Now, I want to show sub-set of questions with randomness to eliminate the >> possibility of biasing for some questions. >> >> I searched and found at some places that I can create groups with >> different questions and then randomize them and show just one group in one >> instance of survey. I have created the groups, nut, I can not figure out >> how to randomly show just one from these groups. >> >> Also it would be great if I can put some weightage (say 40% - 30% -15% - >> 15%) to groups so it is shown more often than others in the batch of >> surveys. >> >> Please guide me how can I randomize the groups. >> >> Thank you. >> >> Regards, >> Shobhit >> >> >> >> >> > -- > *Revolutionizing data collection since 2012.* > > Enketo | LinkedIn > | GitHub > | Twitter > | Blog >

Hi Shobhit,

If you have 4 options you can create random number from 0-3 or 1-4 with
round(), random() and mod (as in the GDocs example).

You can add a space-separated string as a default value for a hidden
question (if you're hand-coding xml, you can just add a node to the first
instance with this value, without any bind or body element): "Aldi Amazon
Google McDonald's".

Then use selected-at() with the random number to pick a value from the
above string. Make sure to wrap this calculation inside once() (as in the
GDocs example), because you have to always assume that any calculated items
can be re-calculated at any time.

That's the easiest way I can think of to do this.

Hope that helps,
Martijn

ยทยทยท On Thu, Apr 9, 2015 at 12:30 PM, Shobhit Prabhakar wrote:

Hi Martijn,

Thank you so much for the help. It really helped me understanding how I
can implement random function in ODK.

As an alternative to reduce biasing I was thinking that instead of
creating Group of questions I can create one Single-Select option and using
the data from it to populate further questions. But I want to automatically
and randomly select one option and hide this question from user. I have
created a simple form to show it.
Now, I think selected() can be used to select one option after generating
a random number, but I am pretty confused how to do it. Here is how I want
to implement it:

https://lh3.googleusercontent.com/-o0N1nF6WnqA/VSbESQH46cI/AAAAAAAAQMI/-TVTT92pak4/s1600/random-select.jpg
sample XML file is attached.

Please take a look and guide me if this is possible.

Thanks again. :slight_smile:

On Monday, 6 April 2015 21:24:59 UTC+5:30, Martijn van de Rijdt wrote:

Hi Shobhit,

Maybe this example provides some ideas you could use:
https://docs.google.com/a/enketo.org/spreadsheets/d/
1LcZjtD7avaegTsZg8WOYrhqrfNpEdFxwxSDME0W3QJ8/edit#gid=2091024441

Cheers,
Martijn

On Saturday, April 4, 2015 at 8:10:23 AM UTC-6, Shobhit Prabhakar wrote:

Hi,

I have successfully implemented ODK with Google App engine and
everything is working fine.

Now, I want to show sub-set of questions with randomness to eliminate
the possibility of biasing for some questions.

I searched and found at some places that I can create groups with
different questions and then randomize them and show just one group in one
instance of survey. I have created the groups, nut, I can not figure out
how to randomly show just one from these groups.

Also it would be great if I can put some weightage (say 40% - 30% -15% -
15%) to groups so it is shown more often than others in the batch of
surveys.

Please guide me how can I randomize the groups.

Thank you.

Regards,
Shobhit

--
Revolutionizing data collection since 2012.

Enketo https://enketo.org/ | LinkedIn
http://www.linkedin.com/company/enketo-llc | GitHub
https://github.com/enketo | Twitter https://twitter.com/enketo
| Blog http://blog.enketo.org/

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/0GLJXZtXdVU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Revolutionizing data collection since 2012.

Enketo https://enketo.org/ | LinkedIn
http://www.linkedin.com/company/enketo-llc | GitHub
https://github.com/enketo | Twitter https://twitter.com/enketo
| Blog http://blog.enketo.org/

If you're using XLSForm, you can create the hidden value with a
type=calculate and calculation='Aldi Amazon Google McDonald"s' (make
sure to copy the quotation marks in your XLSForm - and you may have to
start with an additional quotation mark to tell GDocs Excel that the first
quotation mark is part of the content).

ยทยทยท On Thu, Apr 9, 2015 at 2:48 PM, Martijn van de Rijdt wrote:

Hi Shobhit,

If you have 4 options you can create random number from 0-3 or 1-4 with
round(), random() and mod (as in the GDocs example).

You can add a space-separated string as a default value for a hidden
question (if you're hand-coding xml, you can just add a node to the first
instance with this value, without any bind or body element): "Aldi Amazon
Google McDonald's".

Then use selected-at() with the random number to pick a value from the
above string. Make sure to wrap this calculation inside once() (as in the
GDocs example), because you have to always assume that any calculated items
can be re-calculated at any time.

That's the easiest way I can think of to do this.

Hope that helps,
Martijn

On Thu, Apr 9, 2015 at 12:30 PM, Shobhit Prabhakar cyber.mitra@gmail.com wrote:

Hi Martijn,

Thank you so much for the help. It really helped me understanding how I
can implement random function in ODK.

As an alternative to reduce biasing I was thinking that instead of
creating Group of questions I can create one Single-Select option and using
the data from it to populate further questions. But I want to automatically
and randomly select one option and hide this question from user. I have
created a simple form to show it.
Now, I think selected() can be used to select one option after generating
a random number, but I am pretty confused how to do it. Here is how I want
to implement it:

https://lh3.googleusercontent.com/-o0N1nF6WnqA/VSbESQH46cI/AAAAAAAAQMI/-TVTT92pak4/s1600/random-select.jpg
sample XML file is attached.

Please take a look and guide me if this is possible.

Thanks again. :slight_smile:

On Monday, 6 April 2015 21:24:59 UTC+5:30, Martijn van de Rijdt wrote:

Hi Shobhit,

Maybe this example provides some ideas you could use:
https://docs.google.com/a/enketo.org/spreadsheets/d/
1LcZjtD7avaegTsZg8WOYrhqrfNpEdFxwxSDME0W3QJ8/edit#gid=2091024441

Cheers,
Martijn

On Saturday, April 4, 2015 at 8:10:23 AM UTC-6, Shobhit Prabhakar wrote:

Hi,

I have successfully implemented ODK with Google App engine and
everything is working fine.

Now, I want to show sub-set of questions with randomness to eliminate
the possibility of biasing for some questions.

I searched and found at some places that I can create groups with
different questions and then randomize them and show just one group in one
instance of survey. I have created the groups, nut, I can not figure out
how to randomly show just one from these groups.

Also it would be great if I can put some weightage (say 40% - 30% -15%

  • 15%) to groups so it is shown more often than others in the batch of
    surveys.

Please guide me how can I randomize the groups.

Thank you.

Regards,
Shobhit

--
Revolutionizing data collection since 2012.

Enketo https://enketo.org/ | LinkedIn
http://www.linkedin.com/company/enketo-llc | GitHub
https://github.com/enketo | Twitter https://twitter.com/enketo
| Blog http://blog.enketo.org/

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to a topic in the
Google Groups "ODK Community" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/opendatakit/0GLJXZtXdVU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Revolutionizing data collection since 2012.

Enketo https://enketo.org/ | LinkedIn
http://www.linkedin.com/company/enketo-llc | GitHub
https://github.com/enketo | Twitter https://twitter.com/enketo
| Blog http://blog.enketo.org/

thanks for the example @martijnr. Could you elaborate on how mod works to generate a random number? I get what the function does, but how is it different than using the standard once(int(7*random())+1) to generate a random number?

Hi @colonus, I don't think there is an advantage to using mod here. Your method seems great!

2 Likes