🏠 Home
Correlation & Regression
Unit IV Β· Lecture 27

BDS113 β€” Introduction to Statistics

Bivariate Data & Scatter Diagram

Univariate vs Bivariate Β· Joint Distributions Β· Scatter Diagrams Β· Patterns & Interpretation


Unit IV Β· Lecture 27 of 40 Β· B.Sc. Data Science, 1st Year, Semester II

Correlation & Regression
Unit IV Β· Lecture 27

The Journey β€” Lecture 27


πŸ“Š
Univariate vs Bivariate vs Multivariate Data
Definitions Β· Examples Β· Why we study relationships
πŸ“‹
Bivariate Frequency Tables
Joint frequency distributions Β· Marginal distributions Β· Contingency tables
πŸ”΅
Scatter Diagrams
Construction Β· Reading patterns Β· Positive / negative / no correlation Β· Curvilinear patterns
🧠
Interactive Tools & Quiz
Build your own scatter plot Β· Identify patterns Β· Practice quiz
Correlation & Regression
Unit IV Β· Lecture 27

πŸ“Š Univariate vs Bivariate vs Multivariate


Univariate

One variable measured per observation.

Examples:
Heights of 50 students
Daily temperatures for a month
Exam scores of a class

Tools: Mean, variance, histograms, frequency tables

Bivariate

Two variables measured on each observation.

Examples:
Height & weight of students
Advertising spend & sales
Study hours & exam score

Tools: Scatter diagrams, correlation, regression

Multivariate

Three or more variables per observation.

Examples:
Height, weight & age
Temperature, humidity & rainfall
Multiple exam scores per student

Tools: Multiple regression, partial correlation


πŸ“– Formal Definition

Bivariate data consists of pairs of observations (xα΅’, yα΅’) for i = 1, 2, …, n, where two different measurements are recorded on each subject or experimental unit. The goal is to study the relationship between the two variables β€” how changes in one variable are associated with changes in the other.

Correlation & Regression
Unit IV Β· Lecture 27

πŸ€” Why Study Bivariate Data?


πŸ’‘ Analogy: The Detective's Clue

Univariate statistics is like studying a single clue β€” it tells you about one piece of evidence. Bivariate statistics is like comparing two clues together β€” it reveals connections between them. Does the suspect's alibi hold up when compared with the timeline? Do two measurements move together? This is where real insight begins.


πŸ“– Key Questions Bivariate Data Answers

1. Is there a relationship? Do x and y tend to move together?

2. How strong is it? Is the association weak, moderate, or strong?

3. What direction? When x increases, does y increase or decrease?

4. What is the form? Is the relationship linear, curved, or random?

5. Can we predict? Given x, can we estimate y?

πŸ“– Examples of Bivariate Relationships

Height & Weight: Taller people tend to weigh more (positive).

Price & Demand: Higher prices tend to reduce demand (negative).

Study Hours & Score: More study tends to improve scores (positive).

Temperature & Ice Cream Sales: Hotter days increase sales (positive).

Age & Reaction Time: Reaction time tends to increase with age (positive after maturity).

Correlation & Regression
Unit IV Β· Lecture 27

πŸ“‹ Bivariate Frequency Distribution


πŸ“– Definition

A bivariate frequency table (or two-way table) shows the frequency of occurrence of each combination of values for two variables. Each cell shows how many observations fall into that particular (x-class, y-class) combination.


πŸ“ Example: Height (cm) vs Weight (kg) of 40 Students

Height ↓ \ Weight β†’40–5050–6060–7070–80Total
(y₁)(yβ‚‚)(y₃)(yβ‚„)
150–160 (x₁)43108
160–170 (xβ‚‚)265114
170–180 (x₃)037414
180–190 (xβ‚„)00224
Total61215740

πŸ“– Marginal Distributions

The row totals give the marginal distribution of height (x): 8, 14, 14, 4.

The column totals give the marginal distribution of weight (y): 6, 12, 15, 7.

These are just the univariate distributions of each variable separately.

πŸ“– Reading the Pattern

