关键词 > DataManagement&Manipulation

Data Management & Manipulation

发布时间:2020-12-23

Data Management & Manipulation
Your coursework needs to be submitted electronically on Moodle - see the Student Services website
for further details of this process. The deadline for submission is 3pm on Thursday 14th January
2021. Late submission will attract a mark penalty unless an extension has been approved by Student
Services. Please familiarise yourself with the extenuating circumstances policy and process for
submitting a claim.
!Welcome to the Direidi Casino!
The Direidi Casino on Planet Acheron is open for business and they need you to manage their data!
Four species visit Acheron: the Aenar, the Horta, the
Kzinti and the Organian; and they all enjoy
two games:
Phaser-shoot
Up to six players compete together to see who is the best target shooter. In each game everyone
takes one shot. There is an informal prize each year so the casino wants to know who has played, in
which group, their scores, and when they played. Time on
Acheron is measured in Years (they
started counting at 1; the current year 1005), Days (each year has 906 days), and Hours (there are 7
hours in a day). Analysis has shown that each species hits a target with the following accuracies:
Aenar hit the target 40% of the time.
At the start of each day, Horta hit the target with 70% accuracy but this falls by 10% every hour.
Kzinti - no data are available.
On odd days Organian hit the target with 50/50 accuracy but on even days this drops to 20%
accuracy.
Probability Drive
There are 23 coloured credit chips: 11 blue, 9 red, and a 3 green. Players choose two credit chips at
random.

The winning and losing combinations are:
Blue & Blue: +20
Red & Red: +30
Red & Blue: +5
Blue & Green: -100
Red & Green: -60
1
The casino would like to track the outcome of every game, and carefully record who owes them
what!
Tasks
1. Design a data model to store information on the casino's patrons (name, species, age and home
teleport location), the games they play, and the results of those games. Write R code to create
random test data for your database, where each of your tables is an R data frame. Teleport location
is two x,y integers; age is an integer.
2. Write R/SQL code to output summary data on the winnings/losings of each species. Include one
graph in your output. Run your code on your test dataset to illustrate that it is working. It is up to
you to decide what summary data to include.
3. The casino's designers have come up with a new game called
Pick a Stump. The rules are: ten
pebbles are thrown into the remains of a dead tree. The pebbles are numbered 1 to 9 with the last
one coloured green. Players reach into the tree and select two pebbles. If the total of the two values
picked is odd they win +1, if it is even they lose -1; if one of the pebbles chosen is green the number
that was selected on the other pebble is doubled and again if the answer is odd they win, if it is even
they lose. Write R code to analyse the Pick a Stump game by simulation (
not by mathematical
analysis). Over 1000 games, who is more likely to win - the house or the player?
4. The
Acheron Space Force suspect foul play! Create a bespoke statistical test to answer the
question: is there a difference between the average amount won by the Horta and Kzinti when
playing the Probability Drive? Explain your answer.
5. Edit your code to answer an additional question: is there a difference between the maximum
amount won by the Horta and Kzinti?
2