Docsity

The Simple Linear Regression Model - Lecture Notes | STAT 3610, Papers of Probability and Statistics

Toggle sidebar
bg1
181
181
The Simple Linear Regression Model (Reference: Chapter 12 of
Devore’s 7th Edition) Maghsoodloo
The objective of simple linear regression (SLR or SLREG) is to
determine if an output y is linearly related to an input x. The SLREG model
is given by yi = β0 + β1xi +∈i, where ∈i’s are assumed NID(0, 2
∈
σ
).
Regression Versus Correlation
Levels of x are fixed (x, y) is a bivariate random vector
As an example, the tensile strength (TS) of paper is thought to be
linearly related to the amount of hardwood concentration in the pulp. In a
pilot plant, 10 sample pairs (xi, yi), i = 1, 2, …, 10, were produced leading to
the following data:
xi : 10 15 15 20 20 20 25 25 28 30%
yi: 160 171 175 182 184 181 188 193 195 200 psi
where x = Hardwood Concentration, and y = Paper TS.
V(yi) = V(β0 + β1xi + ∈i) = 2
∈
σ
= σ2.
The objective is to estimate the unknown parameters β0 and β1 such that
the least squares function (LSF)
nn
22
01 i i 0 1i
i1 i1
L( , ) (y x )
==
ββ= ∈= −β−β
∑∑ (58)
is minimized wrt (with respect to) β0 and β1. For example, at (x1 = 10, y =
y1), the expression for the error before experimentation is given by ∈1 = y1 −
01
10β− β, while at (x2, y2), ∈2 = y2 − 01
15
β
−β, ..., and at (x10, y10) the
amount of error is given by ∈10 = y10 − 01
30
β
−β. However, after data has
been gathered, as shown above, the LSF in Eq. (58) reduces to:
01
L( , )ββ= (160 −01
10β− β )2 + (171 − 01
15
β
−β)2 + ... +(200 −01
30β− β)2.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download The Simple Linear Regression Model - Lecture Notes | STAT 3610 and more Papers Probability and Statistics in PDF only on Docsity!

The Simple Linear Regression Model (Reference: Chapter 12 of

Devore’s 7 th^ Edition) Maghsoodloo

The objective of simple linear regression (SLR or SLREG) is to determine if an output y is linearly related to an input x. The SLREG model

is given by yi = β 0 + β 1 xi +∈i, where ∈i’s are assumed NID(0, σ ∈^2 ).

Regression Versus Correlation Levels of x are fixed (x, y) is a bivariate random vector As an example, the tensile strength (TS) of paper is thought to be linearly related to the amount of hardwood concentration in the pulp. In a pilot plant, 10 sample pairs (xi , yi ), i = 1, 2, …, 10, were produced leading to the following data: xi : 10 15 15 20 20 20 25 25 28 30% yi : 160 171 175 182 184 181 188 193 195 200 psi where x = Hardwood Concentration, and y = Paper TS.

V(yi ) = V(β 0 + β 1 xi + ∈i ) = σ ∈^2 = σ^2.

The objective is to estimate the unknown parameters β 0 and β 1 such that the least squares function (LSF) n 2 n 2 L( β 0 (^) , β (^) 1 ) = (^) ∑ i = 1 ∈ i (^) = (^) ∑ i = 1 (y (^) i − β 0 (^) − β 1 x )i (58)

is minimized wrt (with respect to) β 0 and β 1. For example, at (x 1 = 10, y = y 1 ), the expression for the error before experimentation is given by ∈ 1 = y 1 −

β 0 − 10 β 1 , while at (x 2 , y 2 ), ∈ 2 = y 2 − β 0 − 15 β 1 , ..., and at (x 10 , y 10 ) the

amount of error is given by ∈ 10 = y 10 − β 0 − 30 β 1. However, after data has

been gathered, as shown above, the LSF in Eq. (58) reduces to:

L( β 0 , β 1 ) = (160 − β 0 − 10 β 1 ) 2 + (171 − β 0 − 15 β 1 ) 2 + ... +(200 − β 0 − 30 β 1 ) 2.

