Quantitative Methods for
International Politics
IPOL 3270 • Fall 2026
September 27, 2026
Relationships between variables
Correlation
Drawing lines
Lines and regression

Everything in statistics can be done with regression!
Y
Outcome variable
Response variable
Dependent variable
Thing you want to
explain or predict
X
Explanatory variable
Predictor variable
Independent variable
Thing you use to
explain or predict Y
Prediction
Forecast the future
Focus is on Y
Netflix trying to
guess your next show
Predicting which countries
will have a coup
Explanation
Explain effect of X on Y
Focus is on X
Netflix looking at the effect of the time of day on show selection
Measuring the effect of
foreign aid on democratization
Do countries with longer life expectancy have lower fertility rates?
fert_rate: Expected number of children born per woman (Y)life_exp: Average life expectancy in years (X)obes_rate: % of adults who are obese (save for later!)| iso | country | life_exp | fert_rate |
|---|---|---|---|
| AFG | Afghanistan | 53.65 | 4.3 |
| ALB | Albania | 79.47 | 1.4 |
| DZA | Algeria | 78.03 | 2.7 |
| AGO | Angola | 62.11 | 5.0 |
| ATG | Antigua and Barbuda | 77.80 | 1.6 |
| ARG | Argentina | 78.31 | 1.9 |
| ARM | Armenia | 76.13 | 1.6 |
| AUS | Australia | 83.09 | 1.6 |
| AUT | Austria | 82.27 | 1.5 |
| AZE | Azerbaijan | 74.15 | 1.6 |
Univariate summaries
Describe one variable
Mean, median, standard deviation, minimum, maximum, etc.
Bivariate summaries
Describe how two variables are related
Correlation!
A number that measures the strength and direction of the linear relationship between two numeric variables
Written as \(r\); ranges between −1 and 1
−1
Perfect negative relationship: as X goes up, Y goes down
0
No relationship: X and Y move independently
+1
Perfect positive relationship: as X goes up, Y goes up
Clear relationship, but r ≈ 0
because it’s not a straight line!
https://www.guessthecorrelation.com/
How close can you get?
r = -0.812
Fairly strong negative relationship!
Countries with higher life expectancy tend to have lower fertility rates
Rough guidelines (though these are subjective!):
How much does fertility change when life expectancy goes up by one year?
Correlation only tells us direction and strength, not size!
What does life expectancy do to fertility?
Correlation isn’t causation! Wealth, education, health care, etc. probably drive both
To measure the size of the relationship, we need a line
| cookies | happiness |
|---|---|
| 1 | 0.5 |
| 2 | 2.0 |
| 3 | 1.0 |
| 4 | 2.5 |
| 5 | 3.0 |
| 6 | 1.5 |
| 7 | 2.0 |
| 8 | 2.5 |
| 9 | 2.0 |
| 10 | 3.0 |
Residual = observed value − value on the line
\[ \text{residual} = y - \widehat{y} \]
The line’s “error” or “lack of fit” for each observation
Good lines have small residuals
The “best-fitting” line is the one with the smallest sum of squared residuals
\[ y = mx + b \]
| \(y\) | A number |
| \(x\) | A number |
| \(m\) | Slope (\(\frac{\text{rise}}{\text{run}}\)) |
| \(b\) | y-intercept |
\[ y = 2x - 1 \]
\[ y = -0.5x + 6 \]
Sketch out the lines I give you in class!
| \(y = mx + b\) | \(\widehat{y} = b_0 + b_1 x\) | |
|---|---|---|
| \(y\) | Outcome variable (Y) | \(\widehat{y}\) |
| \(x\) | Explanatory variable (X) | \(x\) |
| \(m\) | Slope | \(b_1\) |
| \(b\) | y-intercept | \(b_0\) |
The ^ hat on \(\widehat{y}\) is called a “hat”—we say “y hat”
It means it’s a fitted value, or the value on the line
\[ \widehat{y} = b_0 + b_1 x \]
\[ \begin{aligned} &\widehat{\text{fert}\_\text{rate}} = \\ &b_0 + b_1 \times \text{life}\_\text{exp} \end{aligned} \]
lm() = linear model<Y> ~ <X> is a model formula (same as in get_correlation()!)| term | estimate |
|---|---|
| intercept | 1.100 |
| cookies | 0.164 |
\[ \begin{aligned} &\widehat{\text{happiness}} = \\ &b_0 + b_1 \times \text{cookies} \end{aligned} \]
\[ \begin{aligned} &\widehat{\text{happiness}} = \\ &1.1 + 0.164 \times \text{cookies} \end{aligned} \]
A one unit increase in X is associated with a \(b_1\) increase (or decrease) in Y, on average
\[ \widehat{\text{happiness}} = 1.1 + 0.164 \times \text{cookies} \]
On average, eating one more cookie is associated with a 0.164 increase in happiness
\(b_0\) is the average value of
Y when X is 0
\[ \widehat{\text{happiness}} = 1.1 + 0.164 \times \text{cookies} \]
For someone who eats 0 cookies, the average level of happiness would be 1.1
● Observed value (\(y\)): Actual happiness = 3
■ Fitted value (\(\widehat{y}\)): \(1.1 + 0.164 \times 5 = 1.918\)
↓ Residual (\(y - \widehat{y}\)): \(3 - 1.918 = 1.082\)
| ID | happiness | cookies | happiness_hat | residual |
|---|---|---|---|---|
| 1 | 0.5 | 1 | 1.264 | -0.764 |
| 2 | 2.0 | 2 | 1.427 | 0.573 |
| 3 | 1.0 | 3 | 1.591 | -0.591 |
| 4 | 2.5 | 4 | 1.755 | 0.745 |
| 5 | 3.0 | 5 | 1.918 | 1.082 |
| 6 | 1.5 | 6 | 2.082 | -0.582 |
| 7 | 2.0 | 7 | 2.245 | -0.245 |
| 8 | 2.5 | 8 | 2.409 | 0.091 |
| 9 | 2.0 | 9 | 2.573 | -0.573 |
| 10 | 3.0 | 10 | 2.736 | 0.264 |
# A tibble: 2 × 7
term estimate std_error statistic p_value lower_ci upper_ci
<chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 intercept 12.6 0.545 23.1 0 11.5 13.7
2 life_exp -0.137 0.007 -18.6 0 -0.152 -0.123
(We’ll learn what all those other columns mean later in the semester!)
| term | estimate |
|---|---|
| intercept | 12.599 |
| life_exp | -0.137 |
\[ \begin{aligned} &\widehat{\text{fert}\_\text{rate}} = \\ &b_0 + b_1 \times \text{life}\_\text{exp} \end{aligned} \]
\[ \begin{aligned} &\widehat{\text{fert}\_\text{rate}} = \\ &12.6 + (-0.137) \times \text{life}\_\text{exp} \end{aligned} \]
A one unit increase in X is associated with a \(b_1\) increase (or decrease) in Y, on average
\[ \widehat{\text{fert}\_\text{rate}} = 12.6 + (-0.137) \times \text{life}\_\text{exp} \]
On average, a one-year increase in life expectancy is associated with a 0.137 decrease in the fertility rate
“Associated”
Correlation isn’t causation! Adding a year of life to everyone in a country won’t make people have fewer kids. Wealthier, healthier, more educated countries tend to have both higher life expectancy and lower fertility
“On average”
Two countries with life expectancies one year apart won’t have fertility rates exactly 0.137 apart. Some are above the line, some below
\(b_0\) is the average value of
Y when X is 0
\[ \widehat{\text{fert}\_\text{rate}} = 12.6 + (-0.137) \times \text{life}\_\text{exp} \]
In a country where life expectancy is 0 years, the average fertility rate would be 12.6
A life expectancy of 0 is actually impossible, so this intercept has no practical meaning—it’s just where the line crosses the y-axis!
Correlation
r = -0.812
Strength and direction of the relationship
Always between −1 and 1; no units
Slope
\(b_1\) = -0.137
Size of the relationship
Measured in units of Y per one unit of X
They’ll always have the same sign, but usually not the same value!
● Observed value (\(y\)): Bosnia’s actual fertility rate = 1.3
■ Fitted value (\(\widehat{y}\)): \(12.599 + (-0.137) \times 77.98 = 1.894\)
↓ Residual (\(y - \widehat{y}\)): \(1.3 - 1.894 = -0.594\)
| iso | fert_rate | life_exp | fert_rate_hat | residual |
|---|---|---|---|---|
| AFG | 4.3 | 53.65 | 5.234 | -0.934 |
| ALB | 1.4 | 79.47 | 1.689 | -0.289 |
| DZA | 2.7 | 78.03 | 1.887 | 0.813 |
| AGO | 5.0 | 62.11 | 4.072 | 0.928 |
| ATG | 1.6 | 77.80 | 1.918 | -0.318 |
| ARG | 1.9 | 78.31 | 1.848 | 0.052 |
| ARM | 1.6 | 76.13 | 2.148 | -0.548 |
| AUS | 1.6 | 83.09 | 1.192 | 0.408 |
Does a country’s obesity rate predict its fertility rate?
fert_rate and obes_rateget_correlation()lm() and look at the coefficients with get_regression_table()