The high-frequency cells (6, 7, 5) cluster along the diagonal from top-left to bottom-right. This indicates a positive association β€” taller students tend to weigh more.

If the high frequencies were along the opposite diagonal, it would indicate a negative association.

Correlation & Regression
Unit IV Β· Lecture 27

πŸ”΅ Scatter Diagram β€” Definition


πŸ“– Formal Definition

A scatter diagram (or scatter plot) is a graphical representation of bivariate data where each observation (xα΅’, yα΅’) is plotted as a point on a two-dimensional coordinate system. The horizontal axis (x-axis) represents one variable and the vertical axis (y-axis) represents the other.


πŸ’‘ Why Scatter Diagrams Matter

A scatter diagram is the first thing you should draw when analysing bivariate data. Before computing any correlation coefficient or fitting any regression line, look at the scatter plot. It reveals the shape, direction, strength, and outliers of the relationship β€” information that summary statistics alone cannot fully capture. Anscombe's Quartet (coming up) proves this dramatically.


πŸ“– How to Construct

Step 1: Identify the two variables. Choose which is x (horizontal) and which is y (vertical). Convention: x = independent/explanatory, y = dependent/response.

Step 2: Draw axes with appropriate scales. Include labels and units.

Step 3: Plot each (xα΅’, yα΅’) pair as a dot on the graph.

Step 4: Look for patterns β€” direction, form, strength, outliers.

πŸ“– What to Look For

Direction: Positive (upward trend) or negative (downward trend)?

Form: Linear (straight line), curved, or no pattern?

Strength: How tightly do points cluster around a pattern?

Outliers: Any points far from the main cluster?

Clusters: Are there distinct groups in the data?

Correlation & Regression
Unit IV Β· Lecture 27

πŸ” Scatter Diagram Patterns


Strong Positive

Points cluster tightly around an upward line. r β‰ˆ +0.9 to +1.0

Moderate Positive

Points show upward trend with scatter. r β‰ˆ +0.5 to +0.8

No Correlation

Points scattered randomly. r β‰ˆ 0

Strong Negative

Points cluster tightly around a downward line. r β‰ˆ βˆ’0.9 to βˆ’1.0


Curvilinear (U-shape)

Non-linear pattern. Pearson r β‰ˆ 0 (misleading!)

Outlier Present

One point far from cluster. Can distort r significantly.

Weak Positive

Slight upward trend, much scatter. r β‰ˆ +0.2 to +0.4

Perfect Positive

All points on exact line. r = +1.0

Correlation & Regression
Unit IV Β· Lecture 27

🎭 Anscombe's Quartet β€” Why Always Plot First!


πŸ“– Anscombe's Quartet (1973)

Statistician Francis Anscombe created four datasets that have identical summary statistics (same mean of x, mean of y, variance of x, variance of y, correlation r = 0.816, and same regression line) β€” but look completely different when plotted. This proves that you must always visualise your data before computing statistics.


Dataset I

Linear relationship. Classic scatter. The regression line fits well.

Dataset II

Curvilinear pattern. A straight line is NOT the right model here.

Dataset III

One outlier pulls the line. Without it, r would be 1.0.

Dataset IV

All x's are the same except one. One point controls everything.


πŸ’¬ Lesson: All four datasets have r = 0.816, the same regression line Ε· = 3 + 0.5x, and the same RΒ² = 0.67. But only Dataset I actually fits a linear model well. Always plot your data first!
Correlation & Regression
Unit IV Β· Lecture 27

🎬 Interactive: Build Your Own Scatter Plot


Enter paired data and see the scatter diagram. Try different patterns to build intuition:






Correlation & Regression
Unit IV Β· Lecture 27

πŸ“‚ Types of Bivariate Data


TypeBoth VariablesExampleAnalysis Method
Both QuantitativeContinuous or discrete numericalHeight & WeightPearson's r, regression
Both QualitativeCategorical (nominal/ordinal)Gender & Eye colourChi-square test, CramΓ©r's V
One of EachOne numerical, one categoricalGender & HeightPoint-biserial correlation, t-test
Both RankedOrdinal or rank-orderedRank in class & Rank in sportSpearman's rank correlation

