Goal: In this assignment, you are asked to obtain descriptive statistics as well as boxplots and histograms for different quantitative variables from our class data collection survey. When analyzing a quantitative variable, be sure to describe the four characteristics describing distributions that we discussed in class (i.e., describe the center, variability, shape, and outliers).
Let’s find out more information about your colleagues by answering the questions below.
Our dataset contains a variable called hours_social_day that provides the number of hours each day that individuals in our class report spending on social media.
hours_social_day. Hint:
See R Guide - Chapter 3 - Basic Numerical Summaries (2pts)# Descriptive Statistics for the variable hours_social_day
tbl_num_sum(classdata, ~ hours_social_day, na_rm = TRUE)
min | Q1 | median | Q3 | max | mean | sd | n | missing |
|---|---|---|---|---|---|---|---|---|
0.250 | 2.000 | 2.000 | 4.000 | 8.000 | 2.814 | 1.654 | 90 | 0 |
hours_social_day. (2pts)Answer: minimum= 0.250, Q1= 2.000, median= 2.000, Q3=4.000, maximum=8.000.
Answer: The median is the 50th percentile, 50% of individuals say they spend 2 hours or less on social media daily.
Answer: average amount of time spent on social media is 2.814 hours daily.
Answer: the standard deviation is the use of social media is 1.654 hours, so an individuals use is between 1.654-2.814 hours daily.
hours_social_day.
Hint: See R Guide - Chapter 3 - Boxplot (2pts)# Boxplot of hours_social_day
plot_box(classdata, ~ hours_social_day)
hours_social_day.
Hint: See R Guide - Chapter 3 - Histogram (3pts)Tip: To ensure the histogram doesn’t have too many or too few bins, after you have copied the code from the R Guide you can add a comma after the variable name then before the closing parenthesis paste the following:
breaks = seq(0, max(classdata$hours_social_day), 1)
# Histogram of hours_social_day
plot_hist(classdata, ~ hours_social_day, breaks = seq(0, max(classdata$hours_social_day), 1))
hours_social_day. Be sure to
comment on the center, variability, shape, and outliers. (2pts)Answer: The distrubution/ variability in the histogram is right skewed, No outliers look to be present on the histogram. For the center the median is 2.000 or 2 hours a day.
Answer: A histogram makes seeing the variability and freqency of observations in a graph much easier. For a box plot its easier to see the median easier, and noting any outliers present in the sample.
Our dataset contains a variable called hours_study_day that provides the number of hours each day that individuals in our class report spending on studying on a typical day during the semester. Another variable, seat_preference, indicates where each person prefers to sit in a classroom (front, middle, or back). Let’s compare reported study times for those that prefer to sit in the front, middle, or back of a classroom.
hours_study_day within the three
types of seat_preference. Hint: See R Guide -
Chapter 3 - Basic Numerical Summaries By-Group. (3pts)# Numerical Summaries of hours_study_day within the three groups of seat_preference
tbl_num_sum(classdata, hours_study_day ~ seat_preference, na_rm = TRUE)
seat_preference | min | Q1 | median | Q3 | max | mean | sd | n | hours_study_day missing |
|---|---|---|---|---|---|---|---|---|---|
Back | 1.000 | 2.250 | 3.000 | 4.000 | 7.000 | 3.341 | 1.491 | 22 | 0 |
Front | 1.000 | 2.000 | 3.000 | 5.000 | 20.000 | 4.413 | 3.956 | 23 | 0 |
Middle | 1.000 | 3.000 | 3.000 | 4.000 | 10.000 | 3.789 | 2.001 | 45 | 0 |
Answer: The group with the highest average number of hours studying is the group in the front row, and the group with the lowest amount of hours spent studying is the back row.
hours_study_day
among the three types of seat_preference. Hint:
See R Guide - Chapter 3 - Boxplot By Group (3pts)Tip: You may prefer the horizontal orientation of the box plots over the default vertical orientation. After you have copied the code from the R Guide you can add a comma after the group variable name then before the closing parenthesis paste the following:
orient = “horizontal”
# Side-by-side boxplots of hours_study_day among the three groups of seat_preference
plot_box(classdata, hours_study_day~ seat_preference)
hours_study_day
among the three types of seat_preference. Hint:
See R Guide - Chapter 3 - Histogram By Group. (3pts)Tip: To ensure the histograms don’t have too many or too few bins, after you have copied the code from the R Guide you can add a comma after the group variable name then before the closing parenthesis paste the following:
breaks = seq(0, max(classdata$hours_study_day),1)
# Side-by-side histograms of hours_study_day among the three groups of seat_preference
plot_hist(classdata, ~ hours_study_day, group = ~ seat_preference)
hours_study_day among the three types of
seat_preference. Compare the center, variability, shape,
and outliers among the three groups. (2pts)Answer: There are a lot of outliers in the group who prefer the middle seats and the amount of hours spent studying compared to the other two groups. Next in terms of varaibility the front group has the highest amount- both the front and middle groups distribution skews right with the exception of the back row.