STA 301 Sept 2 | 4. finish Summaries and start Plots

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/143

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 7:40 PM on 9/6/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

144 Terms

1
New cards

Why are averages alone insufficient for describing numerical data?

Datasets can have similar averages but very different variability, shapes, and unusual observations.

2
New cards

Which center-and-spread pair should you usually report for roughly symmetric data without major outliers?

Mean and standard deviation.

3
New cards

Which center-and-spread pair should you usually report for strongly skewed data or data with major outliers?

Median and IQR, because they are more resistant to extreme observations.

4
New cards

What should you consider when a distribution has multiple prominent peaks?

Whether it combines meaningful subgroups that should be analyzed separately.

5
New cards

What should you do before deciding how to handle an extreme observation?

Investigate its context and possible errors, plot the data, and compare summaries with and without it.

6
New cards

What is a z-score, and what is its formula?

The number of standard deviations an observation is above or below its own mean: z = (observation - mean) / standard deviation.

7
New cards

What does the sign of a z-score tell you?

Positive means above the mean; negative means below the mean; zero means equal to the mean.

8
New cards

How do you compare unusualness using z-scores from different variables?

Use each variable's own mean and SD, then compare absolute z-scores. The larger absolute value is farther from its own mean in SD units.

9
New cards

In the Game of Thrones example, viewers have z = 2.64 and the rating has z = -5.04. Which is more unusual?

The rating, because 5.04 is greater than 2.64 in absolute value. Its negative sign indicates that it is below the mean.

10
New cards

In an ungrouped dataset, what does summarize() do?

Calculates summary statistics and returns one row containing those summaries.

11
New cards

What does rapidcity %>% summarize(avg_temp = mean(Temp)) calculate?

The mean of Temp in rapidcity, stored in an output column named avg_temp.

12
New cards

How do you request multiple statistics inside summarize()?

Separate the named calculations with commas. Example: summarize(avg_temp = mean(Temp), median_temp = median(Temp)).

13
New cards

Which R package enables the formula-style summary shortcuts in the slides?

The mosaic package. Load it with library(mosaic).

14
New cards

How do the mosaic shortcuts calculate a numerical variable's mean, median, SD, and IQR in df?

mean(~num, data = df), median(~num, data = df), sd(~num, data = df), and IQR(~num, data = df).

15
New cards

What does favstats(~num, data = df) return with mosaic loaded?

A table containing the minimum, Q1, median, Q3, maximum, mean, SD, number of nonmissing observations, and number of missing observations.

16
New cards

What is the difference between R's range() output and the statistical range?

range() returns two endpoints: minimum and maximum. The statistical range is maximum minus minimum.

17
New cards

What are the three basic elements of the grammar of graphics?

Data variables, geometric objects, and mappings from variables to the objects' aesthetic properties.

18
New cards

What are geometric objects in a plot?

The visual marks representing data, such as points, lines, bars, and boxes.

19
New cards

What is an aesthetic mapping?

A connection between a data variable and a visual property, such as x-position, y-position, color, shape, or size.

20
New cards

How do the three graphics elements match the textbook's sentence analogy?

Variables are like subjects; geometric objects are like objects; mappings are like verbs that connect them.

21
New cards

What does 'a plot maps variables to aesthetic properties of geometric objects' mean?

Data values determine how visual marks appear or where they are placed. For example, engine size determines a point's horizontal position.

22
New cards

Can the same data be displayed in different valid plots?

Yes. Changing the geometric objects or aesthetic mappings can emphasize different comparisons while using the same variables.

23
New cards

In the bike-rental line graph, what are the three variables and their mappings?

Hour maps to x-position; median rentals maps to y-position; working-day status maps to the color of the points and lines.

24
New cards

In the faceted bike-rental bar plot, how is working-day status displayed?

It determines the panel. Within each panel, hour determines bar position and median rentals determines bar height.

25
New cards

What pattern does the bike-rental example show?

Working days have morning and evening demand peaks; nonworking days have a broader midday plateau.

26
New cards

What are the five fundamental plot types in this lesson?

Scatter plot, line graph, histogram, boxplot, and bar plot.

27
New cards

Which plot is appropriate for examining the association between two numerical variables?

A scatter plot, with one numerical variable on each axis.

28
New cards

Which plot is appropriate for showing a numerical variable across time or another meaningful sequence?

A line graph, with the sequential variable on the horizontal axis in the usual orientation.

29
New cards

Which plot is appropriate for examining the distribution of one numerical variable?

A histogram.

30
New cards

Which plots are appropriate for comparing a numerical variable's distribution across categories?

Side-by-side boxplots or faceted histograms.

31
New cards

Which plot is appropriate for comparing summary statistics across groups?

A bar plot, with a bar representing a count, proportion, mean, median, or other summary for each group.

32
New cards

What should determine your choice of plot?

The types of variables, whether you have raw observations or summaries, and the comparison or question you want to investigate.

