Statistics 1

In-Class Exercise 2

Yu-You Liou

Shih Chien University

2026-09-16

Data for Questions 1 to 3

The following are the daily commuting times (in minutes) reported by 24 students.

commute <- c(18, 25, 32, 41, 27, 35, 22, 19, 45, 38, 29, 24,
             31, 36, 40, 26, 33, 28, 21, 44, 30, 37, 23, 39)

Question 1

Grouped Frequency Distribution

Construct a grouped frequency distribution for commute using 5 classes.

  1. Find the range with max() and min(), then determine the class width.
  2. Use cut() together with table() to obtain the frequency of each class.
  3. Add the cumulative frequency with cumsum().

Question 2

Histogram

Draw a histogram of commute with ggplot() and geom_histogram() using 5 bins. Give the graph a title and label both axes with labs().

Describe the shape of the distribution in one sentence.

Question 3

Ogive

Draw the ogive (cumulative frequency graph) of commute.

Plot the cumulative frequency from Question 1 against the upper class boundaries with geom_line() and geom_point().

From the graph, estimate how many students commute less than 35 minutes.