Steady State
İKT379 / Lecture 2
Lecture 2 · Week 2 · Gujarati ch. 2 · about 45 min

Two-Variable Regression: Basic Ideas

What 'regressing Y on X' actually means: the population regression function as a locus of conditional means, why a disturbance term turns it into a stochastic model, the sample regression function that estimates it, and what 'linear' regression really requires.

By the end you can
  • Explain the population regression function as the conditional mean of Y given X
  • Write the stochastic and sample regression functions and explain the difference between a disturbance and a residual
  • Explain why 'linear' regression means linear in the parameters, not necessarily in the variables
  • Compute a conditional mean from grouped data, the empirical seed of the PRF

How the exam asks it: three core exam templates

Midterm exams on two-variable regression test three canonical problems: (1) calculating conditional means and true disturbances from the PRF, (2) computing fitted values and sample residuals from the SRF, and (3) testing linearity in parameters.

Exam template 1: Conditional expectation and the disturbance term

Question: A sample survey observes 5 families at an income level of X=120X = 120 thousand TL with consumption expenditures Y=80,84,86,90,100Y = 80, 84, 86, 90, 100 (thousand TL). The true population regression function is E(Y∣X)=28+0.5XE(Y \mid X) = 28 + 0.5X. One specific family in this group consumes Yi=95Y_i = 95 thousand TL. a) Calculate the conditional expectation E(Y∣X=120)E(Y \mid X = 120) directly from the data.
b) Confirm that the population regression equation gives the same conditional mean.
c) Compute this family’s disturbance uiu_i and interpret its economic meaning.

Worked example · Full step-by-step solution for Template 1 (Conditional mean & disturbance)0/9

Data at X=120X=120: Y=80,84,86,90,100Y = 80, 84, 86, 90, 100; PRF: E(Y∣X)=28+0.5XE(Y \mid X) = 28 + 0.5X; specific observation Yi=95Y_i = 95.

Exam template 2: Fitted values and the sample residual

Question: The true PRF from Template 1 is estimated from a sample, yielding the sample regression function: Y^i=26+0.52Xi\hat{Y}_i = 26 + 0.52X_i For the family with income Xi=120X_i = 120 thousand TL and actual consumption Yi=95Y_i = 95 thousand TL: a) Calculate the fitted value Y^i\hat{Y}_i.
b) Calculate the sample residual eie_i.
c) Explain why the residual eie_i differs from the disturbance ui=+7u_i = +7 found in Template 1.

Worked example · Full step-by-step solution for Template 2 (SRF & Residual)0/9

Y^i=26+0.52Xi\hat{Y}_i = 26 + 0.52X_i; Xi=120X_i = 120 thousand TL; Yi=95Y_i = 95 thousand TL.

Exam template 3: Testing linearity in parameters

Question: State whether each regression model is linear under the definition required for classical linear regression: a) Yi=β1+β2Xi2+uiY_i = \beta_1 + \beta_2 X_i^2 + u_i
b) Yi=β1+β22Xi+uiY_i = \beta_1 + \beta_2^2 X_i + u_i
c) Yi=β1+β2ln⁡(Xi)+uiY_i = \beta_1 + \beta_2 \ln(X_i) + u_i
d) ln⁡Yi=β1+β2ln⁡Xi+ui\ln Y_i = \beta_1 + \beta_2 \ln X_i + u_i

Worked example · Full step-by-step solution for Template 3 (Linearity classification)0/6

Evaluating parameter linearity across four regression specifications.

Cheat-sheet & the 4-step method

Regression as a conditional mean

“Regressing YY on XX” means studying how the average value of YY changes as XX takes different fixed values — not predicting any one individual YY perfectly, but describing the pattern in YY‘s behaviour across values of XX.

Worked example · A conditional mean from grouped data0/6

Three families with income X=80X=80 (thousand TL) report consumption Y=60,65,70Y = 60, 65, 70 (thousand TL). Four families with X=100X=100 report Y=70,75,80,85Y=70,75,80,85. Find the conditional mean E(Y∣X=100)E(Y \mid X=100).