33
New cards

What does each point in a basic scatter plot represent?

One observation, positioned using its values for the x and y variables.

34
New cards

What can a scatter plot reveal besides an overall association?

Clusters, subgroups, unusual observations, and relationships that may be curved rather than straight.

35
New cards

What does an upward or downward pattern in a scatter plot suggest?

Upward: larger x-values tend to accompany larger y-values. Downward: larger x-values tend to accompany smaller y-values.

36
New cards

In the mpg scatter plot from your notes, what are displ and hwy?

displ is engine displacement in liters; hwy is highway fuel economy in miles per gallon.

37
New cards

What pattern appears in the mpg scatter plot of hwy versus displ?

Vehicles with larger engine displacement generally have lower highway miles per gallon: a negative association.

38
New cards

What question helps you choose between a scatter plot and a line graph?

Does x have an inherent progression or meaningful sequential order? If not, connecting points with lines usually does not make sense.

39
New cards

Must the horizontal variable in a line graph be time?

No. Time is common, but another meaningfully ordered sequence can also be appropriate.

40
New cards

In what order does geom_line() connect observations within a group?

In order of the x-variable, emphasizing the progression along that axis.

41
New cards

What is a histogram bin?

A non-overlapping numerical interval containing observations within a particular range of values.

42
New cards

What do the axes of an ordinary count histogram show?

The horizontal axis shows numerical values grouped into bins; the vertical axis shows the number of observations in each bin.

43
New cards

What does the sum of all bar heights equal in an ordinary count histogram?

The number of observations included in the histogram, because each observation is counted in one bin.

44
New cards

What distribution features can you investigate with a histogram?

Center, spread, modality, symmetry or skewness, tails, gaps, and unusual observations.

45
New cards

How do you identify the direction of skew in a histogram?

Look at the longer tail: a longer right tail means right skew; a longer left tail means left skew.

46
New cards

What happens when histogram bins are very narrow?

They reveal finer detail, but the plot can become spiky and noisy.

47
New cards

What happens when histogram bins are very wide?

The plot looks smoother but may hide meaningful detail, peaks, or gaps.

48
New cards

Is there one best histogram bin width for every dataset?

No. Try several widths and use the context to balance meaningful detail against noise.

49
New cards

Does changing histogram bin width change the original observations?

No. It changes how the observations are grouped and displayed, which can change the apparent shape.

50
New cards

What is a density histogram?

A histogram rescaled so that the total area of its bars equals 1. Bin areas represent proportions of observations.

51
New cards

Does a density histogram's bar height directly equal the proportion in that bin?

Not generally. Proportion = bar height multiplied by bin width. Density is a height; probability or proportion is an area.

52
New cards

How does a percentage histogram differ from a density histogram?

A percentage histogram puts percent of observations in each bin on the vertical axis. In a density histogram, bar area represents the proportion.

53
New cards

Why use density histograms to compare groups with different sample sizes?

Each group's total area is standardized to 1, so differences in sample size do not dominate comparisons of distribution shape.

54
New cards

Does switching from a count histogram to density scaling change its shape when the bins stay the same?

No. It changes the vertical scale, not the shape.

55
New cards

What does a boxplot summarize?

The distribution of a numerical variable using its median, quartiles, whiskers, and any separately displayed extreme observations.

56
New cards

What is the five-number summary?

Minimum, Q1, median (Q2), Q3, and maximum.

57
New cards

What do the box edges and the line inside a boxplot represent?

The box edges are Q1 and Q3. The line inside is the median, or Q2.

58
New cards

What fraction of observations does a boxplot's box represent?

The middle 50%, from the 25th percentile (Q1) to the 75th percentile (Q3).

59
New cards

How do you calculate the IQR, and where is it shown in a boxplot?

IQR = Q3 - Q1. It is the box's length along the numerical axis: height for a vertical boxplot, width for a horizontal one.

60
New cards

What are the usual 1.5-IQR fences for a boxplot?

Lower fence = Q1 - 1.5 times IQR. Upper fence = Q3 + 1.5 times IQR.

61
New cards

Where do the whiskers end in the default modified boxplot?

At the most extreme observed values within the 1.5-IQR fences. They need not reach the minimum, maximum, or the fence values themselves.

62
New cards

What do separate points beyond boxplot whiskers mean?

They are observations beyond the usual 1.5-IQR fences. They are worth investigating and are not automatically errors.

63
New cards

What can the median's location inside the box and unequal whisker lengths suggest?

Asymmetry or skewness. A boxplot gives clues, but a histogram shows more detail about the distribution's shape.

64
New cards

What is within-group variation in a set of boxplots?

The spread among observations within one group, such as week-to-week sales variation within one city.

65
New cards

What is between-group variation in a set of boxplots?

Differences across groups, such as differences in median weekly sales between cities.

66
New cards

Why compare differences in group medians with within-group spread?

