CS计算机代考程序代写 python flex Assignment 2

Assignment 2

Your task is to replicate the experiment
reported by Pulford & Collman (2008)
showing the persistence of the ambiguity
aversion effect irrespective of urn size.

The ambiguity aversion effect, first discussed
by Ellsberg (1961), consists in people’s
tendency to prefer risky choices when the
outcome is 50:50, against choices with
unknown outcomes. Imagine you are standing
in front of two urns, one containing 50 red
and 50 blue marbles and another urn
containing 100 red and blue marbles in
unknown proportions. You are asked to blindly draw a marble from one of the urns and you will win
a prize if that marble is red. In such scenario, most people prefer the 50:50 urn and according to
utility theory (and intuition perhaps), this means that they deem (a) the chance of drawing a red
marble from the ambiguous urn to be less than 0.5, and consequently (b) the chance of drawing a
blue marble from the ambiguous urn to be more than 0.5.

The paradox arises when the same decision maker that chose the 50:50 urn is asked to choose an
urn for the second time, this time aiming to get a blue marble. It has been shown in multiple studies
that the aversion towards unknown outcomes remains, with the majority of people still picking the
50:50 urn, even though according to (b) there’s a higher chance of drawing a blue marble from the
ambiguous urn.

In the experiment that you are asked to replicate, the researchers investigated the extent to which
the aversion to unknown outcomes is dependent on the urn size, i.e. the number of marbles in the
urns. Therefore, they asked three groups of participants to make a single choice between the 50:50
and the ambiguous urn, while varying the number of marbles in each urn between the groups (2,10
and 100). That experiment was conducted by asking participants to physically draw marbles from
actual urns and to note down their choices on paper. Your task is to transfer this experiment to a
computer program, while trying to replicate the original conditions as close as possible.

Specification

Your program should display (at the minimum*) the following screens to each participant:

1. Consent page: The experiment should not continue until the participant has expressed
his/her agreement – ideally through a checkbox

2. Demographics page consisting at least of age, gender and education level. The program must
verify that the participant has provided appropriate values for each field. Otherwise it must
display error message(s) – the more precise these messages are relative to the type of
error(s) the better.

3. Experiment page (s): See more information below
4. Debrief page.

* You are free to include more pages in the experiment.

Note: this image is for illustration purposes only. Critically, the
colours of the marbles were not visible during the experiment

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu
in original paper, win a prize if marble is blue, stick to the original paper (blue is win)

Regarding the main experiment page(s), you are free to implement it/them in any way you deem
appropriate. In particular, you are free to choose things such as if/how the urns are displayed, how
the participant expresses his/her choice and how the result is shown (red marble – lose, blue
marble– win).

There are a few requirements however:

1. The positions of the two urns must be randomized in each trial. While the left urn must
always be called “urn A” and the right one “urn B” as in the original experiment, whether it is
A (left) that contains the 50:50 or the unknown distribution should be randomly decided
every time the experiment runs. Of course, the instructions should also be changing to
reflect this.

2. You should be adapting aspects of the experiment (e.g. the instructions) described in the
paper to fit the computer-based version that you will be developing. For example, the last
part of the instructions found in the paper which reads “You will draw a marble from your
chosen urn straight afterwards. I prefer to draw a marble from Urn A/Urn B . . . . . . . .”
should be altered to reflect the fact that in the computer based version, a participant
chooses the urn through some software means instead of writing something on paper.

However, any change you make must be minimal, since the aim is to replicate the
experiment as closely as possible. Critically the description of the process based on which
the marbles are placed in the ambiguous urn must stay the same (i.e “….The mixture of red
and blue marbles has been decided by writing the numbers 0, 1, 2, . . ., 100 on separate slips
of paper….”).

3. Ideally, the processes that (a) compute the distribution in the ambiguous urn and (b) pick a
marble from the selected urn must mirror the original experiment. For example, although, of
course, you won’t be writing numbers on papers, you should be deciding the number of
marbles by drawing a sample from an appropriate distribution.
Note: regarding the ambiguous urn you may (a) hand-code the distribution of red and blue
marbles based on the numbers reported in the paper (2:0, 8:2, 53:47), or (b) produce a
different distribution for each participant.

As in the original experiment, you must write one program for all 3 conditions. As described in the
paper, the only difference between the conditions is the number of marbles in each of the two urns
(2, 10 or 100).

You should not assume a specific number of participants. In addition, we’d ideally want an equal
number of participants in each condition. So, if there are 6 participants, there should be 2 in each
condition. Note that you can’t assume that the program will be running on the computer
continuously until all subjects have participated. In fact, as is typical in experiments, you should
anticipate that your program will be terminated after each participant and will be re-started when
the next participant arrives.

Your experiment must also record each participant’s results to a csv file (common for all
participants):

• the demographics
• the condition in which he/she participated, i.e. the number of balls in each urn (2, 10 or 100)
• the positions of the urns i.e. 0 if the random urn was on the right – urn B as was in the

paper, and 1 if the random urn was on the left – urn A (0 or 1)

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

• the selected urn, i.e. 0 if the participant chose the random urn and 1 if he/she chose the
50:50 urn (0 or 1)

• whether they got a red or a blue marble (red or blue)

Note: In the resulting csv, each line should correspond to one participant and the various fields will
be separated by commas.

Notes:

• As always, a working program is not enough to give you top marks. The efficiency,
readability and code organization of your program are equally important as is the ability to
easily extend/adapt your program. For example, adding a condition with 200 marbles should
ideally require as few changes as possible.

• Extra marks will be awarded to programs that go beyond the stated requirements either in
terms of functionality or in terms of presentation. In other words, you should consider how
you can make your program more flexible (e.g. more conditions, within or between
participants, more/variable number of urns) or more visually pleasing (e.g. animation,
layouts).

• As in assignment 1, you are not allowed to use code not discussed in class (unless these are
properties/methods of PyQt widgets)

• You should submit a single zip file named after your candidate code containing the python
file(s), the ui file(s) and any other resources (e.g. images) required.

Tips:

• Before you start writing code, make sure you plan your program carefully, e.g. think about
the steps you’re going to take, the requirements in each step etc. The more time you spend
planning, the easier it will be to code the experiment, and the better the quality of the code.

• Start simple and expand: First write the simplest version of the experiment possible and
then try to implement the more complicated bits

• Make sure that you test your final program exhaustively. If you were to actually run the
experiment, a small mistake could result in a great loss in time and money.

References

Ellsberg, D. (1961). Risk, ambiguity, and the Savage axioms. The quarterly journal of economics, 643-
669.

Pulford, B. D., & Colman, A. M. (2008). Size doesn’t really matter: Ambiguity aversion in Ellsberg urns
with few balls. Experimental Psychology, 55(1), 31-37.

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu

Yifei zhu