Your turn

Using the same setup, find E(Y∣X=80)E(Y \mid X = 80) from the values 60, 65, 70.

The population regression function (PRF)

Population regression functionKey definitionFormula sheet →
E(Y∣Xi)=β1+β2XiE(Y \mid X_i) = \beta_1 + \beta_2 X_i
E(Y∣Xi)E(Y \mid X_i)
the conditional mean of Y for a given value X_i
β1,β2\beta_1, \beta_2
the true, unknown population parameters

Use it when you need to state the theoretical object regression is trying to uncover — the true relationship in the whole population, not just in one sample.

The PRF is the line traced out by plotting E(Y∣X)E(Y|X) against XX for every possible value of XX — connecting the conditional means across the whole range of income. In the textbook’s family consumption example, weekly family income runs X=80,100,…,260X = 80, 100, \ldots, 260 dollars and the conditional mean is E(Y∣X)=17+0.6XE(Y\mid X) = 17 + 0.6X: at X=80X=80 it is 17+0.6(80)=6517 + 0.6(80) = 65, and at X=260X=260 it is 17+0.6(260)=17317 + 0.6(260) = 173. The PRF joins all such points. It is a property of the entire population, and in practice it is never directly observed: only a finite sample is available.

Diagram · Population and sample regression functionsGujarati Tables 2.1, 2.4, 2.5
8012016020024060100140180weekly income X (dollars)weekly consumption Y (dollars)E(Y | X = 140) = 101PRF
PRF E(Y | Xᵢ) = 17 + 0.6Xᵢconditional mean

Gujarati's 60 families (Table 2.1). At each income X there is a whole distribution of consumption Y. Its average is the conditional mean E(Y | Xᵢ) (big dots: 65, 77, …, 173). The line joining the conditional means is the population regression function, PRF: E(Y | Xᵢ) = 17 + 0.6Xᵢ.

Try it with the real 60 families: pick an income column and draw samples.

Interactive · population vs sample regressionGujarati Table 2.1 · 60 families
507510012515017520080100120140160180200220240260weekly family income X (dollars)weekly consumption Y (dollars)PRF E(Y|X) = 17 + 0.6X
Families at X = 140
7
Conditional mean E(Y | X = 140)
101
17 + 0.6 × 140
101

Disturbances u = Y − E(Y|X) at this income: -21, -8, -6, +2, +7, +12, +14. They sum to zero. Each family = systematic part 101 + its own random u.

In practice we never see all 60 families, only a sample. Draw one: the dashed line fitted to it is the sample regression function (SRF).

From PRF to a stochastic model

No single family’s actual consumption sits exactly on the conditional mean line — some spend more than their group’s average, some less. This individual deviation is captured by a disturbance term.

Look at how one family’s expenditure decomposes. Given the family’s income XiX_i, its observed YiY_i is the sum of two parts: (1) E(Y∣Xi)E(Y\mid X_i), the average spending of all families with that same income — the systematic (deterministic) component; and (2) uiu_i, the family’s own deviation from that average — the random (nonsystematic) component.

Stochastic PRFKey formulaFormula sheet →
Yi=E(Y∣Xi)+ui=β1+β2Xi+uiY_i = E(Y\mid X_i) + u_i = \beta_1 + \beta_2 X_i + u_i
uiu_i
the disturbance (error) term for observation i, capturing everything that pulls Y_i away from its conditional mean

Use it when you write down the full population model, ready to be estimated from a sample — this equation is the starting point of every two-variable regression in this course.

Check your understanding

One family with X = 100 (income) has Y = 88 (consumption), while E(Y∣X=100)=77.5E(Y|X=100) = 77.5. What is that family's disturbance term uiu_i?

Why is there a disturbance term?

