Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 13

LAB#12

Q) 11.09
| x y|

1. | 40 385 |

2. | 20 400 |

3. | 25 395 |

4. | 20 365 |

5. | 30 475 |

6. | 50 440 |

7. | 40 490 |

8. | 20 420 |

9. | 50 560 |

10. | 40 525 |

11. | 25 480 |

12. | 50 510 |

+----------+

. rename var1 x

. rename var2 y

. regress y x

Source | SS df MS Number of obs = 12

-------------+---------------------------------- F(1, 10) = 6.75

Model | 17030.0444 1 17030.0444 Prob > F = 0.0266

Residual | 25226.2056 10 2522.62056 R-squared = 0.4030

-------------+---------------------------------- Adj R-squared = 0.3433

Total | 42256.25 11 3841.47727 Root MSE = 50.22

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

x | 3.220812 1.239605 2.60 0.027 .4587991 5.982825

_cons | 343.7056 44.76618 7.68 0.000 243.9603 443.4508


------------------------------------------------------------------------------

. plot(y x)

560 +

| *

| *

| *

| *

| *

y | *

| *

|*

|*

| *

| *

365 + *

+----------------------------------------------------------------+

20 x 50

The linear eq can be as x=35

=343.706+3.22(35)

=346.4
. correlate x y

(obs=12)

| x y

-------------+------------------

x | 1.0000

y | 0.6348 1.0000

The relationship between x and y is positively strong.

Q) 11.13

list

| x y|

1. | 4.3 126 |

2. | 4.5 121 |

3. | 5.9 116 |

4. | 5.6 118 |

5. | 6.1 114 |

6. | 5.2 118 |

7. | 3.8 132 |

8. | 2.1 141 |

9. | 7.5 108 |

regress y x

Source | SS df MS Number of obs = 9

-------------+---------------------------------- F(1, 7) = 158.77

Model | 770.261679 1 770.261679 Prob > F = 0.0000

Residual | 33.9605431 7 4.85150616 R-squared = 0.9578

-------------+---------------------------------- Adj R-squared = 0.9517

Total | 804.222222 8 100.527778 Root MSE = 2.2026

------------------------------------------------------------------------------

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]


-------------+----------------------------------------------------------------

x | -6.323987 .5018919 -12.60 0.000 -7.510773 -5.137202

_cons | 153.1755 2.614659 58.58 0.000 146.9928 159.3582

Regression line can be given as x=4.8

=153.75-6.324(4.8)

=122.8198

. correlate x y

(obs=9)

| x y

-------------+------------------

x | 1.0000

y | -0.9787 1.0000

The relationship between x and y is negatively strong.

Q) 11.11

| x y|

1. | 1760 4300 |

2. | 1652 4650 |

3. | 1485 3200 |

4. | 1390 3150 |

5. | 1820 4950 |

6. | 1665 4010 |

7. | 1550 3810 |

8. | 1700 4500 |

9. | 1270 3008 |

regress y x

Source | SS df MS Number of obs = 9

-------------+---------------------------------- F(1, 7) = 41.56

Model | 3447373.46 1 3447373.46 Prob > F = 0.0004

Residual | 580603.428 7 82943.3469 R-squared = 0.8559


-------------+---------------------------------- Adj R-squared = 0.8353

Total | 4027976.89 8 503497.111 Root MSE = 288

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

x | 3.652862 .5666042 6.45 0.000 2.313055 4.992668

_cons | -1847.633 904.8743 -2.04 0.080 -3987.321 292.0548

=-1847.633+3.35(X)

correlate x y

(obs=9)

| x y

-------------+------------------

x | 1.0000

y | 0.9251 1.0000

The relationship between x and y is positively strong.

plot y x
4950 +

| *

| *

| *

| *

y |

| *

| *
|

| * *

3008 + *

+----------------------------------------------------------------+

1270 x 1820

Q) 11.12
| x y|

1. | 27 250 |

2. | 45 285 |

3. | 72 320 |

4. | 58 295 |

5. | 31 265 |

6. | 60 298 |

7. | 34 267 |

8. | 74 321|

plot y x
321 +

| *

| *

| **

y |

| *

|
|

| * *

250 + *

+----------------------------------------------------------------+

27 x 74

. regress y x

Source | SS df MS Number of obs = 8

-------------+---------------------------------- F(1, 6) = 283.84

Model | 4586.91232 1 4586.91232 Prob > F = 0.0000