Within-group spread gives context: a difference between medians may be small or large relative to ordinary variation among observations.

67
New cards

When might a faceted histogram be more useful than a boxplot?

When comparing a small number of groups and you want detail about each distribution's shape, including multiple peaks.

68
New cards

When might side-by-side boxplots be more useful than faceted histograms?

When comparing many groups, because boxplots summarize each distribution compactly.

69
New cards

What data do you need for a meaningful boxplot compared with a simple bar plot?

A boxplot needs multiple numerical observations within a group to describe its distribution. A simple bar can display one supplied summary value per group.

70
New cards

What does a bar's length or height usually represent?

A group-level summary, such as its count, proportion, mean, median, or total.

71
New cards

What are the two usual stages of making a bar plot from raw data?

First calculate a summary for each group; then plot those summaries as bars. For simple counts, geom_bar() can do the counting.

72
New cards

How is a histogram different from a bar plot?

A histogram groups numerical observations into ordered intervals. A bar plot compares categories using counts or other summaries.

73
New cards

Can histogram bins be rearranged from tallest to shortest like some category bars?

No. Their positions represent numerical intervals, so rearranging them would destroy the meaning of the numerical axis.

74
New cards

Why should the value axis of a standard bar plot include zero?

Bar length encodes magnitude. Truncating the baseline can make modest differences look much larger than they are.

75
New cards

How should categories be ordered when they have a natural order?

Use that order, such as chronological months, increasing age groups, or low-to-high ratings.

76
New cards

How might you order categories that have no natural order?

By the plotted value or another meaningful comparison, rather than automatically accepting alphabetical order.

77
New cards

When are horizontal bars especially useful?

When category labels are long and would overlap or need awkward slanted text on a horizontal axis.

78
New cards

What is a grouped bar plot?

A bar plot with separate bars beside one another within each main category, usually showing levels of a second categorical variable.

79
New cards

What is a stacked bar plot?

A bar plot that divides each bar into segments representing subcategories, showing their contributions to the total.

80
New cards

What does a 100% stacked bar plot emphasize?

Each bar totals 100%, so the segments show composition or proportions within groups rather than differences in total group size.

81
New cards

What is faceting, also called small multiples?

Splitting a plot into separate panels of the same type, with each panel showing a subset of the data.

82
New cards

What is a faceting variable?

The grouping variable that determines which observations appear in each panel.

83
New cards

What type of variable is usually used for faceting?

A categorical grouping variable. Numerical values can also define panels when they represent meaningful groups, such as numbered months or binned ages.

84
New cards

Why should comparable facets usually use the same axis scales?

The same visual distance then represents the same numerical difference, allowing direct comparisons across panels.

85
New cards

Can faceting be applied only to histograms?

No. It can also be used with scatter plots, line graphs, bar plots, and other plot types.

86
New cards

When might faceting be clearer than placing every group on one plot?

When many overlapping lines, points, bars, or colors make individual groups hard to follow.

87
New cards

How can a scatter plot display a third categorical variable?

Map it to point color or shape, or use it to create separate facets.

88
New cards

Which aesthetics can encode an additional numerical variable in a scatter plot?

Point size or transparency can encode numerical values. Color gradients are another option.

89
New cards

What does alpha control in a plot?

Transparency: lower alpha makes objects more transparent, while higher alpha makes them more opaque.

90
New cards

Why are color or shape generally better than size for distinguishing unordered categories?

Color and shape distinguish group identity without suggesting a numerical magnitude or ordered progression.

91
New cards

What is overplotting?

Points or other marks overlap and hide one another, making observations or patterns difficult to see.

92
New cards

What does a jitter plot do?

Displays individual observations with a small random displacement so overlapping points are easier to distinguish. The displacement is for display, not a change to the source data.

93
New cards

When can a jitter plot be useful compared with a boxplot?

For smaller datasets when seeing individual observations within each group is helpful.

94
New cards

What workflow do your notes recommend for making plots?

Start with a simple exploratory plot to find patterns, then refine the plot to communicate those patterns clearly.

95
New cards

Why is simpler often better in data visualization?

Removing unnecessary decoration and clutter helps viewers focus on the data and comparisons.

96
New cards

Why can too many lines and a large legend make a plot hard to read?

Viewers must repeatedly match colors to labels and track overlapping series. The slides suggest that more than about 5 to 7 series can be difficult.

97
New cards

How can you reduce the effort of matching lines to a legend?

Label the lines directly where practical, or use clearly labeled facets.

98
New cards

What should you consider when choosing colors to encode data?

Use a colorblind-friendly palette, and consider shapes or direct labels so readers do not have to rely only on color.

99
New cards

What should good axis labels include?

Clear variable descriptions and units when applicable, so the audience can interpret the values.

100
New cards

What is the recommended approach to learning detailed plot-customization code?

Use working examples as templates and copy, paste, and tweak them. Focus on understanding what each change does rather than memorizing every option.