ExamSaathi learning library · Government exams · SSC CGL quantitative foundations; published syllabus labelled 2024 · Quantitative aptitude

Lines of regression: estimating one variable from another

Use the two lines of regression, v on u and u on v, to estimate one variable from the other: find the regression coefficients from r and the standard deviations, link their product to r^2, and get the means and the labels from two given lines.

Status: original pilot lesson. Teacher review is pending. It is not a complete course or official exam material.

You will learn to

Before you start

Correlation tells you how strongly two variables move together; regression goes a step further and gives a straight line for estimating one of them from the other. Typical uses are estimating how much buttermilk a dairy will sell on a hot day, or the marks a student may score after a given number of mock tests. You need the mean and standard deviation (SD) of each variable and the correlation coefficient r between them. The Karl Pearson lesson shows how r is calculated, so here r is either given or found from the lines. The variables are called u and v, since x stands for multiplication. Write b(v on u) for the slope of the line that estimates v, and b(u on v) for the slope of the line that estimates u.

Two regression lines, two jobs

The regression line of v on u is v - (mean of v) = b(v on u) x (u - mean of u). It is the least-squares line for estimating v: among all straight lines, it makes the sum of the squared gaps between the dots and the line, measured in the v direction, as small as possible. Use it when u is known and v is wanted. The regression line of u on v is u - (mean of u) = b(u on v) x (v - mean of v). It makes the squared gaps in the u direction as small as possible, so it is the one to use when v is known and u is wanted. Both lines pass through the point (mean of u, mean of v). They are two different lines unless r = +1 or r = -1; in that case every dot lies on one straight line and the two lines coincide.

Regression coefficients and r

The slopes are called regression coefficients: b(v on u) = r x (SD of v / SD of u) and b(u on v) = r x (SD of u / SD of v). From raw data the first one also equals the sum of (du x dv) divided by the sum of du^2, where du and dv are each value's distance from its own mean. Multiplying the two coefficients cancels the standard deviations, leaving b(v on u) x b(u on v) = r^2. Three facts follow. Both coefficients carry the same sign as r, because standard deviations are positive. Their product is r^2, so it can never be more than 1. And r = sqrt(product) with the shared sign attached: coefficients of -0.5 and -1.62 give r = -sqrt(0.81) = -0.9. If r = 0, both coefficients are 0 and the lines become v = mean of v and u = mean of u, which cross at right angles.

When two lines are given without labels

Questions often give two equations and ask for the means, for r, or for which line is which. Means: both lines pass through (mean of u, mean of v), so when the two lines are different, solve the two equations together and the solution is the pair of means. Labels: make a trial assignment, say that the first line is v on u and the second is u on v. Rewrite the first as v = ... and read b(v on u) as the number multiplying u; rewrite the second as u = ... and read b(u on v) as the number multiplying v. Their product equals r^2, so a valid labelling gives a product from 0 to 1, and for two different lines it is below 1. If the trial gives a product above 1, swap the labels; the swapped product is the reciprocal, which is then below 1. A negative product means the two lines cannot both be regression lines, because the two coefficients must share a sign. A product of exactly 1 means r = +1 or -1; then the two regression lines are one and the same line, so the equations alone cannot fix the means. If one SD is also given, b(v on u) = r x (SD of v / SD of u) gives the other.

Common mistakes

Estimating u by turning the line of v on u around; that line is built for estimating v, and the line of u on v usually gives a different answer. Turning the ratio of standard deviations upside down: in b(v on u), the SD of v goes on top. Accepting a pair of coefficients whose product is more than 1, or whose signs differ; no real data can produce either. Giving r the wrong sign after taking sqrt(product); r takes the sign the two coefficients share. Reading a slope from an equation such as 2u + 5v = 40 without first making the estimated variable the subject. Estimating far outside the range of the data, where the straight-line pattern may no longer hold.

A routine for regression questions

1. Decide which variable is to be estimated; that picks the line (to estimate v use the line of v on u, and to estimate u use the line of u on v). 2. Find the slope: b = r x (SD of the estimated variable / SD of the known variable), or, from raw data, the sum of (du x dv) divided by the sum of squared deviations of the known variable. 3. Write the line through (mean of u, mean of v) and put in the known value. 4. With two different given lines, solve them together for the means, test a labelling with the product rule (a valid product lies from 0 to 1), and take r = sqrt(product) with the shared sign. 5. Sense-check: the two coefficients share one sign and their product is at most 1. When the known value is above its own mean, the estimate should come out above its mean if r is positive and below it if r is negative.

