Conjoint Experiment

Hello there!

Can we design program for conjoint experiment in Kobo? In my questionnaire, there are 4 attributes and each has different values. We will have to ask 4 rounds to each respondent and each round will contain a pair of process. But again we have to randomize both attributes and values simultaneously. I have attached sample question below.
Please anyone can walk me through!!
Conjoint|573x500

You can readily randomize the order of presented options in a select question using https://docs.opendatakit.org/form-operators-functions/#randomize.

However you cannot (presently) readily randomize the actual order of presented questions in a form. [there are some hacks that will appear to present the same questions in a psuedo-random order, but these are rather burdomsome to implement]

@Xiphware Thank you!
What I wanted to do is there are 4 attributes and each has different values like,
attributes-1 has
value-1
value-2
value-3
value-4
value-5
value-6
attribute-2 has
value-1
value-2
value-3
attribute-3 has
value-1
value-2
Now for the first round, I wanted to make a pair which will contain randomly assign a value of the corresponding attributes and named them as Process-1 and Process-2. Let say
Process-1
attribute-1 [value-3]
attribute-2 [value-2]
attribute-3 [value-1]
Process-2
attribute-1 [value-1]
attribute-2 [value-3]
attribute-3 [value-2]
the respondent will choose these processes and will give a number ranging from 0-10 [0= No support at all, 10= total support]. Similarly, for the second round, I want to randomize both attributes and values. like,
Process-1
attribute-2 [value-3]
attribute-1 [value-5]
attribute-3 [vaue-2]
Process-2
attribute-2 [value-2]
attribute-1 [value-3]
attribute-3 [value-1]
in this way, we will have up to four rounds. In each round, attributes should be in the same order but different from the previous, however, values should randomly assign in each process.
Does it make sense to you?
Have a great day!!!

There are a number of different ways to randomly get a value from a list… the simplest is probably to put all your values in a space-separated string - say, values - and then do the following:

selected-at(${values}, int(random()*count-selected(${values})))

(see selected-at(), count-selected(), random() for details)

Have a play with the following form; it’ll randomly display one of your values each time you run it. Hopefully you should be able to adapt/extend it to your needs:

random.xls (5.5 KB)

2 Likes

Thank you @Xiphware I will try and get back to you all. I want to upload my xls file but it does not allow me to do so, saying you are new user!!

Here I also want to generate 2 random number at a time out of 6 numbers.
once(int(6*(random())+1) gives a random number at a time, is there any way to generate 2 numbers instead of one?

I assume you want to randomly pick 2 different numbers, out of 6 possible, correct? [mathematically this is quite different than independently generating 2 random numbers]

1 Like

I assume you want to randomly pick 2 different numbers, out of 6 possible, correct?
Yes, Exactly.

OR

Can I generate a random number that’s different from previously generated, on the nex field?

For example

rand1=once(int(6*(random())+1)=let say =1

then in the next feild

rand2=once(int(6*(random())+1)= either of 2 to 6.

we should have

rand1 != rand2

Have a great day!

Unfortunately, this is a much harder problem… Picking a (single) random number is easy, as easy as throwing a dart at a dartboard. Picking two random numbers is just as easy as throwing two darts at a dartboard. But picking two different random numbers (from a discrete set) entails throwing two different darts at two different dartboards! [the second dartboard conveniently not containing the number you first hit].

Unfortunately this doesn’t actually help. You still need to generate a new random number, one which differs, but there’s as always a finite probability of generating the same number as before. So technically you could end up having to re-generate the second random number an indeterminate number of times till you get one that is actually different (think flipping a coin - exactly how many times do you have to flip it till you get a result that differs from the first flip?).

But moving on from STATS101… :slight_smile: One approach - if you have a relatively small set of possible numbers - is to generate list of all possible permutations; eg for 4 numbers: “1-2 1-3 1-4 2-1 2-3 2-4 3-1 3-2 3-4 4-1 4-2 4-3”, use the earlier solution to pick one at random, and then extract the two selected numbers from the result (hint: use substring-before() and substring-after()). Its a bit brute force but it should get the job done and ensure both randomness and that the two numbers will be unique.

BTW, I do know of another solution, one that exploits the ODK randomize() function, but unfortunately this only works under Enketo and doesn’t work with ODK Collect/KoboCollect (yet…)

1 Like

Hi @Xiphware!
4 numbers: “1-2 1-3 1-4 2-1 2-3 2-4 3-1 3-2 3-4 4-1 4-2 4-3” it seems quite tedious :blush:
I did it in CSpro and it produces perfect result for rand1 != rand2

for rand1 in the first field:
PROC random1
Preproc
random1= random (1,6);

for rand2 in the second field:

PROC rand2
preproc
rand2= random (1,6);
while
visualvalue ($)= rand1 do
rand2= random (1,6);
enddo;

Yes, but alas KoBoCollect doesn’t support while loops… :frowning:

[also, there’s an infinitesimally small probability that your while loop will never terminate… :grin: ]

1 Like