Skip to content

Statistics for Data Science: The Complete Beginner's Guide

Introduction: The Foundation of Data Science

Data science and machine learning are among the top jobs of the 21st century, with an average salary of $120,000/year. This comprehensive course, led by Dr. Abanda Sarar (Ph.D. in Statistics from Stanford University), covers the statistical foundations needed to succeed in this field. For a broader overview of what this field entails, see our guide on Understanding Data Science: Concepts, Importance, and Analytics Lifecycle.

Key Distinction: Statistics vs. Machine Learning

  • Statistics: Formulate a problem first, then get data to solve it.
  • Machine Learning: Here is the data, tell me what it says.
  • The key difference is that in statistics, the question is expensive and data is cheap; in ML, the question is cheap and data is expensive.

Types of Analytics

1. Descriptive Analytics

Describes what happened. For example, analyzing sales data to see where and when sales are declining. This is the starting point of analytics, as introduced in our Comprehensive Introduction to Statistical Methods for Economic Analysis.

2. Predictive Analytics

Uses data to predict outcomes. For example, if you reduce watch prices, will more people buy them?

3. Prescriptive Analytics

Recommends actions. For example, given the prediction, what marketing strategy or operational change should be implemented? This involves complex optimization.

Descriptive Statistics in Detail

Key Measures

  • Measures of Location: Mean (average), Median (middle value), Mode (most frequent)
  • Measures of Dispersion: Range, Interquartile Range (IQR), Standard Deviation, Variance

Understanding the Mean vs. Median

The mean and median differ when data is skewed. For example, in income data, the mean is often higher than the median due to high-income outliers. A right-skewed distribution means the mean is greater than the median. For a deeper dive into data classification, refer to Statistical Methods for Economics: Data Classification and Frequency Distribution.

  • Mean: The "center of gravity" of the data.
  • Median: The value that separates the bottom 50% from the top 50%.

Key Insight: The Five-Number Summary

A powerful descriptive tool consisting of:

  1. Minimum
  2. 25th Percentile (Q1)
  3. 50th Percentile (Median, Q2)
  4. 75th Percentile (Q3)
  5. Maximum

This gives a quick snapshot of the data's distribution, location, and spread.

Covariance and Correlation

  • Covariance: Measures the direction of the relationship between two variables (positive or negative). It is not standardized and is unit-dependent.
  • Correlation: A standardized measure of the strength and direction of a linear relationship between two variables. It ranges from -1 to +1.
  • Important: Correlation does not imply causation.

Probability Basics

Core Concepts

  • Sample Space: The set of all possible outcomes.
  • Event: An outcome or set of outcomes.
  • Probability: A number between 0 and 1 representing the likelihood of an event.

Key Rules

  • Addition Rule (OR): For mutually exclusive events, P(A or B) = P(A) + P(B).
  • Multiplication Rule (AND): For independent events, P(A and B) = P(A) * P(B).
  • Conditional Probability: P(A|B) = P(A and B) / P(B). This updates the probability of A given new information B.

Bayes' Theorem

A powerful tool to "flip" conditional probabilities.

Formula: P(A|B) = [P(B|A) * P(A)] / P(B)

Real-World Example: Medical Testing

If an HIV test is 95% accurate (sensitivity) and the disease incidence is 1%, a positive test result may still only have a 16% chance of actually having the disease. This is because the large number of healthy people creates many "false positives." This counterintuitive result is explained by Bayes' Theorem. For more context on foundational concepts like populations and samples, check out Introduction to Statistics: Understanding Populations, Samples, and Data Collection.

Key Probability Distributions

1. Binomial Distribution

  • Used for: Counting successes in a fixed number of independent trials.
  • Example: Probability that exactly 2 out of 7 customers pay their bill on time, when each customer has a 60% chance of paying.
  • Parameters: n (number of trials), p (probability of success on each trial).

2. Poisson Distribution

  • Used for: Counting the number of events that occur in a fixed interval of time or space.
  • Example: The number of customers arriving at a bank in a given minute.
  • Parameter: λ (lambda), the average rate of occurrence.

3. Normal Distribution

The "bell curve." It is symmetric and defined by its mean (μ) and standard deviation (σ).

The Empirical Rule (68-95-99.7 Rule):

  • 68% of data falls within ±1 standard deviation
  • 95% of data falls within ±2 standard deviations
  • 99.7% of data falls within ±3 standard deviations

Summary: The Path from Description to Prediction

The course establishes a clear progression:

  1. Describe the data using descriptive statistics.
  2. Use probability to quantify uncertainty.
  3. Build predictive models (like linear regression) to infer or predict future outcomes based on past data. For more on the broader role of statistics in understanding data, see Unlocking the Power of Statistics: Understanding Our Data-Driven World.

The session concludes by showing how descriptive statistics (like mean and standard deviation) are used with probability distributions (like the Normal distribution) to answer business questions, such as "What is the probability that a pack weighs less than 280g?" This bridges the gap between simply describing data and making informed predictions.