Worked examples

  1. A dairy shop in Anand kept records for 30 summer days. The noon temperature u (degrees C) had mean 30 and SD 4, the buttermilk sold v (litres) had mean 400 and SD 50, and r = 0.8. Find the regression line of v on u and estimate the sale on a 34-degree day. Then estimate the temperature on a day when 450 litres were sold.

    1. b(v on u) = r x (SD of v / SD of u) = 0.8 x 50 / 4 = 10.
    2. Line of v on u: v - 400 = 10 x (u - 30), which simplifies to v = 10u + 100.
    3. For u = 34: v = 10 x 34 + 100 = 440 litres.
    4. To estimate u, switch lines: b(u on v) = r x (SD of u / SD of v) = 0.8 x 4 / 50 = 0.064, and the line of u on v is u - 30 = 0.064 x (v - 400).
    5. For v = 450: u = 30 + 0.064 x 50 = 30 + 3.2 = 33.2 degrees C.
    6. Turning the v on u line around would give u = (450 - 100) / 10 = 35, but that line is the wrong one for this job.

    Answer: The line of v on u is v = 10u + 100, giving an estimated 440 litres on a 34-degree day; the line of u on v estimates 33.2 degrees C for a 450-litre day.

  2. The two regression lines of a set of paired data are 5u - 2v - 15 = 0 and 8u - 5v + 30 = 0. Find the means of u and v, decide which line is the regression of v on u, find r, and find the SD of v if the SD of u is 3.

    1. Means: 5u - 2v = 15 and 8u - 5v = -30. Multiply the first by 5 and the second by 2: 25u - 10v = 75 and 16u - 10v = -60. Subtracting gives 9u = 135, so u = 15, and then 5 x 15 - 2v = 15 gives v = 30.
    2. Trial: the first line as v on u gives v = 2.5u - 7.5, so b(v on u) = 2.5; the second line as u on v gives u = 0.625v - 3.75, so b(u on v) = 0.625. Product = 2.5 x 0.625 = 1.5625, more than 1, so this labelling is wrong.
    3. Swap: the second line as v on u gives v = 1.6u + 6, so b(v on u) = 1.6; the first line as u on v gives u = 0.4v + 3, so b(u on v) = 0.4. Product = 1.6 x 0.4 = 0.64, which lies between 0 and 1, so this labelling is right.
    4. r^2 = 0.64 and both coefficients are positive, so r = +sqrt(0.64) = 0.8.
    5. SD of v: 1.6 = 0.8 x (SD of v / 3), so SD of v = 1.6 x 3 / 0.8 = 6.

    Answer: The means are 15 for u and 30 for v; 8u - 5v + 30 = 0 is the line of v on u and 5u - 2v - 15 = 0 is the line of u on v; r = 0.8 and the SD of v is 6.

  3. A coaching centre in Kota recorded, for five students, the number of mock tests taken u and the score v out of 50 in the final test. Written as (u, v), the pairs were (2, 11), (4, 27), (6, 23), (8, 29) and (10, 35). Find the least-squares regression line of v on u and estimate the score of a student who took 7 mock tests.

    1. Means: mean of u = 30 / 5 = 6 and mean of v = 125 / 5 = 25.
    2. For u = 2 and v = 11: du = -4, dv = -14, du x dv = 56 and du^2 = 16.
    3. For u = 4 and v = 27: du = -2, dv = 2, du x dv = -4 and du^2 = 4.
    4. For u = 6 and v = 23: du = 0, dv = -2, du x dv = 0 and du^2 = 0.
    5. For u = 8 and v = 29: du = 2, dv = 4, du x dv = 8 and du^2 = 4.
    6. For u = 10 and v = 35: du = 4, dv = 10, du x dv = 40 and du^2 = 16.
    7. Totals: sum of (du x dv) = 100 and sum of du^2 = 40, so b(v on u) = 100 / 40 = 2.5.
    8. Line of v on u: v - 25 = 2.5 x (u - 6), which simplifies to v = 2.5u + 10.
    9. For u = 7: v = 2.5 x 7 + 10 = 27.5.

    Answer: The least-squares line of v on u is v = 2.5u + 10, and the estimated final-test score after 7 mock tests is 27.5 out of 50.

Practice checks

  1. For a set of paired data, r = 0.5, the SD of u is 4 and the SD of v is 12. The regression coefficient b(v on u) is:
  2. The two regression coefficients of a data set are -0.8 and -0.45. The correlation coefficient r is:
  3. The two regression lines of a data set are 3u + 2v = 26 and 6u + v = 31. The mean of v is:
  4. For a set of paired data the line of u on v is u = 1.25v + 25 and the line of v on u is v = 0.512u - 5.6. The best estimate of u when v = 28 is:
  5. A student reports b(v on u) = 1.6 and b(u on v) = 0.9 for the same data. Which statement is correct?

Sources checked