πŸ“– Important Distinction

Karl Pearson's correlation (Lecture 28) is designed for both quantitative variables.

Spearman's rank correlation (Lecture 30) works with ranked or ordinal data, or when the relationship is monotonic but not necessarily linear.

Chi-square and CramΓ©r's V (covered elsewhere) handle both qualitative variables.

Choosing the right method depends on the type of data you have.

Correlation & Regression
Unit IV Β· Lecture 27

βš–οΈ Independent vs Dependent Variable


πŸ“– Independent Variable (x)

The variable that is controlled, manipulated, or used to predict. Also called the explanatory variable, predictor variable, or regressor.

Placed on the horizontal axis of a scatter plot.

Example: Study hours, advertising spend, temperature, height.

πŸ“– Dependent Variable (y)

The variable whose value depends on or is predicted by the independent variable. Also called the response variable, outcome variable, or regressand.

Placed on the vertical axis of a scatter plot.

Example: Exam score, sales, ice cream sales, weight.


πŸ’¬ Caution: In correlation, it does not matter which variable is x and which is y β€” correlation is symmetric (r(x,y) = r(y,x)). In regression, it matters greatly β€” the regression line of y on x is different from the regression line of x on y. We will explore this in Lectures 31–32.

πŸ’‘ Correlation β‰  Causation

Finding a strong correlation between two variables does not mean one causes the other. Ice cream sales and drowning deaths are positively correlated β€” but ice cream doesn't cause drowning. Both are caused by a third variable (hot weather). Always consider confounding factors and the possibility of coincidence.

Correlation & Regression
Unit IV Β· Lecture 27

πŸ”‘ Summary: Bivariate Data & Scatter Diagrams


Correlation & Regression
Unit IV Β· Lecture 27

🧠 Quick Quiz β€” Lecture 27


Q1: Bivariate data involves measuring:

A) One variable on each unit
B) Two variables on each unit
C) Three or more variables
D) One variable on two units

Q2: In a scatter diagram, the independent variable is placed on:

A) The horizontal (x) axis
B) The vertical (y) axis
C) Either axis β€” it doesn't matter
D) Neither axis

Q3: If points in a scatter plot cluster tightly around a line sloping upward from left to right, this indicates:

A) Strong negative correlation
B) Strong positive correlation
C) No correlation
D) Curvilinear correlation

Q4: Anscombe's Quartet demonstrates that:

A) Correlation always implies causation
B) Identical statistics can describe very different data patterns
C) Scatter plots are unnecessary
D) Regression is always linear

Q5: "Correlation does not imply causation" means:

A) Correlation is useless
B) A statistical association does not prove one variable causes the other
C) Only experiments can show correlation
D) Correlation and causation are the same thing

Q6: The row totals in a bivariate frequency table give:

A) The joint distribution
B) The marginal distribution of the row variable
C) The conditional distribution
D) The correlation coefficient
Correlation & Regression
Unit IV Β· Lecture 27

πŸ“ Homework & Next Lecture


πŸ“ Practice Tasks

1. The following data gives marks in Statistics (x) and marks in Mathematics (y) for 8 students. Draw a scatter diagram and describe the pattern.
   x: 30, 35, 40, 45, 50, 55, 60, 65
   y: 32, 38, 42, 48, 50, 54, 58, 62

2. Construct a bivariate frequency table for the following data on hours of TV watched (x) and GPA (y) for 20 students. Use classes for both variables.

3. For each scatter pattern below, state whether Pearson's r would be close to +1, βˆ’1, 0, or misleading:
   (a) Perfect upward line   (b) U-shaped curve   (c) Random cloud   (d) Downward line with one outlier

4. Explain why a scatter diagram should always be drawn before computing a correlation coefficient.

5. BONUS: Look up Anscombe's Quartet data online. Compute the mean and variance of x and y for all four datasets and verify they are identical.


Upcoming

Lecture 28: Karl Pearson's Coefficient of Correlation β€” the most widely used measure of linear association.