You are on page 1of 2

STATA 273 CHAPTER 11

EXERCISE The following table shows the prices (in cents) of a certain product with the corresponding demands.

Price 𝒙 19 23 21 15 16 18
Demand 𝒚 55 7 20 123 88 76

Use the following values Intercept

Slope
∑ 𝒙𝒚 = 𝟔𝟐𝟒𝟕 ∑ 𝒙𝟐 = 𝟐𝟏𝟑𝟔 ∑ 𝒚𝟐 = 𝟑𝟐𝟏𝟐𝟑
Dependent Variable
(a) Fit a least-squares line. Independent Variable
(b) Estimate the demand for the product when it is priced at 20 cents.
(c) Calculate the coefficient of correlation 𝑟. What type of linear relationship we have between 𝑥 and 𝑦?

SOLUTION

Price 𝒙 Demand 𝒚 𝒙𝟐 𝒚𝟐 𝒙. 𝒚
19 55 361 3025 1045
23 7 529 49 161
21 20 441 400 420
15 123 225 15129 1845
16 88 256 7744 1408
18 76 324 5776 1368
112 369 2136 32123 6247

(a) Fit a least-squares line.

∑𝒙 𝟏𝟏𝟐
̅=
𝒙 = ≈ 𝟏𝟖. 𝟕
𝒏 𝟔

∑𝒚 𝟑𝟔𝟗
̅=
𝒚 = = 𝟔𝟏. 𝟓
𝒏 𝟔

∑𝒙 . ∑𝒚 (𝟏𝟏𝟐)(𝟑𝟔𝟗)
𝑺𝒙𝒚 = ∑ 𝒙𝒚 − = 𝟔𝟐𝟒𝟕 − = −𝟔𝟒𝟏
𝒏 𝟔

∑𝒙 . ∑𝒙 (𝟏𝟏𝟐)(𝟏𝟏𝟐)
𝑺𝒙𝒙 = ∑ 𝒙𝟐 − = 𝟐𝟏𝟑𝟔 − ≈ 𝟒𝟓. 𝟑
𝒏 𝟔

∑𝒚 . ∑𝒚 (𝟑𝟔𝟗)(𝟑𝟔𝟗)
𝑺𝒚𝒚 = ∑ 𝒚𝟐 − = 𝟑𝟐𝟏𝟐𝟑 −
𝒏 𝟔

= 𝟗𝟒𝟐𝟗. 𝟓

𝑺𝒙𝒚 −𝟔𝟒𝟏
𝒃= = ≈ −𝟏𝟒. 𝟐
𝑺𝒙𝒙 𝟒𝟓. 𝟑

̅ = 𝟔𝟏. 𝟓 + (𝟏𝟒. 𝟐)( 𝟏𝟖. 𝟕 ) = 𝟑𝟐𝟕. 𝟎𝟒


̅ − 𝒃𝒙
𝒂= 𝒚

1|P a g e
STATA 273 CHAPTER 11

̂ = 𝒂 + 𝒃𝒙 = 𝟑𝟐𝟕. 𝟎𝟒 − 𝟏𝟒. 𝟐 𝒙
The least-squares line is 𝒚

(b) Estimate the demand for the product when it is priced at 20 cents.

̂ = 𝟑𝟐𝟕. 𝟎𝟒 − 𝟏𝟒. 𝟐 (𝟐𝟎) = 𝟒𝟑. 𝟎𝟒 ≈ 𝟒𝟑


when 𝒙 = 𝟐𝟎 then 𝒚

(c) Calculate the coefficient of correlation 𝑟. What type of linear relationship we have between 𝑥 and 𝑦?

Sign  type of linear relationship

Linear Correlation Coefficient 𝒓

Magnitude  strength of linear relationship

very weak weak moderate strong

0 0.25 0.5 0.75 1

𝑺𝒙𝒚 −𝟔𝟒𝟏
𝒓= = ≈ −𝟎. 𝟗𝟖
√𝑺𝒙𝒙 . 𝑺𝒚𝒚 √(𝟒𝟓. 𝟑)(𝟗𝟒𝟐𝟗. 𝟓)

 𝑥 and 𝑦 are negatively strongly linearly related.

2|P a g e

You might also like