Seven standard reasons explain why a stochastic disturbance belongs in the model, all illustrated with the consumption example:

  1. Vagueness of theory. The theory behind YY‘s behaviour is often incomplete, so uiu_i stands in for every relevant variable the model leaves out — a family’s spending responds to tastes, habits and health, and no small theory names them all.
  2. Unavailability of data. Even when theory names a variable, quantitative information about it may not exist — thriftiness clearly affects saving, but no survey records it as a number.
  3. Core versus peripheral variables. Some influences are central and others minor; the weak peripheral ones are not worth modelling one by one and get lumped into uiu_i — income dominates consumption, while the spending habits of distant relatives still nudge YiY_i.
  4. Intrinsic randomness in human behaviour. Human beings are not fully predictable, so behaviour contains a genuinely random element — two families with the same income may still spend differently on impulse.
  5. Poor proxy variables. Measured variables are often imperfect stand-ins for the theoretical ones, or are measured with error — reported income may omit informal earnings, so recorded XX imperfectly proxies true income.
  6. Principle of parsimony. A good model stays as simple as possible, and uiu_i carries the countless small omitted influences — one keeps income alone rather than adding dozens of minor regressors.
  7. Wrong functional form. The true relationship may not have the shape assumed, and the misfit of a misspecified form shows up in uiu_i — if consumption bends nonlinearly with income, a straight-line model misses the bend.
Check your understanding

A survey records family income from formal payroll only, so the XX in the data differs from a family's true total income. Which reason for including a disturbance term does this illustrate?

The sample regression function (SRF)

Since the PRF is unobservable, econometricians estimate it from a sample, producing the sample regression function, with residuals standing in for the unobservable disturbances.

Sample regression functionKey formulaFormula sheet →
Y^i=β^1+β^2XiYi=Y^i+ei\hat Y_i = \hat\beta_1 + \hat\beta_2 X_i \qquad Y_i = \hat Y_i + e_i
β^1,β^2\hat\beta_1, \hat\beta_2
estimated parameters (written b_1, b_2 on the slides)
Y^i\hat Y_i
the fitted (predicted) value
eie_i
the residual, the SAMPLE counterpart of u_i

Use it when you are working with actual estimated numbers from a specific dataset, as opposed to the unobservable, purely theoretical PRF.

Diagram · Population and sample regression functionsGujarati Tables 2.1, 2.4, 2.5
XYYᵢE(Y|Xᵢ)ŶᵢPRFSRFXᵢAuᵢeᵢ
PRFSRFuᵢ (to the PRF)

Gujarati's figure 2.5. For one observation A at Xᵢ: in terms of the PRF, Yᵢ = E(Y | Xᵢ) + uᵢ (uᵢ = vertical gap to the PRF); in terms of the SRF, Yᵢ = Ŷᵢ + eᵢ (eᵢ = vertical gap to the SRF). Here the SRF underestimates the true E(Y | Xᵢ), so eᵢ > uᵢ. Data example: A = (240, 189) gives u = 189 − 161 = 28 and, with Ŷ = 24.45 + 0.509X, e = 189 − 146.65 = 42.35.

Your turn

A fitted regression gives Y^i=74\hat Y_i = 74 for an observation whose actual value is Yi=80Y_i = 80. Find the residual eie_i.

Estimators, estimates and SRF notation

The sample mean shows the difference. The formula Xˉ=∑Xin\bar X = \dfrac{\sum X_i}{n} is the estimator: it is the general rule. Feed it one particular sample — say the ten weekly incomes 80, 100, …, 260 — and it returns Xˉ=1700/10=170\bar X = 1700/10 = 170 dollars; that single number is the estimate. A different sample would generally produce a different estimate.

The slides write the SRF as Y^i=b1+b2Xi\hat Y_i = b_1 + b_2 X_i (b1=β^1b_1 = \hat\beta_1, b2=β^2b_2 = \hat\beta_2; “Y-hat” is read as the estimator of the conditional mean). Each sample quantity estimates one population quantity:

In stochastic form the SRF reads Yi=b1+b2Xi+eiY_i = b_1 + b_2 X_i + e_i. For X=XiX = X_i we observe one value Y=YiY = Y_i; in terms of the SRF it splits as Yi=Y^i+eiY_i = \hat Y_i + e_i, while in terms of the PRF it splits as Yi=E(Y∣Xi)+uiY_i = E(Y\mid X_i) + u_i. The residual eie_i is thus the observable sample stand-in for the unobservable disturbance uiu_i. Because of sampling fluctuation, the SRF-based estimate of the PRF is at best approximate.

