Professional Documents
Culture Documents
The most commonly applied econometric tool is the regression analysis. The very important
role of econometrics is to provide the tools for modeling on the basis of given data. The
regression modeling technique helps a lot in this task. The regression models can be either
linear or non-linear. We will consider only the tools of linear regression analysis and our
main interest will be the fitting of linear regression model to a given set of data.
In statistics, a simple linear regression model uses a single variable to predict the result of
the other variable. The linear regression model is one of the fundamental workhorses of
econometrics and is used to model a wide variety of economic relationships. The general
model assumes a linear relationship between a dependent variable y, and one or more
independent variables, X. The simplest linear relation called simple linear regression model
and The sample data then fit the statistical model:
𝑦𝑖 = (𝛽0 + 𝛽𝑥𝑖 ) + 𝜀𝑖
0 : Is called an intercept, mathematically 0 is the expected value of ( y ) at the value of (𝑥𝑖 = 0),
𝐸(𝑦) = 𝛽0 + 𝛽1 𝑥𝑖
(it is a vertical distance between origin point and intersection point Reg. line with Y-axis).
1 : Is called the slope of function and represent amount of variation in dependent variable Y
when the explanatory variable X changes with unity one.
6
𝛥𝑌 𝑠𝑖𝑛 𝜃 𝛥𝑌/𝑍 𝛥𝑌
Slope= 𝛽1 = 𝛥𝑋 , Slope== 𝛽1 = 𝑡𝑎𝑛 𝜃 = = =
𝑐𝑜𝑠 𝜃 𝛥𝑋/𝑍 𝛥𝑋
yˆ i = ˆ0 + ˆ1 xi
Note: the sample regression line passes through sample means of (X) and (Y), means ( x, y ).
12 22 ... 32 2
3. Random error distributed normal distribution with mean zero and variance ( e2 ) , then we
can make statistical tests where we use those tests only when statistical population data
distributed normally distribution.
7
4. The values of random error (ei ) are independent with the values of explanatory variable
( xi ) : Cav(ei , xi ) = 0 , E (ei , xi ) = 0 no correlation ,
5. There is no relation between the values of random variable error in current time (et ) and
its value in pervious time (et −1 ) or its value in next time (et +1 ) , means there is no
autocorrelation problem among errors:
Cav(ei , e j ) = 0 for all i j , i = j = 1,2,..., n
Notes // the reasons of adding a random variable error in model:
1. Delete some of variables or factors from model.
2. Randomness nature of human behavior.
3. Lack of formulating (miss-specification) of relation.
4. Collection errors, those errors may fall at collecting data.
5. Measurement errors, there are errors in measurement the observation of variables.
8
4. There is no relation (correlation) among explanatory variables in model and if appear
this problem in multiple regression model and called multicollinearity.
5. There is no outlier, extreme points and influence points.
To check these assumptions, if these assumptions are valid or not then we perform residual
analysis (check plots & testes):
2. For Linearity:
To check this again looks at the plot of the residuals versus the ( xi ) values or look at scatter
plot.
9
These plots are not randomly (dependent errors), its autocorrelation function (ACF) plot.
4. For normality:
To check this look at the (q ~ q) plot (quantile to quantile plot), it is normal probability graph
paper, is normal c.d.f plot of pairs ( (qi , ei ) as straight line. If this is approximately linear with
unit slope then the errors are distributed normal distribution.
10
5. For outliers and extreme points:
To check this we use Box-plot:
Box-length= Q3 − Q1
If the value is far as 1.5( Box − length) = 1.5(Q3 − Q1 ) then that value is outlier. If the value is far as
3( Box − length) = 3(Q3 − Q1 ) then that value is extreme point.
E ( yi ) = 0 + 1 xi
ei = yi − E ( yi ) = yi − 0 − 1 xi
Q = ei2 = ( yi − E ( yi )) 2 = ( yi − 0 − 1 xi ) Always 0
2
Q ei Q
2
Q ei Q
2
11
After takes partial derivative of Q with respect to 0 , 1 and equal to zero, and solved the
Eq(1 & 2) simultaneously, we get: ˆ0 = y − ˆ1 x , ˆ1 =
x i y i − nx y
x 2
i − nx 2
SSE = i2 = = (Y − X )(Y − X )
= Y Y − 2 X Y + X X
∂SSE
= −2X ′ Y + 2X ′ Xβ̂ = 0 X X̂ = X Y ……..(1)
∂β
Resolve these equations by multiply both sides on ( X X ) −1 we can obtain the estimates of the
least squares: ̂ = ( X X ) −1 X Y
y = n + x
i x0 1 i i
y x = x + x …(2)
i i 0 i 1
2
i
y n x *
=
i i 0
x y x x
2
i i i i 1
n x = n x − ( x )
N = i 2 2
x x
2 i i
i i
y x = y x − ( x x y )
N = i i 2
x y x
0 2 i i i i i
i i i
n y = n x y − ( x y )
N = i
x x y
1 i i i i
i i i
ˆ =
N
=
y x − ( x x y )
0 i
2
i i i i
n x − ( x )
o 2 2
N i i
N n x y − ( x y )
ˆ = = 1 i i i i
n x − ( x )
1 2 2
N i i
12
H.W: prove that
∑ 𝑦𝑖 ∑ 𝑥𝑖2 −(∑ 𝑥𝑖 ∑ 𝑥𝑖 𝑦𝑖 ) ∑𝑛 ̅)
𝑖=1 𝑥𝑖 (𝑦𝑖 −𝑦
1. 𝛽̂𝑜 = 2. 𝛽̂1 =
𝑛 ∑ 𝑥𝑖2 −(∑ 𝑥𝑖 )2 ∑𝑛
𝑖=1 𝑥𝑖 (𝑥𝑖 −𝑥̅ )
𝑛 𝑛
(∑𝑖=1 𝑦𝑖 )(∑𝑖=1 𝑥𝑖 )
∑𝑛 ∑𝑛
𝑖=1 𝑦𝑖 𝑥𝑖 −
𝑖=1 𝑦𝑖 (𝑥𝑖 −𝑥̅ )
3. 𝛽̂1 = ∑𝑛 4. 𝛽̂1 = (∑
𝑛
𝑛 𝑥 )2
𝑖=1 𝑥𝑖 (𝑥𝑖 −𝑥̅ ) ∑𝑛 2 𝑖=1 𝑖
𝑖=1 𝑥𝑖 − 𝑛
Example -1- // The motor pool wants to know if it costs more to maintain cars that are
driven more often.
Data are gathered on each car in the motor pool, regarding number of miles driven in a
given year, and maintenance costs for that year. Here is a sample of the data collected.
Car Number 1 2 3 4 5
Miles Driven (X) 80 29 53 13 45
Repair Costs (Y) 120 54 65 20 32
x − nx 2
i
2
Car
Repair Costs yi Miles Driven xi xi2 xi yi
Number
1 120 80 6400 9600
2 54 29 841 1566
3 65 53 2809 3445
4 20 13 169 260
5 32 45 2025 1440
∑ 𝑦𝑖 = 291 x i = 220 x 2
i = 12244 x y i i = 16311
y = 58.2 x = 44
x 2 = 1936
x − nx
2
i 12244 − 5(1936 )
2
12244 − 9680 2564
13
ˆ0 = y − ˆ1 x = 58.2 − (1.3678)(44) = 58.2 − 60.1832 = −1.9832
yˆi = ˆ0 + ˆ1 xi = −1.9832 + 1.3678 xi
1 80
1 29
1 1 1 1 1
120 1 80 X X = 1 53
54 1 80 29 53 13 45
29 1 13
1 45
Y = 65 , X = 1 53 , = 0 ,
1
20 1 13
32 1 45
n
X X =
x = 5
i 220 yi 291
X Y = =
xi x 220
2
i 12244 xi y i
16311
11 21
−1
5 220 adj ( X X ) 12 22
( X X ) −1 = = = =
220 12244 X X X X
Solution 3 // yi = 0 + 1 xi + i , Yˆ = X̂
yi n x * 291 5 220 0
= 16311 = 220 12244 *
i 0
,
x i y i x i x
2
i
1 1
n xi = n x 2 − ( x ) 2
N = i i
xi xi
2
5 220
N = = (5)(12244 ) − (220)(220) = 61220 − 48400 = 12820
220 12244
yi x = y x
N0 =
i 2
− ( xi xi yi )
xi yi x 2 i i
i
14
291 220
N0 = = (291)(12244 ) − (220)(16311) = 3563004 − 3588420 = −25416
16311 12244
n y = n x y
N1 =
i
− ( xi y i )
xi x y i i
i i
5 291
N1 = = (5)(16311) − (220)(291) = 81555 − 64020 = 17535
220 16311
ˆo = 0 = i i 2 i 2 i i =
N y x2 − ( x x y ) − 25416
= −1.9825
N n xi − ( xi ) 12820
N1 n xi yi − ( xi yi ) 17535
ˆ1 = = = = 1.3678
N n xi2 − ( xi ) 2 12820
yˆ i = ˆ0 + ˆ1 xi = −1.9825 + 1.3678 xi
H.W -1- // Mean yields of soybean plants (gms per plant) obtained in response to the
indicated levels of ozone exposure over the growing season. (Data courtesy of Dr. A. S.
Heagle, USDA and North Carolina State University).
X Y
Ozene (ppm) Yield (gm/plt)
0.02 242
0.07 237
0.11 231
0.15 201
∑ 𝑥𝑖 = 0.35 ∑ 𝑦𝑖 = 911
H.W -2- //As a profit maximizing monopolist, you face the demand curve yi = 0 + 1 xi + i , in
the past, you have set the following prices and sold the accompanying quantities:
Y
3 3 7 6 10 15 16 13 9 15 9 15 12
quantities
X
18 16 17 12 15 15 4 12 11 6 8 10 7
Prices
Required// compute the ordinary least squares coefficients in the regression model above
by using:
1. Origin values of observation.
2. Matrices Model.
3. Grammer Rule.
15
2.5 Statistical tests with (ANOVA) table and coefficient of determination (R2)
1. From the ANOVA table, we can decompose the total sum of squares (of the dependent
variable Y around its mean) into two parts:
• The Explained (or Regression) Sum of Squares.
• The Residual Sum of Squares.
SSE SSE
1 = R2 + , R2 = 1 − , 0 R2 1
SST SST
16
2.6 Standard errors
The S.E of estimated parameter used to measure scope of confidence which can base on it
consideration estimation value well approximation for statistical population parameter
value. This test helps to determine that estimations ˆ0 , ˆ1 different from zero, significantly
different.
The hypothesis of test is:
H 0 = i = 0 Null hypothesis
H1 = i 0 Alternative hypothesis , where i = 0,1
Then we calculate standard deviation (error) for parameters by the following forms:
1. Standard deviation of intercept:
1 𝑥̅ 2 𝜎 2 ∑ 𝑥𝑖2
̂ √ ̂ √ 2
𝑆(𝛽0 ) = 𝑉(𝛽0 ) = 𝜎 ( + )= √
𝑛 𝑆𝑥𝑥 𝑛𝑆𝑥𝑥
2. Standard deviation of slope:
2 SSE ei
2
Then we compare between standard deviation (error) for ˆ0 & ˆ1 with half numerical values
of two estimated parameters.
ˆi
If: S (ˆi )
2
Then we reject H 0 the estimated parameter is different from zero, then the estimated
parameter has statistically significant effect.
ˆi
If: S (ˆi )
2
Then we not reject H 0 the estimated parameter is not different from zero and then the
estimated parameter has not statistically significant effect.
Note// for fixed (n) we can decrease S (ˆ1 ) or S (ˆ0 ) by expanding range of X values sampled.
17
ˆ1 =
x i y i − nx y
Solution // 1- yi = 0 + 1 xi + i , yˆ i = ˆ0 + ˆ1 xi , ˆ0 = y − ˆ1 x ,
x 2
i − nx 2
yi xi xi yi xi2
4 5 20 25
6 8 48 64
7 10 70 100
8 12 96 144
11 14 154 196
15 17 255 289
18 20 360 400
22 25 550 625
y i = 91 x i = 111 x y i i = 1553 x 2
i = 1843
y = 11.375 x = 13.875
x = 192.5156
2
x − nx
2
i 1843 − 8(192.5156 )
2
1843 − 1540 .1248 302.875
Coefficientsa
Model Standardized
Unstandardized Coefficients Coefficients
yˆ i = −1.927 + 0.959 xi
When the explanatory variable ( x i ) increasing unity one that led to increase the independent
variable ( yi ) by amount ( 0.959 ) unit, (there is a positive relationship between ( Y & X ).
Model Summary
Adjusted R Std. Error of the
Model R R Square
Square Estimate
18
2- n = 8 , x i = 111 , y i = 91 , x y i i = 1553 , x = 13.875 , y = 11.375
y 2
i = 1319 , x 2
i = 1843 , intercept = ˆ0 = −1.927 , = ˆ1 = 0.959
SSR = ˆ1Sxy = (0.9587 )(290.375) = 278.38 , SSR = ̂12 Sxx , SSR = 278.391 ,
SSR 278.391
R2 = = 100 = 98.068% = 0.9806 = 0.981
SST 283.875
Here (98. 06%) or (98%) from getting changes ( yi ) cause it the explanatory variable ( x i )
which existing in model, and remaining proportion of deviations (2%) returns to unknown
factors (omitted factors) in Reg. function do not taken in consideration to r.v called error
term.
H 0 : 0 = 0 H 0 : 1 = 0
3- ,
H1 : 0 0 H 1 : 1 0
2
2 1 x2 Se
S ( ˆ0 ) = S e ( + ) = 0.834 , S ( ˆ1 ) = ) = 0.055
n Sxx Sxx
ˆ
S ( ˆ0 ) 0 0.834 −0.963
2
Then we not reject null hypothesis ( H 0 : 0 = 0 ), the parameter ( 0 ) is not different from
zero, then it has not statistically significant effect that means the regression line pass from
origin point, then we can say that the relation between ( X & Y ) takes the following form:
yˆ i = 0.959 xi
ˆ
S ( ˆ1 ) 1 , 0.055 0.4795
2
Then we reject null hypothesis ( H 0 : 1 = 0 ), this means the slope ( 1 ) of regression line not
equal to zero, the line will be not parallel for X-axis that indicates relation between ( X & Y )
statistically significant.
19
H.W -1- // An article in Technometrics by S. C. Narula and J. F. Wellington [“Prediction,
Linear Regression, and a Minimum Sum of Relative Errors” (Vol. 19, 1977)] presents data
on the selling price and annual taxes for 24 houses. The data are shown in the following
table.
a- Assuming that a simple linear regression model ia appropriate, obtain the least squares fit
relating selling price to taxes paid. And what is the estimate of 𝜎 2 ?
b- Find the mean selling price given that the taxes paid are 𝑥 = 7.50 .
c- Calculate the fitted value of y corresponding to 𝑥 = 5.8980 and find the corresponding
residual.
d- Calculate the fitted 𝑦̂𝑖 for each value of 𝑥𝑖 used to fit the model.
e- Calculate the determination coefficient and ANOVA table then explain the results.
f- Test significance of parameters using standard error method, with explains the results.
20
2.7 The properties of the least square estimators
The least squares estimators describes by BLUE property which the best linear unbiased
estimates for ( 0 , 1 ) with condition that a ( ei ) satisfies the general assumptions.
ei ~ N (0, 2 )
Cov(ei , e j ) = E (ei , e j ) = 0 i j
Cov(ei , xi ) = E (ei , xi ) = 0
In addition, this property with conditions are necessary available it, called Gauss-Markov
Least Squares Theorem. The important in this theory is proves that among all unbiased
linear estimators, the OLS estimators describes with (BLUE) property and to prove Gauss-
Markov theory must prove the following properties:
1. Linearity property
( xi − x )
For ̂1 : let k i =
(x
2
i − x)
ˆ1 = k i y i = k1 y1 + k 2 y 2 + k 3 y 3 + ... + k n y n
̂1 is linear function of yi
For: ˆ0 = y − ˆ1 x
=
y i 1
− x k i yi = ( − xk i )yi
n n
Since ( k i , x , n ) are constant amounts therefore then ̂ 0 only depends on ( yi ) values
Let; power of ( yi ) equal one then ̂ 0 is linear function of ( yi ) values.
1
d i = ( − xki )
n
ˆ 0 = d i y i = d1 y1 + d 2 y 2 + d 3 y 3 + ... + d n y n
̂ 0 is linear function of yi
2. Unbiased property
For ̂1 //
ˆ1 = k i y i = k i ( 0 + 1 xi + ei ) = 0 k i + 1 k i xi + k i ei = 0 (0) + 1 (1) + k i ei
= 1 + k i ei
E ( ˆ1 ) = 1 + k i E (ei ) , E (ei ) = 0
E ( ˆ1 ) = 1
̂1 is unbiased estimator for 1
ˆ0 =
y i 1
− x k i yi = ( − xk i ) yi
n n
21
1 1
E ( ˆ0 ) = ( − x k i )E ( y i ) = ( − x k i )( 0 + 1 xi )
n n
n
0 − x 0 k i + 1
x i − x k x
= 1 i i
n n
= 0 − x 0 (0) + 1
x i − x (1) = + x − x
1 0 1 1
n
E (ˆ0 ) = 0
̂ 0 is unbiased estimator for 0
22
ˆ
E ( ˆ1 ) = 1
ˆ
̂1 is unbiased estimator for 1
ˆ ˆ ˆ ˆ
Var ( ˆ1 ) = E ( ˆ1 − E ( ˆ1 ) 2 = E ( ˆ1 − 1 ) 2
ˆ
Var( ˆ1 ) = E ( 1 + ci ei − 1 ) 2 = E ( ci ei ) 2 = E ( ci2 ei2 + 2 ci c j ei e j )
i j
= c E (e ) + 2 ci c j E (ei e j ) ,
2
i
2
i E (ei e j ) = 0
i j
= 2 c i = 2 (k i + d i ) = 2 ( k i2 + 2 k i d i + d i2 ) , k d
2 2
i i =0
= 2 ( ki2 + d i2 ) = 2 ki2 + 2 d i2
2
= + 2 d i2
Sxx
= Var(ˆ1 ) + Positive Quantity
ˆ
Var ( ˆ1 ) = Var ( ˆ1 ) + Positive Quantity
ˆ
Var ( ˆ1 ) Var ( ˆ1 )
̂1 is BLUE
Proof// For ̂ 0
ˆ0 = y − 1 x
ˆ0 =
y 1
− x k i yi = ( − xk i ) yi
i
n n
Let ˆˆ0 = ( − x ci ) y i be another estimator for 0
1
n
ˆ 1 1
E ( ˆ0 ) = ( − x ci )E ( y i ) = ( − x ci )( 0 + 1 xi )
n n
n
= 0 − 0 x ci + 1
xi − x c x
1 i i
n n
ˆ ˆ
So that ̂ 0 be unbiased estimate E ( ˆ0 ) = 0 must be ci = 0 , c xi i =1
So that c = 0 must be d = 1 because k = 0
i i i
23
= 2 (
1 ci 2 n ci + x 2 c 2 )
n2
− 2 x
n
+ x 2 2
c i ) = (
n2
− 2 x
n
i
1
= 2 ( + x 2 (k i + d i ) )
2
, ki di = 0
1
= 2 ( + x 2 k i2 + x 2 d i2 + 2 x 2 k i d i )
n
1
= 2 ( + x 2 k i2 + x 2 d i2 )
n
1
1
= 2 ( + x 2 k i2 ) + x 2 2 d i2 , k i2 =
n Sxx
1 x2
= 2( + ) + x 2 2 d i2
n Sxx
= Var( ˆ0 ) + Positive Quantity
ˆ
Var( ˆ0 ) = Var( ˆ0 ) + Positive Quantity
ˆ
Var( ˆ0 ) Var( ˆ0 )
̂ 0 is BLUE
This model consists of the number of variables (more than two variables), therefore we
using matrices algebra in analysis:
Yi = 0 + 1 X i1 + 2 X i 2 + ... + k X ik + ei , i = 1,2,3..., n (sample size)
j = 1,2,3..., k (k= No. of explanatory variables)
24
y1 1 x11 x12 .. x1k 0 e1
y 1 x e
2 21 x 22 .. x 2 k 1 2
. = . .. .. .. ..
2
+ e3
. .
. . .. .. .. ..
y n 1 x n1 . .
xn 2 .. x nk n( k +1)
n1 k ( k +1)1 en n1
Y = X +e
Where:
Y : The vector for observations values of dependent variable of order (n 1) .
X : The matrix of explanatory variables of order (n (k + 1)) .
: The vector of unknown coefficients for the model of order ((k + 1) 1) .
e : The vector of random errors of order (n 1) .
The main assumptions for random variable ( ei ) in general linear model are the same
assumptions for random variable ( ei ) in simple linear model.
e ~ iidN (0, 2 I n ) , E (ei , e j ) = 0 for all i j , E (ei , X j ) = 0
k : Measures the change in the mean value of ( Y ) per unit change in ( X k ), holding the rest
explanatory variables constant.
25
In case two explanatory variables using OLS method.
e 2
= −2 (Y − − X − X )=0
i
0
i 0 1 i1 2 i2
ei2
= −2 (Yi − 0 − 1 X i1 − 2 X i 2 ) X i1 = 0
1
ei2
= −2 (Yi − 0 − 1 X i1 − 2 X i 2 ) X i 2 = 0
2
Y = nˆ + ˆ X + ˆ X
i 0 1 i1 2 i2 …..(1)
X Y = ˆ X + ˆ X + ˆ X X
i1 i 0 i1 1
2
i1 2 i1 i2 …..(2) Normal Equations
X Y = ˆ X + ˆ X X + ˆ X
i2 i 0 i2 1 i1 i2 2
2
i2 …..(3)
By using matrices:
Yi n X X ˆ0
ˆ
i1 i2
X i1Yi = X i1 X X X i1 i 2 1
2
i1
X i 2Yi X i 2 X X X ˆ
i 2 2
2
i1 i2
We using Grammar's method to find the coefficients ( ˆ0 , ˆ1 , ˆ2 ) as follows:
Let:
n
X X i1 i2
Yi
X X i1 i2
N = X i1 X X X 2
i1 i1 i 2 , N 0 = X i1Yi X X X 2
i1 i1 i 2
X i 2 X X X 2 X i 2Yi X X X 2
i1 i2 i2 i1 i2 i2
n
Y X i i2
n
X Y
i1 i
N 1 = X i1 X Y X X i1 i i1 i 2 , N 2 = X i1 X X Y 2
i1 i1 i
X i 2 X Y X 2 X i 2 X X X Y
i2 i i2 i1 i2 i2 i
N0 N1 N2
ˆ0 = =? , ˆ1 = =? , ˆ2 = =?
N N N
2. Matrices Algebra Method:
Y = 0 + 1 X i1 + 2 X i 2 + 1 X i 3 + ... + k X ik + ei , i = 1,2,3..., n (sample size)
Y = X +e j = 1,2,3..., k (k= No. explanatory variables)
We have the same assumption about the random variable error here:
26
E (e1 ) 0
E ( e ) 0
2
Where: E ( e) = . = . = 0
. .
E (en ) 0
12 0 0 .. 0
0 2
2
0 .. 0
= .. .. .. .. .. , 12 = 22 = ... = n2 = 2
.. .. .. .. ..
0 .. .. n2
0
1 0 0 .. 0
0 1 0 .. 0
2 0 0 1 .. o = 2 I
Var − Cor (e) = E (ee ) =
. . . . . n
. . . . .
0 0 0 .. 1
And also by using matrices we get the coefficients estimation for GLM:
Y = X +e
e =Y − X
e e = (Y − X )(Y − X ) = Y Y − X Y − Y X + X X
ˆ0
ˆ
1
ˆ ˆ
X Y = X X = ( X X ) X Y = .
−1
.
ˆ
k
Notes//
27
• if we have one explanatory variable:
n
X X =
x i
, X Y =
y i
x i x x y
2
i i i
n
x x
i1 i2
yi
• if we have two explanatory variables: X X = xi1 x x x
2
i1 i1 i 2 , X Y = xi1 yi
xi 2 x x x 2
xi 2 yi
i1 i 2 i2
Unbiased property:
ˆ = ( X X ) −1 X Y , Y = X + e
= ( X X ) −1 X ( X + e)
= + ( X X ) −1 X e ….(1)
E ( ˆ ) = + ( X X ) −1 X E (e) , E ( e) = 0
E ( ˆ ) =
ˆ is unbiased estimator vector for
To find the form of variance-covariance matrix for estimator's coefficients vector by OLS
method is as follows:
Var − Cov( ˆ ) = E ˆ − E ( ˆ ) = E ˆ −
2
2
= E ( ˆ − )(ˆ − )
ˆ = + ( X X ) −1 X e ˆ − = ( X X ) −1 X e
Var − Cov( ˆ ) = E ( X X ) −1 X e ( X X ) −1 X e
= E ( X X ) −1 X eeX ( X X ) −1
= ( X X ) −1 X E (ee) X ( X X ) −1 , E (ee) = 2 I n
= 2 I n ( X X ) −1 X X ( X X ) −1 , X X ( X X ) −1 = I
= 2 ( X X ) −1
=
2 e 2
i
=
ee
, n − k − 1 : when k = X is No. of explanatory variables
n − k −1 n − k −1
e
e = Y − Yˆ = Y − X ̂
28
(Y − X ˆ )(Y − X ˆ )
e2 =
n − k −1
e2 = (Y Y − ˆ X Y − Y X ˆ + ˆ X X ˆ ) /( n − k − 1) , ˆ = ( X X ) −1 X Y
= (Y Y − 2 ˆ X Y + ˆ X X ( X X ) −1 X Y ) /( n − k − 1) , X X ( X X ) −1 = I
= (Y Y − 2 ˆ X Y + ˆ X Y ) /( n − k − 1)
e2 = (Y Y − ˆ X Y ) /( n − k − 1) , Y Y = Yi 2
SSE (Y Y − ˆ X Y )
S e2 = e2 = =
n − k −1 n − k −1
t-test hypotheses:
H0 : j = 0
H1 : j 0
ˆ j − j ˆ j ˆ j
Cal t = = = , j = 0,1,2,..., k or j = 1,2,..., k + 1
S ( ˆ j ) S ( ˆ j ) 2 c jj
And: if Cal t Tab t we reject H 0 , j 0 this means that the explanatory variable
influences significantly on the dependent variable.
If Cal t Tab t we not reject H 0 , j = 0 this means that the explanatory variable X j has
not significantly influence on the dependent variable.
2. The F-test
To reach for F-test seem of construction of (ANOVA) table which depends on two types of
deviations (Explained SSR and Unexplained SSE).
29
H 0 : 1 = 2 = ... = k = 0
H 1 : 1 2 ... k 0
SST = (Yi − Y ) = Yi 2 − nY = Y Y − nY
2 2 2
SST = SSR + SSE ,
SSE = Y Y − ̂ X Y
SSR = SSR ( X 1 , X 2 ,.., X k ) = ̂ X Y
SSR( X 1 , X 2 ,.., X k / X 0 ) = SSR( X 1 , X 2 ,..., X k ) − SSR( X 0 )
2
SSR ( X 0 ) = nY
SSR ( X 1 , X 2 ,.., X k / X 0 ) = ˆ X Y − nY
2
(ANOVA Table)
S.O.V d.f SS MS F
ˆ X Y − nY ( ˆ X Y − nY ) / k
2 2
Re g.( X 1 , X 2 ,.., X k / X 0 ) k MSR
CalF =
MSE
Error(Re sidual) n − k −1 Y Y − ̂ X Y (Y Y − ˆ X Y ) /( n − k − 1)
Total n −1 Y Y − nY
2
The Determination Coefficient (R2): in general linear model which consider base indicator
in evaluation extent of significance of assumed relation between dependent variable and
explanatory variables where it is called multiple determination coefficient and denoted by (
R(2Y , X , X ,..., X ) ), where ( X 1 , X 2 ,..., X k ) indicate to ( k ) of explanatory variables.
1 2 k
SSR
R2 = SSR = SST ( R 2 ) , SSE = SST − SSR
SST
30
2
2.10 The Adjusted determination coefficient ( R )
• R Can be negative. .
2
Example -1- // Klein and Goldberger attempted to fit the following regression model to the
U.S. economy: Yi = 0 + 1 X i1 + 2 X i 2 + 3 X i 3 + ei
Where: Y = Consumption, X 1 = Wage income, X 2 = Nonwage, nonfarm income and X 3 = Farm
income, but obtained estimates of 2 and 3 as: 2 = 0.751 and 3 = 0.6251 using these
estimates, then reformulated their consumption function as follows:
Yi = 0 + 1 ( X i1 + 0.75 X i 2 + 0.625 X i 3 ) + ei = 0 + 1Z i + ei Where 𝑍𝑖 = 𝑋𝑖1 + 0.75𝑋𝑖2 + 0.625𝑋𝑖3
Find:
1. The values of the variable Z.
2. Fit the modified model to the data bellow in table, obtain estimates of 0 and 1 .
Sol // 1- Yi = 0 + 1Z i + ei
31
11.3 77.62 32.3 9.85 108 1220.4 127.69 11664
103.2 78.01 31.39 7.21 106.1 10949.52 10650.24 11257.21
108.9 83.57 35.61 7.39 114.9 12512.61 11859.21 13202.01
108.5 90.59 37.58 7.98 123.8 13432.3 11772.25 15326.44
111.4 95.47 35.17 7.42 126.5 14092.1 12409.96 16002.25
Yi = 0 + 1Z i + e , Y = Z + e , Yˆ = Z ˆ
y 1130 .7 n z 14 1304 .83
Z Y = = , Z Z = =
i
zi yi 109839 .77 z i z 2
i 1304 .83 129750 .57
adg( Z Z )
( Z Z ) −1 =
Z Z
14 1304.83
Z Z = = 1816507 .98 − 1702581 .3289 = 113926 .6511
1304.83 129750 .57
129750 .57 − 1304.83
adg( Z Z ) =
− 1304.83 14
129750 .57 − 1304 .83
adg ( Z Z ) − 1304 .83 14 = 1.1389 − 0.0115
( Z Z ) =
−1
= − 0.0115 0.0001
Z Z 113926 .6511
1.1389 − 0.0115 1130 .7 1287.7542 − 1263 .1574 24.5969
ˆ = ( Z Z ) −1 Z Y = = =
− 0.0115 0.0001 109839 .77 − 13.0031 + 10.9840 − 2.0191
Yˆi = ˆ0 + ˆ1Zi = 24.5969 − 2.0191Zi
ˆ2 = 0.75ˆ1 = 0.75 (−2.0191) = −1.5143 and ˆ3 = 0.625ˆ1 = 0.625 (−2.0191) = −1.2619
Yˆi = 24.5969 − 2.0191 X i1 − 1.5143 X i 2 − 1.2619 X i 3
29 0 0
X X = 0 50 10
0 10 80
1. Find the ANOVA Table through the information given above.
2. Find the adjusted coefficient of determination with explain the result.
SOL// 1-
(ANOVA Table)
S.O.V d.f SS MS F
Re g.( X 1 , X 2 ,.., X k ) k Y Y ( R 2 ) SSR / k MSR (R 2 ) / k
CalF = =
SSE /( n − k − 1) MSE (1 − R 2 ) / n − k − 1
Error(Re sidual) n − k −1 Y Y (1 − R 2 )
Total n −1 Y Y
32
(ANOVA Table)
S.O.V d.f SS MS F
Re g.( X 1 , X 2 ,.., X k ) MSR 4
2 8 4 CalF = = =2
MSE 2
Error(Re sidual)
26 52 2
Total 28 60
SSR 8
2- R 2 = = = 0.13333333
SST 60
2 (n − 1)(1 − R 2 ) (28)(0.86666667 )
R = 1− = 1− = 0.0666666
(n − k − 1) 26
2 2
R R 2 Thus when number of X variables increases R become less than R 2 .
R 2 will usually increase as more explanatory variables are added to the model, it is not
recall of reality of influence of explanatory variable on dependent variable, it is not good
way to compare models. Therefore, we use adjusted determination coefficient to remove the
bias between the variables.
Example -3- // from the following data by using matrices algebra method and Grammar
method: n = 20 , Yi = 60 , Yi 2 = 450 , X i = 245 , X i2 = 4460 , X iYi = 1156
The required //
1. Estimation coefficients vector for linear model by using Matrices Method and Grammar
method .
2. Find Var − Cov matrix for estimator parameters.
3. Test significance of parameters at = 5% with explains results when t(0.025 ,18 ) = 2.10 .
Sol// by matrix algebra:
1- Yi = 0 + 1 X i + e , Y = X + e , Yˆ = X ˆ
X Y =
y 60
=
n
, X X = x = 20
i 245
xi yi 1156 xi x 245
2
i 4460
adg( X X )
( X X ) −1 =
X X
20 245
X X = = (89200 − 60025) = 29175
245 4460
4460 − 245
adg( X X ) =
− 245 20
4460 − 245
− 0.0084
( X X ) −1 =
adg ( X X )
= 29175 29175 = 0.153
X X − 245 20 − 0.0084 0.00067
29175 29175
33
̂ = ( X X ) −1 X Y
0.153 − 0.0084 60 9.18 − 9.7104 − 0.5304
ˆ = ( X X ) −1 X Y = = =
− 0.0084 0.00067 1156 − 0.504 + 0.77452 0.27052
Yi = 0 + 1 X i + e
Yˆi = ˆ0 + ˆ1 X i = −0.5304 + 0.27052 X i
By Grammar method:
yi n x 0 60 20 245 0
= 1156 = 245 4460 *
i
* ,
x i y i x i x 1
2
i 1
n x = n x
N =
i
2
− ( xi ) 2
xi x 2 i
i
20 245
X X = = (89200 − 60025) = 29175
245 4460
20 245
N = = 29175
245 4460
yi x = y x
N0 = i 2
− ( xi xi yi )
xi yi x 2 i i
i
60 245
N0 = = (60)(4460) − (1156)(245) = 267600 − 283220 = −15620
1156 4460
n y = n x y
N1 = i
− ( xi y i )
xi x y i i
i i
20 60
N1 = = (20)(1156) − (245)(60) = 23120 − 14700 = 8420
245 1156
ˆo = 0 = i i 2 i 2 i i =
N y x2 − ( x x y ) − 15620
= −0.5354
N n xi − ( xi ) 29175
N1 n xi y i − ( xi y i ) 8420
ˆ1 = = = = 0.2886
N n x − ( xi )
2
i
2
29175
Yˆi = ˆ0 + ˆ1 X i = −0.5354 + 0.2886 X i
2- Var − Cov ( ˆ ) = 2 ( X X ) −1
Se2 = e2 =
e 2
i
=
ee
=
Y Y − ˆ X Y
=
n − k −1 n − k −1 n − k −1
Y i
2
= Y Y = 450
60
450 − (− 0.5304 0.27052 )
Y Y − ˆ X Y 1156 450 − 280.897 169.103
S e2 = e2 = = = = = 9.3946
20 − 1 − 1 20 − 2 18 18
34
0.153 − 0.0084 1.437 − 0.0789 Var( ˆ0 ) Cov( ˆ0 , ˆ1 )
Var − Cov( ˆ ) = S e2 ( X X ) −1 = 9.3946 = =
− 0.0084 0.00067 − 0.0789 0.0063 Cov( ˆ1 , ˆ0 ) Var( ˆ1 )
H 0 : 1 = 0
H1 : 1 0
ˆ1 − 1 ˆ1 − 1 0.27052 − 0 0.27052
t ( ˆ ) = = = = = 3.407
1
Var( ˆ1 ) S ( ˆ1 ) 0.0063 0.0794
0.05
(n − 2) = 20 − 2 = 18 d.f = = 0.025 and t(0.025 ,18 ) = 2.10
2 2
But Cal t ( ˆ ) Tab t we reject H 0 : 1 = 0 , where 1 0 this means that the explanatory
1
variable influences significantly on the dependent variable, or since the value of t calculated
lies outside the Region of acceptance then we accept the alternative hypothesis 𝐻1 .
Example H.W // two samples of 50 observations each produce following moment matrices
(in each case, X is a constant and one variable):
Sample 1 Sample 2
50 300 50 300
X X = X X =
300 2100 300 2100
300 300
X Y = X Y =
2000 2200
Y Y = 2100 Y Y = 2800
1. Compute the least squares regression coefficients and the residual variances (S e2 ) for
each data set. Compute the ( R 2 ) for each regression.
35
2. Compute the ANOVA table for the two regressions then explain and compare the two
results.
Example H.W// the following model was formulated to explain the annual sales of the
manufactures of household cleaning products as a function of a relative price index ( rpi )
and the advertising expenditures ( adv ): sales = 0 + 1rpi + 2 adv + ei
36