CH 02 Simple Regression TQT
CH 02 Simple Regression TQT
variable, on one or more other variables, the explanatory variables, with a view to estimating and/or
predicting the (population) mean or average value of the former in terms of the known or fixed (in
repeated sampling) values of the latter” [2, p.18].
𝛛
The slope parameter ( 𝛽1 = 𝛛 𝑦 ) shows how much 𝑦 changes if 𝑥 increases by one-
𝑥
𝛛𝑢
unit. But this interpretation is only correct if all other factors are constant ( = 0).
𝛛𝑥
Dependent variable,
explained variable, Independent variable, Error term
response variable, explanatory variable, unobservables,
predicted variable, control variable, disturbance,
regressand… pridictor white noise,..
regressor,…
Simple linear regression: graphical presentation of the coefficients
(Cont)
𝛽1: Constant slope indicates that a one-unit change in X has the same effect
on Y regardless of X's innial values.
Simple linear regression: (Cont)
The goal of the linear regression is to estimate the population mean of the
dependent variable on the basis of the known values of the independent
variable(s).
To estimate 𝑬 𝒚 𝒙 which is known as the conditional expectation function or
the population linear regression function.
The conditional mean: E(𝒘𝒂𝒈𝒆|𝒆𝒅𝒖)
(Cont)
The conditional mean: E(𝒚|𝒙)
(Cont)
Take the expected value of the PRM (𝑦 = 𝛽0 + 𝛽1𝑥 + 𝑢) on x using the zero conditional mean
assumption, we have the population regression function (PRF):
E(𝒚|𝒙) = 𝐸(𝛽0 + 𝛽1𝑥 +𝑢 𝑥
E(𝒚|𝒙) = 𝐸(𝛽0 𝑥 + 𝐸(𝛽1𝑥 𝑥 + 𝐸
E(𝒚|𝒙) 𝑢𝑥
The average value
= of y𝜷can be expressed as a linear function of
𝟎 + 𝜷𝟏 𝒙
x
Zero conditional mean assumption: E 𝒖 𝒙 = 𝟎
(Cont)
This assumption means that: 𝑢 repespents other unobservable factors does not
have a systematical effect on 𝑌. Why? This assumption is critical for causal analysis; it cannot
be tested statistically and has to be argued by economic
theory.
Note that 𝒙𝟏,𝒙𝟐,, 𝒙𝟑,…here refer to 𝒙𝒊, and not different variables
Zero conditional mean assumption: E 𝒖 𝒙 = 𝟎
(Cont)
E(𝒖|𝒙)= 𝟎: This assumption is a strong assumption for cetetis paribus analysis;
it cannot be tested statistically and has to be argued by economic theory.
The average income for all household heads with 12 years of education is E(Income|edu=12)=815+53*12=1451
Note: But it is false to interpret that evevery household head with 12 years of education will earn 1451
The sample linear regression function (SRF)
(Cont)
��ෝ is called as “Y-hat” or “Y-cap”,
��ෝ𝒊 is the estimator of 𝐸 𝑦 𝑥𝑖 , which also means the fitted or predicted value
of 𝒚𝒊
𝛽መ0 = 𝑦ത −
መ σ 𝑛𝑖=1(𝑥𝑖−𝑥ҧ) 𝐶𝑜𝑣(𝑥,𝑦)
𝛽 = 𝑥𝑦−𝑥ҧ.𝑦 = =
𝛽1 𝑥ҧ
መ 1
𝑥ത2 − 𝑥ҧ σ 𝑛𝑖=1 (𝑥ത
(𝑦 −𝑦 𝑖 −𝑥
) ҧ)
2 𝑉𝑎𝑟(𝑥)
𝑖
These sample2 functions are the OLS estimators for
𝛽0and 𝛽1.
Regressions in Stata are very easy and simple, to run the regression of y on
x,
just type: reg y x
Estimators vs estimate
An estimator, also referred to as a "sample" statistic, is a
rule, formula, or procedure that explains how to estimate
the population parameter from the sample data.
An estimate is a specific numerical value generated by the
estimator in an application.
Estimate: 815, 53
How do we fit the regression line �ෝ
𝒊 = 𝜷 𝟎 + 𝜷 𝟏𝒙𝒊 to the
Answer: �
data? W𝑒 𝑤𝑖𝑙𝑙 𝑚𝑖𝑛𝑖𝑚𝑖𝑧𝑒 𝑡ℎ𝑒 𝑠𝑢𝑚 𝑜𝑓 𝑡ℎ𝑒 𝑠𝑞𝑢𝑎𝑟𝑒𝑑 𝑟𝑒𝑠𝑖𝑑𝑢𝑎𝑙𝑠: 𝑀𝑖𝑛 σ 𝑖=1 �𝑖
𝑛
(Cont)
2
ො
𝒚𝒊
𝒚𝒊>1328
��ෞ
𝑖 = 𝒓𝒆𝒔𝒊𝒅𝒖𝒂𝒍= 𝒚𝒊 -
ෞ𝒚𝒊
� 𝑦𝑖
�ෞ � ��ෝ𝒊 =
𝑖 � 𝑓𝑖𝑡𝑡𝑒𝑑 𝑣𝑎𝑙𝑢𝑒
𝒚𝒊 <1328
ෝ
𝒚𝒊
𝒊
��ෝ = 𝟖𝟏𝟓 +
𝟓𝟑𝒙
The Difference Between the Residual and the
Error
(Cont)
2.3. Interpretation
��ො = 𝛽መ + 𝛽መ 𝑥: the
estimated or sample regression function
0 1
𝛽1መ : the Δ𝑥
: the constant or
𝛽0 Δ�ො 1
slope=��
ො
intercept, which shows
መ
the average value of the = 𝛽መ by
Δ𝑥 which
which yො
indicates the average changes
amount
when 𝑥 other
unit, holding increases
factors byinone
the model
dependent variable ��ෝ constant.
when the independent
variable
𝒙 is set to zero. 𝛽1መ >0: a possitie association between 𝑦 and
𝑥1መ
𝛽 <0: a negative association between 𝑦 and
𝑥1መ =0: no association between 𝑦 and
𝛽
𝑥
Meat consumption and income in Lao Cai
(Cont) Monthly meat consumption per
household (1000 VND)
Monthly household income per
capita (1000 VND)
𝜷𝟎: The intercept 𝜷𝟏: The slope estimate of 0.161 means that
(constant) of 299 means a household's meat consumption would increase
that a household with by
has a predicted meat 0.161 thousand VND if their per capita
zero income
consumption of 299 income
thousand VND. increased
What is the by one thousand
average VND. for households with
meat consumption
a monthly income per capita of one million VND?
𝜷
: The intercept NOTE
(constant) of -856 means 𝟎: the intercept or constant often has no
𝟎
that all workers without
𝜷
education has a predicted real
wage of -856 thousand meaning for some reasons:
Zero settings for all independent variables are often
VND/month.
impossible or irrational. (e.g., can we set
Is this meaningful? a household's food consumption to zero?).
The intercept = - 856 when setting the independent variable (education) to zero ( zero years of
education).
But the data shows that education has the smallest value of 6 (6 years of education).
Therefore, we can’t interpret the intercept because it is outside of the data range.
The intercept = - 856 when setting the independent variable (education) to zero ( zero years of
education).
But the data shows that education has the smallest value of 6 (6 years of education).
Therefore, we can’t interpret the intercept because it is outside the range of the study data.
𝜷𝟎:The intercept absorbs the bias for the regression model.
(Cont)
𝐸
��ෝ
𝑖 <0
𝐸
��ෝ
𝑖 =0
𝜷𝒂
𝛽
መ0
𝜷𝒃
𝐸
��ෝ
𝑖 >0
2.5.
2.4. Properties of the OLS estimator: fitted values and residuals
Pr
��ෝ = 356.067 + 0.143𝑿=3560.667+0.143*3000=785.42 ope
rtie
s of
𝑦-��ෝ
the : Residuals
𝑿 𝒚 ��ෝ:
Obs OL(𝒖)
Predicted 𝑦 S
esti
1 3000 995 785.423017 ma
209.577
2 8208 2900 1530.78546
tor
1369.215
3 3613 1450 873.15481 576.8452
4 4624 1460 1017.84787 442.1521
5 4751 510 1036.02395 -526.024
6 5151 760 1093.27145 -333.271
7 5884 1005 1198.17749 -193.177
8 2696 100 741.914917 -641.915
9 2485 912 711.716861 200.2831
10 8860 570 1624.09889 -1054.1
Fitted values and residuals
𝑀𝑒𝑎𝑡 = 356 + 0.143
𝐼𝑛𝑐𝑜𝑚𝑒
(Cont)
Some algebraic properties of OLS
(Cont)
From the first order conditions of OLS, we have some algebraic properties of OLS:
The sum and mean of the residuals will aways equal zero
𝑛
ෝ
𝑖 = 𝐸 ��ෝ𝑖
=0
𝑖=1
𝐶 𝑜𝑣 𝑥𝑖, ��ෝ𝑖 = 0 𝑖=1 𝑥𝑖��ෝ𝑖
The residuals will be uncorrelated with the=independent
The residuals will be uncorrelated with the fitted or0predicted values
variable or σ 𝑛
𝐶𝑜𝑣 𝑦ෝ
𝑖, ��ෝ𝑖
=0
Sample averages of y and x lie on regression line
𝑌 ത = 𝛽መ + 𝛽መ 𝑋
0
1
The average of the predicted values is equal to the average of actual
Some algebraic properties of OLS
(Cont)
Observation X Y Predicted Y: Residuals:
𝑻𝑺𝑺 = σ 𝑛 (𝑦 𝑛 𝑹𝑺𝑺 = σ 𝑛
𝑖=1
(��ෝ𝑖)2,
𝑦ത)2 𝑬𝑺𝑺 =
where
𝑖=1 (�ො �ෝ
𝑖 𝑦ത)
2
−
𝑖− 𝑖=𝑦−
𝑖 ��ො
𝑖=1
𝑖
TSS represents total variation in the ESS represents variation RSS represents variation not
dependent variable(s)
explained by regression explained by regression
𝐸𝑆𝑆 𝑅𝑆𝑆
𝑅2 = = 1−
𝑇𝑆𝑆 𝑇𝑆𝑆
Graphic presentation for decomposing the total variation
Goodness-of-fit measure (R-squared)
N=265; 𝑅2=0.172
Change in the measurement unit of the in dependent variable 𝐗 Intercept 𝜷𝟎 Slope coefficient 𝛽1
X is divided by the constant 𝑪: 𝐗/𝐶 𝜷𝟎 𝛽1 ∗ 𝐶
X is multiplied by the constant 𝑪: 𝐗∗𝐶 𝜷𝟎 𝛽1/𝐶
Important notes:
Exact %∆𝑤𝑎𝑔𝑒= exp(0.0436*1)-1= .04456445 =4.45%
Functional form
(Cont)
2.6. Standard assumptions for the simple linear regression model
𝑦 = 𝛽0 + 𝛽1𝑥2 + 𝑢
From now on, the term “linear regression” means linearity in parameters (𝛽𝑠).
Both regression models are linear in parameters.
(Cont)
English= 𝑦 = 𝛽0 + 𝛽1𝑖𝑛𝑐𝑜𝑚𝑒 + 𝑢 Math= 𝑦 = 𝛽0 + 𝛽1𝑖𝑛𝑐𝑜𝑚𝑒 + 𝛽2𝒊𝒏𝒄𝒐𝒎𝒆𝟐 +𝑢
Stata command: curvefit english income, function (1) Stata command: curvefit math income, function (4)
σ 𝑛𝑖=1 (𝑥𝑖 −
𝑥ҧ)2 >0
If the values of the independent variables are identical, it
(Cont)
Assumption SLR.4 (Zero conditional mean): 𝑬(𝒖|𝒙) = 𝟎
(Cont)
We have already discussed about this crucial assumption
Given any value of the explanatory variable, the expected value of the error
term is zero: 𝐸 𝑢 𝑥 = 0;
In other words: the value of the independent variable (X) must contain
no information about the mean of the unobservables (u).
Note: 𝐸 𝑢 𝑥 = 0: There is no linear or non-linear
relationship
between 𝑥 and 𝑢.
𝐸 𝑢𝑥 = 0 implies that the explanatory variable is exogenous:
𝐶𝑜𝑣 𝑥, 𝑢 = 𝐸 𝑥𝑢 = 0: There is no linear association between 𝑥 and 𝑢.
Questions:
𝑪𝒐𝒗 𝒙, 𝒖 =0 implies that 𝑬 𝒖 𝒙 = 𝟎?
𝑪𝒐𝒗 𝑥, 𝑢 = 𝟎 𝑜𝑟 𝑪𝒐𝒓𝒓(𝑥, 𝑢) =0 does not implies
that 𝑬 𝒖 𝒙 = 𝟎
Assumption SLR.5 (Homoskedasticity): V𝐚𝐫(𝒖|𝒙) = 𝝈𝟐
(Cont)
𝑯𝒆𝒕𝒆𝒓𝒐𝒔𝒌𝒆𝒅𝒂𝒔𝒕𝒊𝒄𝒊𝒕𝒚: Wage variation around the 𝑯𝒐𝒎𝒐𝒔𝒌𝒆𝒅𝒂𝒔𝒕𝒊𝒄𝒊𝒕𝒚: Variation in log wage around the
mean tends to increase with 𝑒𝑑𝑢𝑐𝑎𝑡𝑖𝑜𝑛 𝑙𝑒𝑣𝑒𝑙𝑠 mean is relatively constant across all education leves.
W𝑎𝑔𝑒 = 𝛽0 + 𝛽1𝑒𝑑𝑢 𝐿𝑜𝑔_W𝑎𝑔𝑒 = 𝛽0 + 𝛽1𝑒𝑑𝑢
Stata command: Stata command:
gen Log_Wage=ln(wage)
Reg wage edu
Reg Log_Wage edu
hettest hettest
Gauss-Markov assumptions of the Simple Linear
Regression (SLR)
Under SLR.1-SLR.4, 𝑡ℎ𝑒 𝑂𝐿𝑆 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑜𝑟 𝛽𝑗 is unbiased: 𝑗 𝑗
Under
E(𝛽 )=
Under 𝛽 𝑡ℎ𝑒 𝑂𝐿𝑆𝑡ℎ𝑒
SLR.5,
SLR.1-SLR.5, 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑜𝑟 𝛽𝑗መ has𝛽መ
𝑂𝐿𝑆 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑜𝑟 thefor
smallest
𝛽 is thevariance among
best linear other linear
unbiased unbiased
estimator
estimator.
(BLUE)
𝑗 𝑗
What happens if the assumptions SLR.1–SLR.4 are satisfied but the assumption SLR.5 is not?
2.7. Mean and variances of the OLS estimator
Interpretation of unbiasedness
Under SLR.1-SLR.4, 𝑡ℎ𝑒 𝑂𝐿𝑆 𝑒𝑠𝑡𝑖𝑚𝑎𝑡𝑜𝑟 𝛽𝑗 is unbiased: E(𝛽𝑗 )=𝑗𝛽
Unbiasedness does not imply that, with a given sample, our estimated parameters would
equal the exact true values of the population parameters.
In a given sample, estimates may larger (𝛽0 > 𝛽0 ; 𝛽1 >1 𝛽 ) or smaller 0(𝛽 0<𝛽 1; 𝛽
1 <𝛽 )
the true values.
than
Instead, the unbiasedness should be interpreted that:
E(𝛽መ )=𝛽
Variances of OLS estimators:
Estimating the variance of the error term:
�ෝ
From a population regression model: 𝑦 = 𝛽0 + 𝛽1𝑥+ 𝒖, 𝒖 is the error term
𝟐 have a sample regression model: 𝑦𝑖 = 𝛽0መ 1 𝑖 + 𝑖 representing all
we
unobservables.
σ 𝑛𝑖=1 ��ෝ 𝑖 = 𝑬
𝛽መ 𝑥��ෝ 𝑖 += 0; , where ��ෝ is an
�ො
Recall�ෝ = 𝑦residual
that𝒊 the 𝑖 − ��ො (𝒖) can be seen as an estimate of . errorestimate
𝑖 the term of 𝒖
(𝒖) Now= the
weresidual.
have to obtain an unbiased estimate of variance of the error
term.
��ෝ measures the average distance between the observed values and the regression line (the
fitted values).
Estimating the variance of the error term:
�ෝ
𝟐
We have σ 𝑛𝑖=1 𝑖
(Cont)
�ො ��ෝ
1
𝑛𝑖=1 ��ො 2 2
= 4437760/11-
𝑛−𝑘−1 σ 𝑖
=4437760,
𝟐 = where n=11,2=4437760/9=493084.44
k=1 (𝑥)
��ෝ = ��ො 2= 493084.44 =
702.19972
Note:
The standard error of the regression
(�ෝ ) has the same unit
as the dependent variable.
��ෝ also has other names: the standard error of the estimate and the
Variances and standard errors for regression coefficients
𝑉𝑎𝑟(𝛽0); 𝑉𝑎𝑟 𝛽1 ; 𝑆𝑒 𝛽0መ; 1 ��ෝ
𝑛−𝑘−1
1
𝑖=1 𝑖
(Cont) =
𝟐 𝑛
σ
𝑆𝑒 𝛽መ �ො
2
; ��ො = ��ො2
Variance and standard error for the slope coefficient
𝜷𝟏 𝛽1መ = � 2 ; 𝑆𝑒 𝛽መ = 𝑉𝑎𝑟 𝛽መ
𝑉𝑎𝑟 �
𝑖=1 (𝑥 𝑖 −𝑥ҧ)=
�ෝ 𝑛
�
σ𝑛 1 ෝ
σ 𝑖 = 1 (𝑥 𝑖 −𝑥ҧ)
2
1 2
E(𝛽መ
𝑗 )= 𝑗
True: 𝛽𝑗
Properties of the mean and variances
Exercise:
1. Is the residual the error term? Explain
2. Why do the sum and mean of the residual always equal zero?
3. What happens to the sum and mean of the residual if we exclude the
intercept from the OLS model?
4. What happens to the OLS estimator if the sample is not randomly selected
from a population?
5. What happens to a simple linear regression model if the value of the
explanatory variable is similar for all observations?
6. Suppose our model satisfies SLR assumptions 1–4 but suffers from
heterokedasticity. In this case, are our estimates biased?. What is the
consequence of the heterokedasticity?
7. Comment on the statement that a model with a high R-squared shows a
strongly causal relationship.
8. Which model violates the assumption of the OLS?
𝑌 = 𝛽0 + 𝛽11/𝑋+ 𝑢; (1)
𝑌 = 𝛽0 + 1/𝛽1𝑋+ 𝑢; (2)
𝑌 = 𝛽0 + 𝛽12𝑋 + 𝑢 (3)
Excercise
9.Let Qd denote the quantity of a given product, and let P denote the price of that product. A
simple model is presented that connects quantity demanded to price: 𝑄𝑑 = 𝛽0 + 𝛽1𝑃 + 𝑢
(i) What possible factors are contained in 𝑢? Is it likely that these will be related to price
(ii) Will a simple regression analysis show the ceteris paribus effect of price on quantity demanded? Explain.
10. The following table contains monthly meat consumption per household (thousand VND) and monthly household
income per capita (thousand VND) for
list 20 househol
meat dincom list
s. meat income
e
1 1390 5031 11 1770 4365
2 1320 6491 12 1620 4727
3 2900 4900 13 1460 5067
4 790 3267 14 650 5094
5 1600 5164 15 995 3000
6 2400 3260 16 2900 8208
7 1310 4847 17 1450 3613
8 1690 8395 18 1460 4624
9 1880 6625 19 510 4751
10 1205 2394 20 760 5151
(i)estimate the relationship between the dependent variable (meat consumption) and the independent variable (household
income per capita) using an OLS regression model. Comment on the link between two variables. What is the meaning of the
intercept and slope coefficients?
(ii)How much higher is the level of meat consumption predicted to be if the monthly income per capita is increased by 200
thousand VND?
(iii) Is this true if we say that given a one million VND increase in household income per capita, the value of meat consumption
increases at the same level for all households?
(iv)calculate the fitted values of the dependent variable and the residuals. Do the sum and mean of the residuals equal zero?
What is the average of the fitted values and the observed values of the dependent variables?
(v) Please interpret the R-squared. How much of the variation in meat consumption is unexplained by the regression?
(vi)calculate the standard error of the regression coefficients and the standard error of the regression. What is the unit of analysis
for the standard error of the regression?
11. Using a simple linear regression model, a researcher investigates the dependence of the monthly wage (in thousand VND) on
the number of years of education among wage workers in Hanoi in 2018.
(i) What is the average predicted wage when education equals zero?
(ii) How much does the monthly wage increase if the number of years of education increases from 12 to 16 years?
(iii) Does this model infer a causal relationship between wage and education?
(iv) What percentage of the variance in wages is explained by education?
12. A sample of 11 households with their income and food consumption is given in the table.
Income Food consumption
Thousand VND/per person/month Thousan VND/per person/month
3000 995
8208 2900
3613 1450
4624 1460
4751 510
5151 760
5884 1005
2696 100
2485 912
8860 570
1436 512
Using the OLS estimator, estimate the relationship between the dependent variable (food consumption) and the explanatory variable
( income):
𝐹𝑜𝑜𝑑 = 𝛽0 + 𝛽1𝐼𝑛𝑐𝑜𝑚𝑒+ 𝑢
(i) Using the regression result, please report the marginal propensity to consume food (MPCF) .
(iii)What is the MPCF if the regression model excludes the intercept? 𝐹𝑜𝑜𝑑 = 𝛽1𝐼𝑛𝑐𝑜𝑚𝑒+ 𝑢. (Note, please use
“constant is zero” in excel”) or noconstant in Stata
(iv)Using the result from the model without intercept, calculate the fitted values of the dependent variable and the residuals.
Do the sum and mean of the residuals equal zero? What is the average of the fitted values and the observed values of the
dependent variables?
(v) Does the exlussion of the intercept from the model cause the bias? Explain.