2024-06-09

Overview

We will start with the different methods, biases, and strategies for collecting data.


Once the data is collected, we need to classify and summarize the data.


How to summarize the data depends on which variable type we have.


After that we will show plots of data as well as some R code associated with one of those plots.

Collecting Data

  • Methods - Personal Interview, Telephone Interview, Self-Administered Questionnaires, Direct Observation, Web-Based Survey


  • Biases - Non-Response Bias, Response Bias, Selection


  • Strategies - Non-probability Methods (Convenience sampling, Gathering volunteers), Probability Methods (Simple random sample, Stratified random sample, Cluster sample)

Summarizing Qualitative Data

Once we determine that a variable is Qualitative (or Categorical), we need tools to summarize the data. We can summarize the data by using frequencies and by graphing the data.

As the saying goes, “A picture is worth 1000 words”, it is helpful to visualize the data in a graph.

Bar Chart - The height of the bar for each category is equal to the frequency (number of observations) in the category.

One survey of 500 Penn State University students about their favorite sport to watch shows that 283 said Football, 126 said Basketball, 45 said Hockey, 46 said Others. We will use Plotly to make a bar chart of this data.

Plotly Plot of Favorites Sports Data

Summarizing Quantitative Data

  • Mean - average of the data
  • Median - midpoint of the data
  • Mode - the point most represented in the data
  • Percentiles - measurement such that p% of the data are at or below this value
  • Quartiles - 5 Number Summary (minimum, Q1, median, Q3, maximum)
  • Range - Maximum minus Minimum
  • Interquartile Range (IQR) - Q3 minus Q1
  • Variance - the average squared distance from the mean
  • Standard Deviation - approximately the average distance the values of a data set are from the mean or the square root of the variance

ggPlot of Jessica’s Weight
(Histogram)

Jessica weighs herself every Saturday for the past 30 weeks. We put those weights into dataset df and we will create a histogram of her weight.

ggPlot of Exam Scores with R Code
(Box Plot)

df = c(24, 58, 61, 67, 71, 73, 76, 79, 82, 83, 85, 87, 88, 88, 92, 93, 94, 97)
ggplot(data.frame(df),aes(df)) + geom_boxplot()

Reference