Check your understanding

Which statement about uiu_i and eie_i is correct?

What “linear” regression really means

Linearity in the parametersKey ideaFormula sheet →
Linear regression  ⟺  linear in the β’s, not necessarily in the X’s\text{Linear regression} \iff \text{linear in the } \beta\text{'s, not necessarily in the } X\text{'s}

Use it when a model has a squared or otherwise nonlinear term in X, and you need to decide whether ordinary least squares can still be used.

Yi=β1+β2Xi2+uiY_i = \beta_1 + \beta_2 X_i^2 + u_i is a linear regression model, because it is linear in β1\beta_1 and β2\beta_2 — X2X^2 can simply be treated as a single, ordinary explanatory variable. But Yi=β1+β22Xi+uiY_i = \beta_1 + \beta_2^2 X_i + u_i is not linear regression, because the parameter β2\beta_2 itself appears squared.

Check your understanding

Which of these two models is linear in the parameters?

Check your understanding

Which of the following is a linear regression model in the sense used throughout this course?

Simple versus multiple regression

A two-variable (simple) regression has one dependent variable and one explanatory variable, exactly the form studied so far. A multiple regression has one dependent variable and two or more explanatory variables — the subject of Lessons 7 to 9 later in this course.

Exam practice

Exam question 1

Five families with X = 60 report Y = 40, 42, 45, 48, 50. Find E(Y | X = 60).

Exam question 2

What best distinguishes the population regression function (PRF) from the sample regression function (SRF)?

Exam question 3

A fitted line gives Y^i=120\hat Y_i = 120 for an observation with actual Yi=108Y_i = 108. Find the residual.

Exam question 4

Is Yi=β1+β2(1/Xi)+uiY_i = \beta_1 + \beta_2(1/X_i) + u_i a linear regression model?

Exam question 5

In the expression Xˉ=∑Xin\bar X = \frac{\sum X_i}{n}, the whole formula is a(n) ____, while the single number it returns for one sample is a(n) ____.

Exam question 6

Gujarati's Table 2.1: the six families with weekly income X=100X = 100 spend Y=65,70,74,80,85,88Y = 65, 70, 74, 80, 85, 88. Find E(Y∣X=100)E(Y \mid X = 100).

Exam question 7

The PRF is E(Y∣Xi)=17+0.6XiE(Y \mid X_i) = 17 + 0.6X_i. A family with X=140X = 140 spends Y=115Y = 115. Find its disturbance uiu_i.

Exam question 8

In Yi=E(Y∣Xi)+uiY_i = E(Y \mid X_i) + u_i, which part is the systematic (deterministic) component?

Summary and review

Step-by-step examples

The ladder below climbs from easy to exam level. Try each step on paper before you reveal it — attempting an example yourself, even badly, teaches more than reading a finished solution.

Easy

Worked example · Easy 1 · A conditional mean0/6

Five students who studied X=2X=2 hours for a test scored Y=60,64,66,70,70Y = 60, 64, 66, 70, 70. Find the average score of this group. Here E(Y∣X=2)E(Y \mid X=2) means the average of YY for students with exactly X=2X=2.

Worked example · Easy 2 · Reading the PRF line0/6

The true relationship is E(Y∣X)=54+6XE(Y \mid X) = 54 + 6X, where XX is study hours and YY is exam score. Check the line at X=2X=2 and X=4X=4, then predict the average score at X=6X=6.

Your turn

Your turn (easy): five students who studied 6 hours scored 84, 88, 90, 92, 96. Find E(Y∣X=6)E(Y \mid X=6) from the data.

Medium

Worked example · Medium 1 · The disturbance0/6

A student studied X=4X=4 hours and scored Y=85Y=85. Another studied X=2X=2 hours and scored Y=60Y=60. The true PRF is still E(Y∣X)=54+6XE(Y \mid X) = 54 + 6X. Find each student's disturbance uiu_i, the deviation from the population average: ui=Yi−E(Y∣Xi)u_i = Y_i - E(Y \mid X_i).

