What are the R functions for each task: 1) Load a package, 2) Read a CSV file using base R, 3) Calculate the average of a numeric vector?
1) library(), 2) read.csv(), and 3) mean()
What are the 3 principles of tidy data?
Each variable forms a column, each observation forms a row, and each cell contains only one value.
Which graph is not a standard graph for numerical data: a stem-and-leaf plot, histogram, boxplot, or table of counts ?
A table of counts, it is typically used to summarize categorical data.
What are the appropriate graphs for each task: 1) Show the distribution of a numerical variable using bins, 2) Summarize a numerical distribution using quartiles, 3) Display counts for categorical values?
1) histogram, 2) boxplot, and 3) bar chart
What are the components of a five-number summary?
The minimum, 1st quartile, median, 3rd quartile, and maximum.
What are the purposes of each function: mutate(), count(), and as.numeric() ?
mutate() creates or modifies columns, count() counts observations in categories or groups and as.numeric() converts a value or vector to numeric when possible.
What are the three steps of exploratory data analysis, in order?
Generate questions about the data, search for answers by visualizing, transforming, and modeling the data, and use what you learn to refine your questions or generate new ones.
What are the 3 distributions for the following scenarios: 1) The probability of events A and B occurring together, 2) The distribution of A considered on its own, 3) The probability of B given that A occurred?
1) joint, 2) marginal, and 3) conditional distributions
What is the difference between geom_bar() and geom_col()?
geom_bar() counts observations by default, while geom_col() uses the supplied y-values.
What measure of center is the most affected by outliers, and what measure of center is the least?
The mean is the most affected by outliers, and the median is the least affected by outliers.
Which 2 R functions calculate counts in a contingency table and converts counts to proportions in a table?
table() and prop.table()
What are the null and alternative hypotheses for the following scenario: A researcher wants to determine whether the average test score differs between two classes.
Null hypothesis: The average test scores are equal; there is no difference.
Alternative hypothesis: The average test scores differ between classes.
What is the third quartile and meaning of the follwing output of summary()?
0, 20, 33, 38, 49, 688
49. It is the 75th percentile: approximately 75% of the observations are at or below this value.
A dataframe birds contains columns species and weight. What R code creates a scatterplot of weight by species using points, with a smooth trendline added?
ggplot(birds, aes(x = species, y = weight)) + geom_point() + geom_smooth()
What is the shape of a distribution with most of its observations at lower values and a long tail to the right?
Positively/right skewed
Your dataframe has one row per student and separate columns for math and science. Which function and its arguments (name them) would be used to make this data tidy?
pivot_longer(data, cols, names_to, values_to)
What is the first step of the EDA process applied to this scenario: You receive a dataframe with Super Bowl number, winning team, losing team, and final score.
Answers may vary. Examples: Which team has won the most Super Bowls? Which game had the highest combined score?
A researcher finds that 40% of all surveyed employees work remotely. Of the employees who work remotely, 75% report being satisfied with their commute. What is the type of probability that 75% is describing.
Conditional probability
What do the following ggplot components do? coord_polar() and theme_void()
coord_polar() makes a graph use polar coordinates and theme_void() removes most plot decorations, including axes and gridlines.
What is the difference in the type of data displayed and information communicated between a bar chart and boxplot?
A bar chart is used for categorical data and displays counts or supplied values for categories, and a boxplot displays a numerical distribution using the median, quartiles, and IQR, and shows outliers.
A dataframe scores contains columns student, exam, and score. How would you keep only rows with scores above 80, retain only the student and score columns, and arrange the results from highest to lowest score?
scores %>% filter(score > 80) %>% select(student, score) %>% arrange(desc(score))
What is the problem with the data structure in the following scenario, according to the principles of tidy data: A wildlife researcher records each bird’s species, weight, and wing length. The data table has one row per bird, with the species, weight, and wing length stored together in a single column, separated by commas.
Each variable should have its own column.
At a college, 30 students take statistics and biology, 50 take statistics but not biology, 20 take biology but not statistics, and 100 take neither course. What is the probability that a randomly selected student takes both statistics and biology?
30/200, or 15% (joint probability)
A student wants to display the number of cars sold by manufacturer. They propose a pie chart. Why should a pie chart not be used, and what type of graph should be made instead?
Pie charts should be avoided because the human brain struggles to accurately compare angles and areas, making data hard to interpret. A bar chart should be used instead.
What phenomenon happens when a treatment has a higher success rate than a comparison treatment in each of two groups, but a lower success rate when both groups are combined?
Simpson's Paradox