> For the complete documentation index, see [llms.txt](https://kmis.gitbook.io/statistics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kmis.gitbook.io/statistics/chapter-10.-correlation-and-regression/10-1.-linear-relationships-between-variables.md).

# 10-1. Linear Relationships Between Variables

{% file src="/files/-LyOJ8ZYa3ixVXFXP\_WT" %}
Chapter 10 (Korean)
{% endfile %}

{% file src="/files/-M-JLGxyE1NZ2FMs9tia" %}
Chapter 10 (Chinese)
{% endfile %}

{% file src="/files/-M-IQdEbMwYQujiuL\_Pq" %}
Examples of Chapter 10 (R Sources)
{% endfile %}

Our interest in this chapter is in situations in which we can associate to each element of a population or sample two measurements $$x$$ and $$y$$ , particularly in the case that it is of interest to use the value of $$x$$ to predict the value of $$y$$. For example, the population could be the air in automobile garages, $$x$$ could be the electrical current produced by an electrochemical reaction taking place in a carbon monoxide meter, and $$y$$ the concentration of carbon monoxide in the air. In this chapter we will learn statistical methods for analyzing the relationship between variables $$x$$ and $$y$$ in this context.

A list of all the formulas that appear anywhere in this chapter are collected in the last section for ease of reference.

### 10.1 Linear Relationships Between Variables

#### LEARNING OBJECTIVE

1. To learn what it means for two variables to exhibit a relationship that is close to linear but which contains an element of randomness.

The following table gives examples of the kinds of pairs of variables which could be of interest from a statistical point of view.

| $$x$$                                               | $$y$$                             |
| --------------------------------------------------- | --------------------------------- |
| Predictor or independent variable                   | Response or dependent variable    |
| Temperature in degrees Celsius                      | Temperature in degrees Fahrenheit |
| Area of a house (sq.ft.)                            | Value of the house                |
| Age of a particular make and model car              | Resale value of the car           |
| Amount spent by a business on advertising in a year | Revenue received that year        |
| Height of a 25-year-old man                         | Weight of the man                 |

The first line in the table is different from all the rest because in that case and no other the relationship between the variables is **deterministic**: once the value of $$x$$ is known the value of $$y$$ is completely determined. In fact there is a formula for $$y$$ in terms of $$x$$: $$y=\frac{9}{5}x+32$$ . Choosing several values for $$x$$ and computing the corresponding value for $$y$$ for each one using the formula gives the table

&#x20;                                $$x$$    −40   −15     0      20      50\
&#x20;                                $$y$$    −40       5    32     68    122

We can plot these data by choosing a pair of perpendicular lines in the plane, called the coordinate axes, as shown in Figure 10.1 "Plot of Celsius and Fahrenheit Temperature Pairs".&#x20;

Then to each pair of numbers in the table we associate a unique point in the plane, the point that lies $$x$$ units to the right of the vertical axis (to the left if $$x<0$$ ) and $$y$$ units above the horizontal axis (below if $$y<0$$ ).&#x20;

The relationship between $$x$$ and $$y$$ is called a **linear relationship** because the points so plotted all lie on a single straight line. The number $$\frac{9}{5}$$ in the equation $$y=\frac{9}{5}x+32$$ is the **slope** of the line, and measures its steepness. It describes how $$y$$ changes in response to a change in $$x$$: if $$x$$ increases by 1 unit then $$y$$ increases (since$$\frac{9}{5}$$ is positive) by $$\frac{9}{5}$$ unit.&#x20;

If the slope had been negative then $$y$$ would have decreased in response to an increase in $$x$$. The number 32 in the formula $$y=\frac{9}{5}x+32$$ is the $$y$$**-intercept** of the line; it identifies where the line crosses the $$y$$-axis. You may recall from an earlier course that every non-vertical line in the plane is described by an equation of the form $$y=mx+b$$ , where $$m$$ is the slope of the line and $$b$$ is its $$y$$-intercept.

Figure 10.1 Plot of Celsius and Fahrenheit Temperature Pairs

![](https://saylordotorg.github.io/text_introductory-statistics/section_14/f6698546a4f99e443e31429904be4b1b.jpg)

The relationship between $$x$$and $$y$$ in the temperature example is deterministic because once the value of $$x$$ is known, the value of $$y$$ is completely determined.&#x20;

In contrast, all the other relationships listed in the table above have an element of randomness in them. Consider the relationship described in the last line of the table, the height $$x$$ of a man aged 25 and his weight $$y$$. If we were to randomly select several 25-year-old men and measure the height and weight of each one, we might obtain a collection of $$(x,y)$$ pairs something like this:

&#x20;                        (68, 151)  (69,  146)  (70, 157)  (70, 164)  (71, 171)  (72, 160)\
&#x20;                        (72, 163)  (72, 180)  (73, 170)  (73, 175)  (74, 178)  (75, 188)

A plot of these data is shown in Figure 10.2 "Plot of Height and Weight Pairs". Such a plot is called a **scatter diagram** or **scatter plot**. Looking at the plot it is evident that there exists a linear relationship between height $$x$$ and weight $$y$$, but not a perfect one.&#x20;

The points appear to be following a line, but not exactly. There is an element of randomness present.

Figure 10.2 Plot of Height and Weight Pairs

![](https://saylordotorg.github.io/text_introductory-statistics/section_14/4c2bb10b324e3867ac83a97c18105190.jpg)

In this chapter we will analyze situations in which variables $$x$$ and $$y$$ exhibit such a linear relationship with randomness. The level of randomness will vary from situation to situation. In the introductory example connecting an electric current and the level of carbon monoxide in air, the relationship is almost perfect. In other situations, such as the height and weights of individuals, the connection between the two variables involves a high degree of randomness. In the next section we will see how to quantify the strength of the linear relationship between two variables.

{% tabs %}
{% tab title="R Source" %}

```
x <- c(68, 69, 70, 70, 71, 72, 72, 72, 73, 73, 74, 75)
y <- c(151, 146, 157, 164, 171, 160, 163, 180, 170, 175, 178, 188)

plot(x, y, xlab="Height", ylab="Weight")
abline(lm(y ~ x))
```

{% endtab %}

{% tab title="Scatter Diagram" %}
![](https://2234305379-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-Lqmt1Wp54aKlZ5eVcaS%2F-LrmVuDhgOcbufZIkQ-S%2F-LrmVy4-rEXRCl-zfKcy%2Fimage.png?alt=media\&token=ecf9f737-c089-40b7-9b9b-ce5a68aa5c64)
{% endtab %}
{% endtabs %}
