Welcome, Guest
Username: Password: Remember me

TOPIC: Data Loss with randomization

Data Loss with randomization 2 years 3 months ago #83557

  • cliff
  • cliff's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 3
  • Karma: 0
Salutations folks,

I am running a survey with wording experiments. For example, in one of the question groups I randomize whether respondents will receive one of the following treatments:

7-1a: Do you support or oppose that the provincial government sets minimum prices for alcoholic beverages?

7-1b: Do you support or oppose that the provincial government sets minimum prices for alcoholic beverages in order to discourage excessive drinking?

7-1c: Do you support or oppose that the provincial government sets minimum prices for alcoholic beverages in order to help domestic producers compete against cheaper imports?

In order to set the randomization I use an equation, 7-1u, which is set to {rand(1,3)} and then the three treatments are ((7-1u.NAOK == "1")) for 7-1a, ((7-1u.NAOK == "2")) for 7-1b, and ((7-1u.NAOK == "3")) for 7-1c.

The survey functions as designed. The randomization works, but only some user inputs appear in the dataset. I've yet to determine a pattern as to why respondent data is recorded for some records and not others, but the rest of the data appears to be in tact. This only seems to happen with questions where I employ this type of randomization. Although this data loss is not even consistent among respondents. For example, data on one question randomization is recorded, but not for another randomization within the same record.

You can see for yourself at surveys.votecompass.ca/index.php?sid=327...oken=m5qgewqyy4dpxj5.

I am using LimeSurvey Version 1.92+ Build 120704.

Any advice you could offer would be greatly appreciated.
Last Edit: 2 years 3 months ago by cliff. Reason: Spelling error
The administrator has disabled public write access.

Re: Data Loss with randomization 2 years 3 months ago #83558

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6472
  • Thank you received: 855
  • Karma: 254
Hello,

7-1.lu is on the same page ?
How do you set the random number ?

I think it's best to use another group/page for randomisation, for example a first group with all randomisation.

Denis
PS: can you export the group (lsg file) and put it in the forum.
The administrator has disabled public write access.
The following user(s) said Thank You: cliff

Re: Data Loss with randomization 2 years 3 months ago #83561

  • cliff
  • cliff's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 3
  • Karma: 0
Thank you for your reply, Denis.

7-1u is indeed on the same page. I set the randomization using an equation which is set as {rand(1,3)}.

I can certainly set all the randomizations in a separate (first) group, but does that explain the data loss?

I have attached the group LSG file as per your request.

File Attachment:

File Name: limesurvey_group_15.lsg
File Size: 45 KB
The administrator has disabled public write access.

Re: Data Loss with randomization 2 years 3 months ago #83562

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
cliff-

See this example.

The problem is that {rand(1,3)} is that expressions may be called up to three times per page: (1) prior to load (via PHP), (2) during load (via JavaScript), and (3) during save (via PHP). So, rand() will yield different values each time.

The solution is to create one or more Equations to hold the random value, and to use the metaphor shown in that example to ensure that the random value is only generated once. Say the variable is called 'ask1', the value for the Equation would be:
{if(ask1 >= 1,ask1,rand(1,3))}

That way, if ask1 has already been set, you get it's existing value, otherwise it is set to the value of a random number.
The administrator has disabled public write access.
The following user(s) said Thank You: cliff

Re: Data Loss with randomization 2 years 3 months ago #83573

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6472
  • Thank you received: 855
  • Karma: 254
Yep,

It's why i think it's best to use a 1st page for all alea ;).

And use this first group like a welcome page if it's not needed.

Denis
The administrator has disabled public write access.

Re: Data Loss with randomization 2 years 3 months ago #83593

  • cliff
  • cliff's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 3
  • Karma: 0
Dear TMSWhite,

Thank you for your response; it does appear to explain the data loss. I endeavoured to implement your solution over Denis' because the survey is already active and in the field, so I did not want to deactivate and then reactivate it. But when I tried to implement your solution it did not work. For example, I entered the following equation:

{if(7-1u >= 1,7-1u,rand(1,3))}

This had the effect of crashing the question group page.

Thank you again for your assistance.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.148 seconds
Donation Image