In order to minimize the LSF in Eq. (58) wrt β 0 and β 1 , we partially differentiate and require that its partial derivatives to equal zero in order to obtain the optimum point.

∂ L / ∂β 0 = 2(160 − β 0 − 10 β 1 )(−1) + 2(171 − β 0 − 15 β 1 )(−1) + ... +

2(200 − β 0 − 30 β 1 )(−1) ⎯ set to ⎯⎯→ = 0

∂ L / ∂β 1 = 2(160 − β 0 − 10 β 1 )(−10) + 2(171 − β 0 − 15 β 1 )(−15) +... +2(200 −

⎯ set to ⎯⎯→ = 0

The above 2 equations simplify to

(160 − β ˆ^ 0 − 10 β ˆ 1 ) +(171 − β ˆ^0 − 15 β ˆ 1 )+... +(200 − β ˆ^0 − 30 β ˆ 1 ) = 0, and

(160 − β ˆ^ 0 − 10 β ˆ 1 )(10) +(171 − β ˆ^0 − 15 β ˆ 1 )(15) +... + (200 − β ˆ^ 0 − 30 β ˆ 1 )(30) = 0.

After some algebra, these last two equations reduce to

∑

n i 1 i

y − n β ˆ (^) 0 − β ˆ 1

10 i i 1

x

=

∑ = 0

n i ∑ = 1^ x yi^ i −^ β ˆ^0

10 i ∑ = 1^ xi −^ β ˆ^1

(^10 ) i ∑ = 1^ xi = 0. The above heterogeneous system of 2 equations with 2 unknowns when written as

n β ˆ 0 + β ˆ 1

10 i ∑ = 1^ xi =

n i i 1

y

=

∑ →^10 β ˆ^ 0 +^ β ˆ 1^ (208) =1829, and

10 i ∑ = 1^ xi +^ β ˆ^1

(^10 ) i ∑ = 1^ xi =

n i ∑ = 1^ x yi^ i →^ β ˆ^^0 (208) +^ β ˆ^1^ (4684) = 38715, is called the LS (least squares) normal equations. The 1st^ equation gives

rise to β ˆ 0 + β ˆ 1 x = y → β ˆ 0 = y − β ˆ 1 x →

yˆ i = β ˆ 0 + β ˆ 1 xi = y − β ˆ 1 x + β ˆ 1 xi → yˆ i = y + β ˆ 1 (xi − x ).

Note that yˆi is called the fitted value of the LS model, and if the slope β ˆ 1 is

zero, then the best fit for each yi is (^) y.

0 for all statistical models. For example, in the case of SLREG

n i ∑ = 1^ ei = The

sum of all n residuals =

n i i i 1

(y y )ˆ

=

∑ −^ =

n i 1 i i 1

[(y y ) ˆ (x x)]

=

∑ −^ − β^ −^ ≡0 because^ yˆi

= y + β ˆ 1 (xi − x ),

n i i 1

(y y ) 0

=

∑ −^ ≡ and

n i i 1

(x x)

=

∑ −^ ≡0.

A test of Significance in Regression is 1st^ conducted thru an ANOVA Table. To this end, we compute the SS’s for the ANOVA.

USS =

n (^2) i i 1

y

=

∑ = 335825 (with n = 10 df), CF = (

n i i 1

y

=

∑ )^2 /n =

= 1829^2 /10 = 334524.10 (with 1 df) → SST = USS − CF

SS(Total) =

n (^2) i i 1

(y y )

=

∑ − = USS^ −^ CF = 1300.90 (with n^ −1 = 9 df).

SS(Residuals) =

n (^2) i i 1

e

=

∑ = 38.83277405 (with n^ −2 = 8 df because there are 2

constraints; try to determine what they are for bonus points).

Now, SS(Residuals) =

n (^2) i i 1

e

=

∑ =

n (^2) i i i 1

(y y )ˆ

=

∑ − =

n (^2) i 1 i i 1

[(y y ) ˆ (x x)]

=

∑ −^ − β^ − =

n (^2) i i 1

(y y )

=

∑ − −^2 β ˆ 1

n i i i 1

[(y y ) (x x)]

=

∑ −^ − +^ β ˆ 12

n (^2) i i 1

(x x)

=

∑ − =

S yy − 2 β ˆ 1 Sxy + β ˆ 1^2 Sxx = S yy − 2 β ˆ 1 Sxy + β ˆ 1 (Sxy /Sxx )Sxx →

SSRES = SS(Total) − β ˆ 1 Sxy = SST − SSModel.

Exercise 108. Show that

SST =

n (^2) i i 1

(y y )

=

∑ − =

n (^2) i i i i 1

[(y y )ˆ (yˆ y )]

=

∑ −^ +^ − =

n (^2) i i i 1

(y y )ˆ

=

∑ − +

n (^2) i i 1

(yˆ y )

=

∑ − = SSRES^ + SSREG,

and as a result SSREG = SS(Model) =

n (^2) i ∑ = 1^ (yˆi^ − y ) =^ β ˆ^1^ Sxy^.

For our example, SSREG = β ˆ 1 Sxy = 1.87864×671.8 = 1262.0672. Note

that SSREG + SSRES = 1262.0672 + 38.8328 = 1300.90 = SSTotal = SST. The ANOVA Table is given below.

Source df SS MS F 0 Total 9 1300. Model or Regression 1 1262.06723 1262.06723 260. Residuals 8 38.83277 4.8541 F0.01,1,8 = 11.

Since the P-value of the F-test is almost zero, then strongly reject H 0 : β 1 = 0. The regressor variable x accounts for 97.015% of variability in the response y.

To determine how well the model yˆ = 143.8244 + 1.87864x fits the 10

ordered pairs (xi , yi ), we proceed as follows: SS(Pure Error) = (171^2 + 175^2 − 3462 /2) + (182^2 + 184^2 +181^2 − 5472 /3) + (188^2

  • 193^2 − 3812 /2) = 25.16667 (with 1 + 2 + 1 = 4 df). → SS(LOF = Lack of Fit) = SSRES −SS(PE = Pure Error) = 38.832774 − 25.16667 = 13.66611. The augmented ANOVA Table is given below.

Source df SS MS F 0 Total 9 1300. Model 1 1262.06723 1262.06723 260. Residuals 8 38.83277 4.8541 F (^) 0.01,1,8 = 11. Pure Error (PE) 4 25.16667 6. Lack of Fit (LOF) 4 13.66611 3.41653 0.

Since the P-value for LOF is α ˆ = P(F4,4 ≥ 0.54302) = 0.715623, the

studying the remaining of these notes, obtain the 95% CIs for β 0 , β 1 and E(Y⏐x = 2.5). xi 1.0 1.5 1.5 1.5 2.0 2.0 2. yi 101.4 117.4 117.1 106.2 131.9 146.9 146. xi 2.4 2.8 2.8 3.0 3.0 3.2 3. yi 133.9 135.1 145.2 134.3 144.5 143.7 146.

Exercise 112. Show that in SLR with ni observations at m distinct levels

SSRES =

m n i 2 i ∑ ∑ = 1 j 1 =^ (y^ ij^ − y )ˆi =

m n i 2 i ∑ ∑ = 1 j 1 =^ [(y^ ij^ −^ y^ i.^ )^ +^ (yi.^ − y )]ˆi =

=

m n i 2 i ∑ ∑ = 1 j 1 =^ (y^ ij^ − y^ i.) +

m (^2) i ∑ = 1^ n (yi^ i^ − y )ˆi = SS(PE) + SS(LOF).

Note that the terminology regression is due to Francis Galton who first observed (in the late 19 th^ century) that the height of sons tended to be closer to the mean height of species than their fathers, i.e., the height of off-springs tended to regress back toward the mean height of the entire species, no matter what the height of fathers were.

Statistical Inference in SLREG

Recall that if a rv is N(μ, unknown σ^2 ), then the statistic [rv − E(rv) ]/ se (rv) ~ Tν, where ν is the df of the se (rv).

Therefore, to test H 0 : β 1 = 0 VS H 1 : β 1 ≠ 0, we may use the fact that

1 1 1

ˆ E( ˆ )

se β

=^1

1

se β

=^1

RES xx

MS / S

has a Student’s t-distribution with ν = n −2 df. We now apply this t-test to the regression model of the Example on page 181.

We 1st^ compute the se ( β ˆ 1 ) = MSRES / Sxx (see Exercise 110) =

4.8541/ 357.6 = 0.11651. Since under H 0 the value of β 1 is hypothesized to

be zero, then our null test statistic becomes

t 0 =^1 RES xx

MS / S

which far exceeds t0.025,8 = 2.3060, and hence the null hypothesis of zero slope must be strongly rejected. Note that (t 0 ) 2 = F 0 = 260.0004 of the ANOVA Table on page 185 of these notes. The discrepancy in the 4th decimal is strictly due to rounding. The next SI (statistical inference) is to obtain either a 95% or 99% CI

for β 1. Figure 27 shows the sampling distribution (SMD) of^1 RES xx

MS /S

for confidence level of 1 − α = 0.95. Figure 1 clearly shows that the Pr( −2.3060 ≤ T 8 ≤ 2.3060)

= Pr( −2.3060 ≤ ( β − β ˆ 1 1 )/ se ( β ˆ 1 ) ≤ 2.3060) = 0.95, or

Pr[ −2.3060 se ( β ˆ 1 ) − β ˆ 1 ≤ − β 1 ≤ − β ˆ 1 + 2.3060 se ( β ˆ 1 ) ] = 0.95.

T 8

In order to solve for β 1 , we need to multiply the above 2 inequalities by −1,

−2.3060 0 2.

0.025 0.

Figure 27. The SMD of ( β ˆ 1 (^) − β 1 ) / se ( β ˆ 1 )

Example on page 181 of these notes. Suppose we are to make N (the most common value of N is one observation in the future) observations at x 0 =

22% hardwood concentration in the future. Let y 0 be the actual future

observation (not yet obtained). Clearly, the best single point forecast from

our model is yˆ 0 = 143.8244 + 1.87864×22 = 185.1545. How do we use our

rvs y 0 and yˆ 0 to obtain a prediction interval for y 0?

To accomplish this task, we must 1st^ define the forecast error rv as ψ

= y 0 − yˆ 0. Because E( ψ ) = E( β 0 + β 1 x 0 + ε 0 − β ˆ^0 − β ˆ 1 x 0 ) = 0, and the

variance of forecast error at N = 1 is given by

V( ψ ) = V[ y 0 − y − β ˆ 1 (x 0 − x )] = V( y 0 ) + V( y ) +(x 0 − x ) 2 V( β ˆ 1 )

V( ψ ) = [

0 2 xx

1 1 (x^ x)

n S

+ + − ]^2

σ ∈. Since ψ is a LC (linear combination) of NID

rvs, then the forecast error ψ is also N(0, V( ψ )), and as a result the rv

E( )

se Ψ

=^0

(^0) RES xx

y yˆ

1 (x x) MS

[1 (^) n S ]

    • − ×

has a student’s t-distribution with (n − 2) df. Therefore, with N = 1 future observation at x 0 = 22 we obtain the following 95% prediction Pr statement:

Pr[ −2.3060 ≤^0 (^0) RES xx

y yˆ

1 1 (x^ x) MS

[ n S ]

+ +^ −

≤ 2.3060 ] = 0.

Rearranging the inequality inside the brackets yields the 95% PI (prediction interval) for y 0.

Pr[ β ˆ 0 + β ˆ 1 x 0 − 2.3060 se ( ψ ) ≤ y 0 ≤ β ˆ 0 + β ˆ 1 x 0 + 2.3060 se ( ψ )] = 0.95.

To obtain the actual 95% PI, we 1st^ compute the se ( ψ ).

se ( ψ ) = se ( y 0 − yˆ 0 ) =

1 (22 20.8)^2

[1 + 10 + 357.6^ − ]4.8541 = 2.

Next, we insert yˆ 0 = β ˆ 0 + β ˆ 1 x 0 = 185.1545 and the se ( ψ ) into the above Pr

statement.

Pr[ −2.3060 ≤ y^0^ − 2.3150^ 185.1545 ≤ 2.3060 ] = 0.

Finally, rearranging the inequality inside the above brackets results in

Pr[185.1545 −2.3060×2.3150 ≤ y 0 ≤185.1545 + 5.3383] = 0.

→ Pr(179.8162 ≤ y 0 ≤ 190.4928] = 0.95.

The length of the above prediction band is 10.6766. Note that, unlike a CI, the above PI actually has a Pr of 0.95 to contain a future observation because y 0 is still a random variable, as it has not yet been observed. Further, the length of the 95% PI is always larger than the corresponding 95% CI.

CORRELATION

Regression is generally applicable if the regressor (or independent) variable can be controlled by the experimenter so that V(X) = 0. In studies where both variables x and y have to be measured from the same sampling unit, i.e., the (x, y) pair form a bivariate random vector, then it is best to conduct a correlation analysis than regressing y on x. To this end, let [x

y] T^ = [ x y ]′^ be a 2×1 bivariate vector; then the population correlation

coefficient between x and y is defined as

ρxy = X Y

COV(X, Y)

σ × σ =^

xy X Y

σ σ =^ ρ,

where σxy = E[(X − μx )×(Y − μy)] = E(XY) − E(X)×E(Y) is the covariance between the random variables X and Y. It can be proven that − 1 ≤ ρ ≤ 1, or | ρ | ≤ 1, which you will be asked to do in the following Bonus Exercise.

S yy = 1530, Sxy = 1088, Sx = 10.9427, Sy = 10.4540, σ ˆ xy = 77.7143, r =

σ ˆ xy /(Sx S y) = 0.67935. Note that if y is regressed on x and the resulting

model R^2 is computed, then r = R 2 Model.

TEST OF HYPOTHESIS ABOUT ρ

There are two different tests that can be conducted on the parameter ρ: (1) H 0 : ρ = 0, (2) H 0 : ρ = ρ 0 , where ρ 0 ≠ 0.

(1) Testing H 0 : ρ = 0 versus one of the 3 alternatives H 1 : ρ ≠ 0, or

H 1 : ρ < 0, or H 1 : ρ > 0. Recall that statistical inference on a parameter is conducted using the sampling distribution of the point estimator. The point estimator of ρ is the sample correlation coefficient r. It can be shown that the sampling distribution (SMD) of the statistic

t 0 = r^ n^22

1 r

follows a Student’s t-distribution with (n − 2) df. For the example 45 above, the most appropriate alternative is H 1 : ρ > 0. Therefore, the critical region for testing H 0 : ρ = 0 at the LOS α = 0.05 is (1.771, ∞). The value of our test

statistic is t 0 = (0.67935 13 )/ 1 − 0.46152 = 3.3379, which easily exceeds

t (^) 0.05,13 = 1.771, leading to the rejection of zero correlation between X and Y.

The P-value (or the Pr level) of the test is α ˆ^ = P(T 13 ≥ 3.33794) = 0.002672,

which is less than 0.05 as expected because H 0 was rejected at the 5% level of significance. If the assumption of joint bivariate normal density for the 2 ×1 vector [X Y]T^ is indeed tenable, then the rejection of H 0 : ρ = 0 implies that X and Y are not independent; otherwise, the rejection of H 0 implies that X and Y are linearly related.

Exercise 114. Use results from regression to show that the statistic

2

r n 2

1 r

has a Student’s t sampling distribution. Hint: First refer to an

ANOVA table for the regression of Y on a single regressor X and then use

the fact that F1, ν 2 = t^2 ν 2.

(2) Testing H 0 : ρ = 0.50 versus the alternative H 1 : ρ ≠ 0.50 at the

LOS α = 0.05. The t 0 given in equation (60) cannot be used to test H 0 : ρ = 0.50 because the expression for t 0 is free of ρ. It has been shown, however, in statistical literature that the sampling distribution (SMD) of the statistic

Z =^12 ln( 11^ + − rr) = arctanh(r) = tanh −^1 (r)

is approximately normal with E(Z) =^12 ln ( 11^ +− ρ^ ρ ) = tanh −^1 (ρ) and V(Z) =

1/(n −3). For the Example 45 above, the SMD of Z is depicted in Figure 28,

0.54931 Z

SE (Z) = 1/ n − 3 =

0.

0.

AL Au

Figure 28. The SMD of Z under H 0

Figure 29 clearly shows that the

Pr[ μZ − 1.96× SE (Z) ≤^12 ln( 11^ + − rr) ≤ μZ + 1.96× SE (Z) ] = 0.

Pr[−^12 ln(^1 1^ +− rr) −1.96× SE (Z) ≤ −μZ ≤ −^12 ln( 11^ + − rr) +1.96× SE (Z)] = 0.

Pr[− 0.82791 − 1.96× SE (Z) ≤ −μZ ≤ − 0.82791 + 1.96× SE (Z)] = 0 or 1. Pr[− 0.82791 − 0.56580 ≤ −μZ ≤ − 0.82791 + 0.56580 ] = 0 or 1. Pr[0.82791 − 0.56580 ≤ μZ ≤ 0.82791 + 0.56580 ] = 0 or 1.

0.26210 ≤^12 ln ( 11^ +− ρ^ ρ ) ≤ 1.39371 → (61)

0.52420 ≤ ln (^1 1^ + ρ− ρ ) ≤ 2.78742 → 1.68912 ≤^11^ +− ρ^ ρ ≤ 16.

1.68912(1−ρ) ≤ 1 + ρ ≤ 16.23904(1−ρ). These last two inequalities when solved separately from the left yield ρL = 0.25626 and from the right yield ρu= 0.88398, and hence the 95% CI for population correlation coefficient is given by 0.256263 ≤ ρ ≤ 0.883985. The above CI interval could also have been obtained by recognizing

that the inverse function of^12 ln ( 11^ +− ρ^ ρ ) is tanh(ρ) and taking the tanh of

inequality (61), i.e., tanh(0.26210) ≤ ρ ≤ tanh(1.39371) → 0.25626 ≤ ρ ≤ 0.88398, which agrees with the above CI for ρ. As expected, the above CI does include the value of ρ = 0.50 because the null hypothesis H 0 : ρ = 0.50 could not be rejected at the 5% level.

Exercise 115. Repeat the above correlation analysis for the data of Exercise 62 on page 493 of Devore. Check your answer for the 95% CI on ρ by using the formulas

ρL = tanh[arctanh(r) − Z α / 2 / n − 3 ] = tanh[^12 ln^11^ + − rr − Z α / 2 / n − 3 ]

and ρu = tanh[arctanh(r) + Z α / 2 / n − 3 ], where tanh(x) =

x x x x

e e

e e

− −

and

tanh−^1 (x) = arctanh(x) =^12 ln^11^ + − xx.

(b) For the data of Exercise 62 p. 493 of Devore, obtain the 95% lower one- sided CI for ρ. The Microsoft Excel functions for arctanh = tanh-1^ and hyperbolic tangent are ATANH and TANH, respectively.

Exercise 116 (10 Bonus Points). (a) Show that the inverse function

of f(x) =^12 ln ( 11^ +− xx) , x < 1, is f−^1 (x) = tanh(x) =

x x x x

e e

e e

− −

, where − 1 ≤

tanh(x) ≤ 1. (b) Use your results in part (a) to derive the following 95% CI for ρ:

tanh[^12 ln( 11^ +− rr) − 1.

n − 3

] ≤ ρ ≤ tanh[^12 ln( 11^ + − rr) + 1.

n − 3

], where

the Excel function is ATANH(r) =^12 ln( 11^ + − rr).