Residual | 96.9626807 6 16.1604468 R-squared = 0.9793

-------------+---------------------------------- Adj R-squared = 0.9758

Total | 4683.875 7 669.125 Root MSE = 4.02

------------------------------------------------------------------------------

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

x | 1.383945 .0821458 16.85 0.000 1.182941 1.584948

_cons | 218.2548 4.355954 50.10 0.000 207.5961 228.9134

The regression line can be given as x=65

=218.225+1.384(65)

=308.215

. correlate x y

(obs=8)

| x y

-------------+------------------
x | 1.0000

y | 0.9896 1.0

Q) 11.6
| x y|

1. | 26.8 26.5 |

2. | 25.4 27.3 |

3. | 28.9 24.2 |

4. | 23.6 27.1 |

5. | 27.7 23.6 |

6. | 23.9 25.9 |

7. | 24.7 26.3 |

8. | 28.1 22.5 |

9. | 26.9 21.7 |

10. | 27.4 21.4 |

11. | 22.6 25.8 |

12. | 25.6 24.9|

. regress y x

Source | SS df MS Number of obs = 12

-------------+---------------------------------- F(1, 10) = 7.54

Model | 20.2621364 1 20.2621364 Prob > F = 0.0206

Residual | 26.8845194 10 2.68845194 R-squared = 0.4298

-------------+---------------------------------- Adj R-squared = 0.3727

Total | 47.1466558 11 4.28605962 Root MSE = 1.6396

------------------------------------------------------------------------------

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

x | -.686077 .2499087 -2.75 0.021 -1.242908 -.1292457

_cons | 42.5818 6.506536 6.54 0.000 28.08434 57.07926


. correlate x y

(obs=12)

| x y

-------------+------------------

x | 1.0000

y | -0.6556 1.0000

REGRESSION LINE :

Y= a + bx

Y=42.5818 + (- 0.686077)X

PART B

X=24.5

Y= 42.5818 - 0.686077*24.5

Y= 25.77 ANS

Q) 11.7
. list

| x y |

1. | 123 76

2. | 55 62

3. | 100 66 |

4. | 75 58 |

5. | 159 88 |

6. | 109 70 |

7. | 48 37 |

8. | 138 82 |

9. | 164 88 |

10. | 28 43 |

regress y x
Source | SS df MS Number of obs = 10

-------------+---------------------------------- F(1, 8) = 76.57

Model | 2517.02497 1 2517.02497 Prob > F = 0.0000

Residual | 262.975026 8 32.8718782 R-squared = 0.9054

-------------+---------------------------------- Adj R-squared = 0.8936

Total | 2780 9 308.888889 Root MSE = 5.7334

------------------------------------------------------------------------------

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

x | .3532667 .0403712 8.75 0.000 .2601706 .4463627

_cons | 31.70866 4.421867 7.17 0.000 21.51182 41.9055

-----------------------------------------------------------------------------

Simple linear regression

Y= a + bx

Y= 31.70866 + 0.3532667X

correlate x y

(obs=10)

| x y

-------------+------------------

x | 1.0000

y | 0.9515 1.0000

. plot(y x)

88 +

| * *

|
| *

| *

| *

y | *

| *

| *

|*

37 + *

+----------------------------------------------------------------+

28 x 164

Q) 11.8
. regress y x

Source | SS df MS Number of obs = 20

-------------+---------------------------------- F(1, 18) = 4.11

Model | 999.452639 1 999.452639 Prob > F = 0.0577

Residual | 4377.09736 18 243.172076 R-squared = 0.1859

-------------+---------------------------------- Adj R-squared = 0.1407


Total | 5376.55 19 282.976316 Root MSE = 15.594

------------------------------------------------------------------------------

y| Coef. Std. Err. t P>|t| [95% Conf. Interval]

-------------+----------------------------------------------------------------

x | .4264786 .2103648 2.03 0.058 -.0154814 .8684386


_cons | 34.48044 12.18482 2.83 0.011 8.881071 60.0798

Regression equation

Y=a +bx

Y= 34.48044+0.4264786

. correlate x y

(obs=20)

| x y

-------------+------------------

x | 1.0000

y | 0.4312 1.000

. plot(y x)

81 +

| *

| * *

| *

| * *

|*

| * *

| * * *

y | *

| *

|*

| *

11 + *

+----------------------------------------------------------------+

35 x 90
.

You might also like