GEA1000 QUANTITATIVE REASONING WITH DATA
TUTORIAL 1
Please work on the problems before coming to class. In class, you will engage in group work.
In this tutorial, we will be looking at two case studies:
• Exploring box office records for movies
• Why having a large group matters when conducting random assignment.
Case Study 1: Exploring Box office records for movies.
Refer to the csv file “[Link]”. Below is a brief description of some of the variables which
may not be considered common knowledge. The other variables in the data set, not listed
below are self-explanatory.
Variable Description
Production_Budget The cost involved in making the movie.
Worldwide_Gross The revenue generated from screening the
movie in public theatres around the world.
CPI The Consumer Price Index (CPI) is an important
economic metric used to measure the change in
general prices of goods and services (otherwise
known as inflation) in a country. Very often, this
index is derived by considering a weighted
average of the prices of goods and services
consumed in the country. The weight assigned
to each good or service is determined by the
monetary authority of the country but is very
often linked to the consumption patterns of the
average individual in the country.
MPAA_Rating The Motion Picture Association of America film
rating system is used in the United States and its
territories to rate a motion picture’s suitability
for certain audiences based on its content. If a
film has not been submitted for a rating or is an
uncut version of a film that was submitted, the
label Not Rated (NR) is used.
IMDb_Rating IMDb is an abbreviation for Internet Movie
Database, which is an online database of
information related to films. The IMDb offers a
1
rating scale that allows users to rate films on a
scale of one to ten based on how they feel about
the film, with a low score being regarded as an
unfavourable view and a high score being
regarded as a favourable one.
The submitted ratings are filtered and weighted
in various ways (partly depending on the stature
of the person rating the movie) to produce a
“weighted mean” that is displayed for each film
and IMDb keeps the formula of the weighted
mean as confidential.
Voter_Numbers The number of voters who rated the movie on
IMDb which eventually resulted in the IMDb
rating.
Sampling
This data obtained was taken on 14th August 2023 from the following website
[Link]
consisting of 6420 movies, via the following procedure. All 6420 movies’ information was
downloaded. A random number between 1 and 6420 was generated and assigned to each
movie without allowing for repetition of numbers. Then the movies labelled “1” to “1091”
were selected and the information provided from the website was merged with other publicly
available information pertaining to them, to construct the data.
a) State the sampling frame and determine what type of sampling was done here.
Types of Variables
b) For all the variables, except IMDb Rating, determine which are numerical and which
are categorical. Were there instances where it was unclear whether to classify the
variable as numerical or categorical?
Data Cleaning
When working with data, we are not usually fortunate enough to be handling data that is
pristine and requires no form of cleaning/tidying. In this part we will highlight two
manifestations of potentially dirty data and how we can go about dealing with them.
Manifestation 1: Missing values
c) (i) Identify the variables for which there are missing values.
2
(ii) Name the variables for which the number of missing values is relatively small
(i.e., greater than 0 and less than 30). Given that the number of missing values
for these variables is small, suggest what can be done for this form of dirty
data.
(iii) Name the variables for which the number of missing values is very large (i.e.,
more than 100). If you were to try and implement your suggestion(s) in (ii), to
what extent is it feasible here?
Manifestation 2: Unusual values
For numerical values in data sets, in addition to calculating the mean and standard
deviation of these variables, it is a common practice for the description to include
what is known as the “Five-Number Summary”, which consists of
- Minimum
- Q1
- Median
- Q3
- Maximum
Whilst the Five-Number summary, together with the mean and standard deviation
(SD), is used to provide quantitative information about groups of data, sometimes
they can also be used to identify sources of unusual data values.
d) Give the Five-number summary together with the mean and SD for the variable
Worldwide_Gross. Describe if there are any anomalies in the summary statistics
values. Explain what could result in such an anomaly and hence, explain the
circumstances under which it would be justifiable to remove these anomalous data
points. (Hint: Refer to the description of Worldwide_Gross given in the table)
Data Visualisation
While we now have some idea that the data cleaning process can be an extensive one, for the
rest of this question, you may ignore the movies where Release_Year or CPI are blank.
Inflation is the rate of increase in prices over a given period. Let us adjust for the Production
Budget with reference to 2022’s CPI which is 294.4. Here is an example of how it can be done.
For example, Star Wars Ep. VII: The Force Awakens (the first movie in the data set) has a
production budget of $306,000,000 and the year of release was 2015. The CPI for 2015 is 237.
This means that the “equivalent” production budget for 2022 is estimated to be
294.4
× 306,000,000 = $380,111,392 (to the nearest whole number)
237
e) Create a new variable called Adjusted_Production_Budget where all
production budgets are valued with reference to the 2022 CPI.
f) Use a suitable visualisation to depict the trend of the averages for Production_
Budget and the averages for Adjusted_Production_Budget between the
3
years 2012 – 2022. Compare the trends obtained between adjusting for inflation and
not adjusting for inflation.
Generalisability
g) Suppose that we wished to investigate trends and patterns in the movie industry, and
we were to do an analysis using this sample data to help us understand those trends
and patterns. Then to what extent can any findings obtained using this data be
generalisable to the movie industry? Base your answer on the generalisability criteria
that you have learnt as well as the information given on the website.
Case Study 2: Why having a large group matters, when doing random assignment.
The purpose of this exercise is to demonstrate how the effectiveness of random assignment
in leading to treatment and control groups with similar characteristics, is heavily dependent
on the number of people/objects that we are working with. Refer to the csv file “School [Link]”
which consists of data pertaining to students aged (16-20) from a school in Portugal. Below is
a brief description of the variables.
Variable Description
sex M stands for Male and F stands for Female
famsize The size of the family. “GT3” stands for greater than 3 and “LE3”
stands for less than or equal to 3.
Pstatus Parent’s cohabitation status (binary: ‘T’ - living together or ‘A’ -
apart)
Momedu Mother’s highest education
Dadedu Father’s highest education
MJob Mother’s job
FJob Father’s job
traveltime Time taken to travel to school (one-way).
parentalhelp Whether or not the parents provide help with the student’s
education at home.
Tuition Whether the student is having external tuition.
higher Whether or not the student wishes to pursue higher education.
romantic Whether the student is reported to be in a romantic
relationship.
famrel Self-reported quality of family relationships (from 1 – very bad
to 5 – excellent)
health Self-reported health status (from 1 - very bad to 5 - very good)
absences Number of absences in one whole school year.
mathscore Score in a math test with maximum possible score of 60.
4
a) State the number of students in School A.
b) Amongst all the students in School A, calculate the proportion of students (to 2 d.p.)
who
i) have a family size of more than 3.
ii) are receiving tuition.
iii) have mothers with a university degree.
iv) are in a romantic relationship.
c) There are many methods to randomly assign students into a “treatment group” and
a “control group”. One method is by using the results of a coin flip. If the coin shows
heads, a student is assigned to the “control group”, otherwise, the student is
assigned to the “treatment group”. In Excel, there is a way to simulate this process.
Create a new column called “Random assignment” consisting of 1s and 0s assigned
randomly to each student. You can use the Excel function
=RANDBETWEEN(0,1)
to help you do the random assignment for each student. Students assigned 0 will be
in the “control group” and those assigned 1 will be in the “treatment group”. (We
are merely giving a label of “control” and “treatment” for a hypothetical experiment
that we have not specified).
State the number of students in each group. If the number of students of both
groups differ, would you think that it is a surprising observation?
Reminder: After all students have been allocated a random number (either 0 or 1),
to ensure that the values do not keep changing, copy the entire column and paste it
back in the same column, but using “Paste as Values”.
d) For each of the treatment and control groups, calculate the four proportions as you
did for part (b). What can you say about the similarities/differences between the
treatment and control groups when comparing each of the four proportions
between the two groups?
e) Refer to the csv file “School [Link]”. If you were to do the random assignment for
students in School B using the same method as that in part c), will the two groups
obtained be as similar as that you obtained for School A? Justify your answer.
5
Plotting a Line Graph
1. Under “Plot-type”, select “Line”.
2. Under “Y-variable”, select “Production_Budget (numeric)”.
3. Under “X-variable”, select “Release_Year (factor)”.
4. Under “Function”, select “mean”.
5. Click “Create plot”. You should obtain the line graph as shown in the diagram above.
Performing random assignment with Radiant
1. After importing the dataset, select, under the “Design” tab, “Random assignment”.
2. Select “Assign conditions”