Worked example · Medium 2 · The residual0/6

The PRF is unobservable, so we estimate it. A sample gives the estimated line (the SRF) Y^=55+5X\hat Y = 55 + 5X, where Y^\hat Y is the fitted value of Y. For the student with X=4X=4 the fitted value is 75, while the actual score is still Y=85Y=85. Find the residual ei=Yi−Y^ie_i = Y_i - \hat Y_i and explain why it differs from the disturbance.

Worked graph · disturbance u versus residual eu = +7.0 · e = +10.0
507090110— PRF: E(Y|X) = 54 + 6X- - SRF: Ŷ = 55 + 5Xu = 7.0e = 10.00246study hours Xexam score Y
True average E(Y|X=4)
78.0
Fitted value Ŷ
75.0

The big dot is one real observation. Measure the gap to the solid line (the true PRF, which nobody can see) and you get the disturbance u = 85 − 78.0 = 7.0. Measure the gap to the dashed line (the line we estimated from a sample) and you get the residual e = 85 − 75.0 = 10.0. Same dot, two lines, two different gaps: e is our observable stand-in for u.

Worked example · Medium 3 · Is it a linear regression?0/6

Decide which of these models are linear in the parameters (the unknown β\beta's): (a) Yi=β1+β2Xi2+uiY_i = \beta_1 + \beta_2 X_i^2 + u_i; (b) Yi=β1+β22Xi+uiY_i = \beta_1 + \beta_2^2 X_i + u_i; (c) Yi=β1+β2ln⁡(Xi)+uiY_i = \beta_1 + \beta_2 \ln(X_i) + u_i. Linear in the parameters means every β\beta appears only to the first power.

Your turn

Your turn (medium): using the estimated line Y^=55+5X\hat Y = 55 + 5X, a student with X=2X=2 actually scored Y=58Y=58. Find the residual.

Exam level

Worked example · Exam 1 · Full chain: mean, PRF, disturbance, residual0/7

Families with income X=120X=120 (thousand TL) report consumption Y=80,84,86,90,100Y = 80, 84, 86, 90, 100 (thousand TL). The true population line is E(Y∣X)=28+0.5XE(Y \mid X) = 28 + 0.5X. One particular family at X=120X=120 consumes Y=95Y=95. A sample estimate of the line is Y^=26+0.52X\hat Y = 26 + 0.52X. (a) Find E(Y∣X=120)E(Y \mid X=120) from the data. (b) Find that family's disturbance. (c) Find its residual.

Worked graph · disturbance u versus residual eu = +7.0 · e = +6.6
20406080100120— PRF: E(Y|X) = 28 + 0.5X- - SRF: Ŷ = 26 + 0.52Xu = 7.0e = 6.604080120160200income X (thousand TL)consumption Y (thousand TL)
True average E(Y|X=120)
88.0
Fitted value Ŷ
88.4

The big dot is one real observation. Measure the gap to the solid line (the true PRF, which nobody can see) and you get the disturbance u = 95 − 88.0 = 7.0. Measure the gap to the dashed line (the line we estimated from a sample) and you get the residual e = 95 − 88.4 = 6.6. Same dot, two lines, two different gaps: e is our observable stand-in for u.

Worked example · Exam 2 · Model answer: disturbance versus residual0/6

Exam-style question: explain the difference between the disturbance term uiu_i and the residual eie_i, and say which one can actually be computed. Build the answer as a short model paragraph.

Worked example · Exam 3 · Model answer: estimator or estimate?0/6

Exam-style question: a researcher writes down the rule Xˉ=∑Xin\bar X = \frac{\sum X_i}{n} and then reports a mean study time of 3.5 hours for one sample. Which item is the estimator and which is the estimate? Explain using this example.

Your turn

Your turn (exam): using the sample line Y^=26+0.52X\hat Y = 26 + 0.52X, a family with X=200X=200 spends Y=133Y=133 (thousand TL). Find the residual eie_i.

Review deck · 15 cards0/15 mastered