# Team Hotelling: Assignment 1

## Question 1

### 1.Female=0,Male=1

• Without iteraction terms
X matrix is
Sex Educ
1  1   1    5
2  1   1    9
3  1   1   10
4  1   1   12
5  1   1   14
6  1   1   16
7  1   0    8
8  1   0   11
9  1   0   11
10 1   0   14
11 1   0   14
12 1   0   15

Y matrix is
Sal
1  17.2
2  28.9
3  42.5
4  56.1
5  56.6
6  70.5
7  21.6
8  18.5
9  17.9
10 31.8
11 35.2
12 39.5

X'X is
Sex Educ
12   6  139
Sex    6   6   66
Educ 139  66 1725

X'Y is
Sal
436.3
Sex   271.8
Educ 5468.4


Beta matrix is
Sal
-24.965865
Sex   22.906316
Educ   4.305414


Yhat Matrix is
Sal
1  19.467519
2  36.689173
3  40.994586
4  49.605414
5  58.216241
6  66.827068
7   9.477444
8  22.393684
9  22.393684
10 35.309925
11 35.309925
12 39.615338


Error Matrix:
Sal
1  -2.2675188
2  -7.7891729
3   1.5054135
4   6.4945865
5  -1.6162406
6   3.6729323
7  12.1225564
8  -3.8936842
9  -4.4936842
10 -3.5099248
11 -0.1099248
12 -0.1153383


Test each β for H0: βi = 0
sse=321.0168
sse/(n-p)=5.972313

The variance-Covariance Matrix
Sex          Educ
1.5022556 -0.29473684 -0.109774436
Sex  -0.2947368  0.34561404  0.010526316
Educ -0.1097744  0.01052632  0.009022556

The t-stat is
Sal
-3.410610
Sex   6.524045
Educ  7.589401

The p_value is
Sal
7.742132e-03
Sex  1.083812e-04
Educ 3.363518e-05
Since P-value's are all less than α = 5%, so reject H0: βi = 0 i=0,1,2

The 95% CI is
Sal        Sal
-38.384357 -11.547372
Sex   16.470146  29.342486
Educ   3.265501   5.345326


H Matrix:
1           2           3           4            5           6
1   0.491478697  0.27493734  0.22080201  0.11253133  0.004260652 -0.10401003
2   0.274937343  0.20275689  0.18471178  0.14862155  0.112531328  0.07644110
3   0.220802005  0.18471178  0.17568922  0.15764411  0.139598997  0.12155388
4   0.112531328  0.14862155  0.15764411  0.17568922  0.193734336  0.21177945
5   0.004260652  0.11253133  0.13959900  0.19373434  0.247869674  0.30200501
6  -0.104010025  0.07644110  0.12155388  0.21177945  0.302005013  0.39223058
7   0.225563910  0.07518797  0.03759398 -0.03759398 -0.112781955 -0.18796992
8   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
9   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
10 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
11 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
12 -0.153383459 -0.05112782 -0.02556391  0.02556391  0.076691729  0.12781955
7           8           9          10          11          12
1   0.22556391  0.06315789  0.06315789 -0.09924812 -0.09924812 -0.15338346
2   0.07518797  0.02105263  0.02105263 -0.03308271 -0.03308271 -0.05112782
3   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
4  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
5  -0.11278195 -0.03157895 -0.03157895  0.04962406  0.04962406  0.07669173
6  -0.18796992 -0.05263158 -0.05263158  0.08270677  0.08270677  0.12781955
7   0.32330827  0.21052632  0.21052632  0.09774436  0.09774436  0.06015038
8   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
9   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
10  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
11  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
12  0.06015038  0.13684211  0.13684211  0.21353383  0.21353383  0.23909774


I-H matrix:
1           2           3           4            5           6
1   0.508521303 -0.27493734 -0.22080201 -0.11253133 -0.004260652  0.10401003
2  -0.274937343  0.79724311 -0.18471178 -0.14862155 -0.112531328 -0.07644110
3  -0.220802005 -0.18471178  0.82431078 -0.15764411 -0.139598997 -0.12155388
4  -0.112531328 -0.14862155 -0.15764411  0.82431078 -0.193734336 -0.21177945
5  -0.004260652 -0.11253133 -0.13959900 -0.19373434  0.752130326 -0.30200501
6   0.104010025 -0.07644110 -0.12155388 -0.21177945 -0.302005013  0.60776942
7  -0.225563910 -0.07518797 -0.03759398  0.03759398  0.112781955  0.18796992
8  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
9  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
10  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
11  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
12  0.153383459  0.05112782  0.02556391 -0.02556391 -0.076691729 -0.12781955
7           8           9          10          11          12
1  -0.22556391 -0.06315789 -0.06315789  0.09924812  0.09924812  0.15338346
2  -0.07518797 -0.02105263 -0.02105263  0.03308271  0.03308271  0.05112782
3  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
4   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
5   0.11278195  0.03157895  0.03157895 -0.04962406 -0.04962406 -0.07669173
6   0.18796992  0.05263158  0.05263158 -0.08270677 -0.08270677 -0.12781955
7   0.67669173 -0.21052632 -0.21052632 -0.09774436 -0.09774436 -0.06015038
8  -0.21052632  0.82105263 -0.17894737 -0.14736842 -0.14736842 -0.13684211
9  -0.21052632 -0.17894737  0.82105263 -0.14736842 -0.14736842 -0.13684211
10 -0.09774436 -0.14736842 -0.14736842  0.80300752 -0.19699248 -0.21353383
11 -0.09774436 -0.14736842 -0.14736842 -0.19699248  0.80300752 -0.21353383
12 -0.06015038 -0.13684211 -0.13684211 -0.21353383 -0.21353383  0.76090226


H(I-H) Matrix:
1            2            3            4            5             6
1   4.660968e-16 2.771670e-16 2.483865e-16 1.467862e-16 6.667335e-17 -1.998490e-17
2   2.581638e-16 2.043323e-16 2.113363e-16 2.018468e-16 1.694511e-16  1.364638e-16
3   2.099850e-16 2.080638e-16 2.275722e-16 1.884871e-16 1.839190e-16  1.972700e-16
4   1.260478e-16 1.624209e-16 1.974956e-16 2.156428e-16 2.474113e-16  2.712358e-16
5   4.222798e-17 1.272256e-16 1.787142e-16 2.351895e-16 3.208197e-16  3.524767e-16
6  -5.184180e-17 1.247540e-16 1.793306e-16 2.442290e-16 3.269276e-16  4.542570e-16
7   3.762258e-16 2.541965e-16 2.402612e-16 1.807484e-16 1.069078e-16  4.784466e-17
8   2.427681e-16 2.108265e-16 2.046576e-16 1.931053e-16 1.842373e-16  1.682665e-16
9   2.427681e-16 2.108265e-16 2.046576e-16 1.931053e-16 1.842373e-16  1.682665e-16
10  9.559275e-17 1.659194e-16 1.806454e-16 2.242287e-16 2.632223e-16  2.914454e-16
11  9.559275e-17 1.659194e-16 1.806454e-16 2.242287e-16 2.632223e-16  2.914454e-16
12  3.460299e-17 1.621992e-16 1.753748e-16 2.260875e-16 2.810608e-16  3.405225e-16
7            8            9           10           11           12
1   4.086062e-16 3.115794e-16 3.115794e-16 1.929473e-16 1.929473e-16 1.220202e-16
2   2.659118e-16 2.129614e-16 2.129614e-16 1.737714e-16 1.737714e-16 1.678819e-16
3   2.004145e-16 1.937694e-16 1.955041e-16 1.835957e-16 1.835957e-16 1.767097e-16
4   1.075349e-16 1.478252e-16 1.460905e-16 1.825364e-16 1.825364e-16 1.923985e-16
5   1.105039e-17 9.886823e-17 9.886823e-17 1.818749e-16 1.818749e-16 2.240775e-16
6  -7.103599e-17 4.883314e-17 5.577204e-17 1.809245e-16 1.809245e-16 2.516840e-16
7   4.175159e-16 3.206816e-16 3.137427e-16 2.328892e-16 2.398281e-16 2.092985e-16
8   2.706643e-16 2.475742e-16 2.545131e-16 2.300186e-16 2.230797e-16 2.617196e-16
9   2.706643e-16 2.475742e-16 2.545131e-16 2.300186e-16 2.230797e-16 2.617196e-16
10  1.327894e-16 1.837994e-16 1.837994e-16 2.598155e-16 2.598155e-16 2.580266e-16
11  1.327894e-16 1.837994e-16 1.837994e-16 2.598155e-16 2.598155e-16 2.580266e-16
12  9.788313e-17 1.853410e-16 1.714632e-16 2.464764e-16 2.464764e-16 2.825431e-16


Verify H and I-H

H*H matrix is
1           2           3           4            5           6
1   0.491478697  0.27493734  0.22080201  0.11253133  0.004260652 -0.10401003
2   0.274937343  0.20275689  0.18471178  0.14862155  0.112531328  0.07644110
3   0.220802005  0.18471178  0.17568922  0.15764411  0.139598997  0.12155388
4   0.112531328  0.14862155  0.15764411  0.17568922  0.193734336  0.21177945
5   0.004260652  0.11253133  0.13959900  0.19373434  0.247869674  0.30200501
6  -0.104010025  0.07644110  0.12155388  0.21177945  0.302005013  0.39223058
7   0.225563910  0.07518797  0.03759398 -0.03759398 -0.112781955 -0.18796992
8   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
9   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
10 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
11 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
12 -0.153383459 -0.05112782 -0.02556391  0.02556391  0.076691729  0.12781955
7           8           9          10          11          12
1   0.22556391  0.06315789  0.06315789 -0.09924812 -0.09924812 -0.15338346
2   0.07518797  0.02105263  0.02105263 -0.03308271 -0.03308271 -0.05112782
3   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
4  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
5  -0.11278195 -0.03157895 -0.03157895  0.04962406  0.04962406  0.07669173
6  -0.18796992 -0.05263158 -0.05263158  0.08270677  0.08270677  0.12781955
7   0.32330827  0.21052632  0.21052632  0.09774436  0.09774436  0.06015038
8   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
9   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
10  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
11  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
12  0.06015038  0.13684211  0.13684211  0.21353383  0.21353383  0.23909774

(I-H)*(I-H) matrix is
1           2           3           4            5           6
1   0.508521303 -0.27493734 -0.22080201 -0.11253133 -0.004260652  0.10401003
2  -0.274937343  0.79724311 -0.18471178 -0.14862155 -0.112531328 -0.07644110
3  -0.220802005 -0.18471178  0.82431078 -0.15764411 -0.139598997 -0.12155388
4  -0.112531328 -0.14862155 -0.15764411  0.82431078 -0.193734336 -0.21177945
5  -0.004260652 -0.11253133 -0.13959900 -0.19373434  0.752130326 -0.30200501
6   0.104010025 -0.07644110 -0.12155388 -0.21177945 -0.302005013  0.60776942
7  -0.225563910 -0.07518797 -0.03759398  0.03759398  0.112781955  0.18796992
8  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
9  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
10  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
11  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
12  0.153383459  0.05112782  0.02556391 -0.02556391 -0.076691729 -0.12781955
7           8           9          10          11          12
1  -0.22556391 -0.06315789 -0.06315789  0.09924812  0.09924812  0.15338346
2  -0.07518797 -0.02105263 -0.02105263  0.03308271  0.03308271  0.05112782
3  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
4   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
5   0.11278195  0.03157895  0.03157895 -0.04962406 -0.04962406 -0.07669173
6   0.18796992  0.05263158  0.05263158 -0.08270677 -0.08270677 -0.12781955
7   0.67669173 -0.21052632 -0.21052632 -0.09774436 -0.09774436 -0.06015038
8  -0.21052632  0.82105263 -0.17894737 -0.14736842 -0.14736842 -0.13684211
9  -0.21052632 -0.17894737  0.82105263 -0.14736842 -0.14736842 -0.13684211
10 -0.09774436 -0.14736842 -0.14736842  0.80300752 -0.19699248 -0.21353383
11 -0.09774436 -0.14736842 -0.14736842 -0.19699248  0.80300752 -0.21353383
12 -0.06015038 -0.13684211 -0.13684211 -0.21353383 -0.21353383  0.76090226

• With iteraction terms
X matrix is
Sex Educ inter
1  1   1    5     5
2  1   1    9     9
3  1   1   10    10
4  1   1   12    12
5  1   1   14    14
6  1   1   16    16
7  1   0    8     0
8  1   0   11     0
9  1   0   11     0
10 1   0   14     0
11 1   0   14     0
12 1   0   15     0

Y matrix is
Sal
1  17.2
2  28.9
3  42.5
4  56.1
5  56.6
6  70.5
7  21.6
8  18.5
9  17.9
10 31.8
11 35.2
12 39.5


X'X is
Sex Educ inter
12   6  139    66
Sex     6   6   66    66
Educ  139  66 1725   802
inter  66  66  802   802


X'Y is
Sal
436.3
Sex    271.8
Educ  5468.4
inter 3364.7

Beta matrix is
Sal
-8.3090909
Sex   -0.6527512
Educ   2.9363636
inter  1.9965311

Yhat Matrix is
Sal
1  15.70263
2  35.43421
3  40.36711
4  50.23289
5  60.09868
6  69.96447
7  15.18182
8  23.99091
9  23.99091
10 32.80000
11 32.80000
12 35.73636

Error Matrix:
Sal
1   1.4973684
2  -6.5342105
3   2.1328947
4   5.8671053
5  -3.4986842
6   0.5355263
7   6.4181818
8  -5.4909091
9  -6.0909091
10 -1.0000000
11  2.4000000
12  3.7636364

Test each β for H0: βi = 0
sse= 225.8050
sse/(n-p)= 5.31278

The variance-Covariance Matrix
Sex        Educ       inter
4.4162679 -4.4162679 -0.34928230  0.34928230
Sex   -4.4162679  6.1750399  0.34928230 -0.49401914
Educ  -0.3492823  0.3492823  0.02870813 -0.02870813
inter  0.3492823 -0.4940191 -0.02870813  0.04186603

The t-stat is
Sal
-0.74422454
Sex   -0.04944313
Educ   3.26201187
inter  1.83663721

The p_value is
Sal
0.47802864
Sex   0.96177830
Educ  0.01149265
inter 0.10357806
Since P-value's for β0,β1 ( Sex ) and β3 (inter) are greater than α = 5%, so do not reject H0: βi = 0 i=0,1,3
Since P-value's the β2 (Educ) is less than α = 5%, so reject H0: β2 = 0


The 95% CI is
Sal       Sal
-29.0705049 12.452323
Sex   -25.2026159 23.897114
Educ    1.2624552  4.610272
inter  -0.0249054  4.017968


H Matrix:
1            2            3            4             5             6
1   6.403509e-01 3.245614e-01 2.456140e-01 8.771930e-02 -7.017544e-02 -2.280702e-01
2   3.245614e-01 2.192982e-01 1.929825e-01 1.403509e-01  8.771930e-02  3.508772e-02
3   2.456140e-01 1.929825e-01 1.798246e-01 1.535088e-01  1.271930e-01  1.008772e-01
4   8.771930e-02 1.403509e-01 1.535088e-01 1.798246e-01  2.061404e-01  2.324561e-01
5  -7.017544e-02 8.771930e-02 1.271930e-01 2.061404e-01  2.850877e-01  3.640351e-01
6  -2.280702e-01 3.508772e-02 1.008772e-01 2.324561e-01  3.640351e-01  4.956140e-01
7   1.665335e-16 1.665335e-16 3.330669e-16 2.220446e-16  3.330669e-16  4.440892e-16
8   8.326673e-17 1.387779e-16 1.665335e-16 1.665335e-16  1.665335e-16  2.220446e-16
9   8.326673e-17 1.387779e-16 1.665335e-16 1.665335e-16  1.665335e-16  2.220446e-16
10  5.551115e-17 5.551115e-17 1.110223e-16 1.110223e-16  1.110223e-16  1.110223e-16
11  5.551115e-17 5.551115e-17 1.110223e-16 1.110223e-16  1.110223e-16  1.110223e-16
12  2.775558e-17 2.775558e-17 5.551115e-17 0.000000e+00 -5.551115e-17  0.000000e+00
7             8             9            10            11            12
1   2.775558e-16  2.983724e-16  2.983724e-16  3.191891e-16  3.191891e-16  3.261280e-16
2   5.551115e-17  1.595946e-16  1.595946e-16  2.636780e-16  2.636780e-16  2.983724e-16
3  -3.330669e-16 -2.914335e-16 -2.914335e-16 -2.498002e-16 -2.498002e-16 -2.359224e-16
4  -6.661338e-16 -5.828671e-16 -5.828671e-16 -4.996004e-16 -4.996004e-16 -4.718448e-16
5  -1.110223e-16  1.387779e-17  1.387779e-17  1.387779e-16  1.387779e-16  1.804112e-16
6  -4.440892e-16 -2.775558e-16 -2.775558e-16 -1.110223e-16 -1.110223e-16 -5.551115e-17
7   6.650718e-01  3.062201e-01  3.062201e-01 -5.263158e-02 -5.263158e-02 -1.722488e-01
8   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
9   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
10 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
11 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
12 -1.722488e-01  7.177033e-02  7.177033e-02  3.157895e-01  3.157895e-01  3.971292e-01


I-H matrix:
1             2             3             4             5             6
1   3.596491e-01 -3.245614e-01 -2.456140e-01 -8.771930e-02  7.017544e-02  2.280702e-01
2  -3.245614e-01  7.807018e-01 -1.929825e-01 -1.403509e-01 -8.771930e-02 -3.508772e-02
3  -2.456140e-01 -1.929825e-01  8.201754e-01 -1.535088e-01 -1.271930e-01 -1.008772e-01
4  -8.771930e-02 -1.403509e-01 -1.535088e-01  8.201754e-01 -2.061404e-01 -2.324561e-01
5   7.017544e-02 -8.771930e-02 -1.271930e-01 -2.061404e-01  7.149123e-01 -3.640351e-01
6   2.280702e-01 -3.508772e-02 -1.008772e-01 -2.324561e-01 -3.640351e-01  5.043860e-01
7  -1.665335e-16 -1.665335e-16 -3.330669e-16 -2.220446e-16 -3.330669e-16 -4.440892e-16
8  -8.326673e-17 -1.387779e-16 -1.665335e-16 -1.665335e-16 -1.665335e-16 -2.220446e-16
9  -8.326673e-17 -1.387779e-16 -1.665335e-16 -1.665335e-16 -1.665335e-16 -2.220446e-16
10 -5.551115e-17 -5.551115e-17 -1.110223e-16 -1.110223e-16 -1.110223e-16 -1.110223e-16
11 -5.551115e-17 -5.551115e-17 -1.110223e-16 -1.110223e-16 -1.110223e-16 -1.110223e-16
12 -2.775558e-17 -2.775558e-17 -5.551115e-17  0.000000e+00  5.551115e-17  0.000000e+00
7             8             9            10            11            12
1  -2.775558e-16 -2.983724e-16 -2.983724e-16 -3.191891e-16 -3.191891e-16 -3.261280e-16
2  -5.551115e-17 -1.595946e-16 -1.595946e-16 -2.636780e-16 -2.636780e-16 -2.983724e-16
3   3.330669e-16  2.914335e-16  2.914335e-16  2.498002e-16  2.498002e-16  2.359224e-16
4   6.661338e-16  5.828671e-16  5.828671e-16  4.996004e-16  4.996004e-16  4.718448e-16
5   1.110223e-16 -1.387779e-17 -1.387779e-17 -1.387779e-16 -1.387779e-16 -1.804112e-16
6   4.440892e-16  2.775558e-16  2.775558e-16  1.110223e-16  1.110223e-16  5.551115e-17
7   3.349282e-01 -3.062201e-01 -3.062201e-01  5.263158e-02  5.263158e-02  1.722488e-01
8  -3.062201e-01  7.942584e-01 -2.057416e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
9  -3.062201e-01 -2.057416e-01  7.942584e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
10  5.263158e-02 -1.052632e-01 -1.052632e-01  7.368421e-01 -2.631579e-01 -3.157895e-01
11  5.263158e-02 -1.052632e-01 -1.052632e-01 -2.631579e-01  7.368421e-01 -3.157895e-01
12  1.722488e-01 -7.177033e-02 -7.177033e-02 -3.157895e-01 -3.157895e-01  6.028708e-01


H(I-H) Matrix:
1             2             3             4             5             6
1   4.563509e-16  5.139169e-16  5.561466e-16  5.632464e-16  5.772834e-16  6.954073e-16
2   4.899044e-16  5.594520e-16  5.406846e-16  5.491120e-16  6.017754e-16  5.572935e-16
3   5.222449e-16  5.327109e-16  5.325466e-16  5.694382e-16  5.889827e-16  5.287315e-16
4   5.612982e-16  5.437867e-16  5.555604e-16  5.355281e-16  5.328447e-16  5.093446e-16
5   6.094233e-16  5.747500e-16  5.675595e-16  5.311371e-16  4.669659e-16  5.138170e-16
6   6.532860e-16  5.659366e-16  5.426093e-16  5.232224e-16  4.344398e-16  4.566931e-16
7  -1.219120e-16 -2.494018e-16 -2.233726e-16 -3.168651e-16 -3.359885e-16 -3.699858e-16
8  -1.072153e-16 -1.183707e-16 -1.776667e-16 -1.615977e-16 -2.135232e-16 -2.407475e-16
9  -1.072153e-16 -1.183707e-16 -1.776667e-16 -1.615977e-16 -2.135232e-16 -2.407475e-16
10 -4.869399e-17 -8.375367e-17 -6.914547e-17 -6.914547e-17 -5.745891e-17 -9.251859e-17
11 -4.869399e-17 -8.375367e-17 -6.914547e-17 -6.914547e-17 -5.745891e-17 -9.251859e-17
12 -4.590515e-17 -3.050015e-17 -1.828238e-17 -5.918533e-17 -6.184137e-17 -5.533408e-18
7             8             9            10            11            12
1  -1.645857e-16 -1.824807e-16 -1.824807e-16 -2.003758e-16 -2.003758e-16 -2.063408e-16
2   8.083203e-17  1.472993e-17  1.472993e-17 -5.137216e-17 -5.137216e-17 -7.340619e-17
3   1.421865e-16  6.403260e-17  6.403260e-17 -1.412126e-17 -1.412126e-17 -4.017254e-17
4   2.648953e-16  1.626379e-16  1.626379e-16  6.038055e-17  6.038055e-17  2.629476e-17
5   3.876042e-16  2.612433e-16  2.612433e-16  1.348824e-16  1.348824e-16  9.276206e-17
6   5.103130e-16  3.598486e-16  3.598486e-16  2.093842e-16  2.093842e-16  1.592294e-16
7   2.660946e-15  1.279395e-15  1.275926e-15 -8.827777e-17 -8.827777e-17 -5.662991e-16
8   1.280731e-15  8.341009e-16  8.375703e-16  3.926743e-16  3.926743e-16  2.585111e-16
9   1.280731e-15  8.341009e-16  8.375703e-16  3.926743e-16  3.926743e-16  2.585111e-16
10 -9.770694e-17  3.843090e-16  3.843090e-16  8.732639e-16  8.732639e-16  1.066990e-15
11 -9.770694e-17  3.843090e-16  3.843090e-16  8.732639e-16  8.732639e-16  1.066990e-15
12 -5.552741e-16  2.252447e-16  2.252447e-16  1.033516e-15  1.061271e-15  1.286216e-15


Verify H and I-H

H*H matrix is

1            2            3            4             5             6
1   6.403509e-01 3.245614e-01 2.456140e-01 8.771930e-02 -7.017544e-02 -2.280702e-01
2   3.245614e-01 2.192982e-01 1.929825e-01 1.403509e-01  8.771930e-02  3.508772e-02
3   2.456140e-01 1.929825e-01 1.798246e-01 1.535088e-01  1.271930e-01  1.008772e-01
4   8.771930e-02 1.403509e-01 1.535088e-01 1.798246e-01  2.061404e-01  2.324561e-01
5  -7.017544e-02 8.771930e-02 1.271930e-01 2.061404e-01  2.850877e-01  3.640351e-01
6  -2.280702e-01 3.508772e-02 1.008772e-01 2.324561e-01  3.640351e-01  4.956140e-01
7   2.884455e-16 4.159352e-16 5.564395e-16 5.389097e-16  6.690555e-16  8.140750e-16
8   1.904820e-16 2.571485e-16 3.442001e-16 3.281311e-16  3.800566e-16  4.627921e-16
9   1.904820e-16 2.571485e-16 3.442001e-16 3.281311e-16  3.800566e-16  4.627921e-16
10  1.042051e-16 1.392648e-16 1.801678e-16 1.801678e-16  1.684812e-16  2.035409e-16
11  1.042051e-16 1.392648e-16 1.801678e-16 1.801678e-16  1.684812e-16  2.035409e-16
12  7.366073e-17 5.825572e-17 7.379353e-17 5.918533e-17  6.330219e-18  5.533408e-18
7             8             9            10            11            12
1   4.421415e-16  4.808532e-16  4.808532e-16  5.195649e-16  5.195649e-16  5.324688e-16
2  -2.532088e-17  1.448646e-16  1.448646e-16  3.150501e-16  3.150501e-16  3.717786e-16
3  -4.752534e-16 -3.554661e-16 -3.554661e-16 -2.356789e-16 -2.356789e-16 -1.957498e-16
4  -9.310291e-16 -7.455050e-16 -7.455050e-16 -5.599809e-16 -5.599809e-16 -4.981395e-16
5  -4.986265e-16 -2.473655e-16 -2.473655e-16  3.895519e-18  3.895519e-18  8.764919e-17
6  -9.544022e-16 -6.374044e-16 -6.374044e-16 -3.204065e-16 -3.204065e-16 -2.147405e-16
7   6.650718e-01  3.062201e-01  3.062201e-01 -5.263158e-02 -5.263158e-02 -1.722488e-01
8   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
9   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
10 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
11 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
12 -1.722488e-01  7.177033e-02  7.177033e-02  3.157895e-01  3.157895e-01  3.971292e-01

H(I-H) Matrix:
1             2             3             4             5             6
1   3.596491e-01 -3.245614e-01 -2.456140e-01 -8.771930e-02  7.017544e-02  2.280702e-01
2  -3.245614e-01  7.807018e-01 -1.929825e-01 -1.403509e-01 -8.771930e-02 -3.508772e-02
3  -2.456140e-01 -1.929825e-01  8.201754e-01 -1.535088e-01 -1.271930e-01 -1.008772e-01
4  -8.771930e-02 -1.403509e-01 -1.535088e-01  8.201754e-01 -2.061404e-01 -2.324561e-01
5   7.017544e-02 -8.771930e-02 -1.271930e-01 -2.061404e-01  7.149123e-01 -3.640351e-01
6   2.280702e-01 -3.508772e-02 -1.008772e-01 -2.324561e-01 -3.640351e-01  5.043860e-01
7  -4.462140e-17  8.286832e-17 -1.096943e-16  9.482048e-17  2.921640e-18 -7.410340e-17
8   2.394859e-17 -2.040721e-17  1.113322e-17 -4.935800e-18  4.698970e-17  1.870292e-17
9   2.394859e-17 -2.040721e-17  1.113322e-17 -4.935800e-18  4.698970e-17  1.870292e-17
10 -6.817159e-18  2.824252e-17 -4.187683e-17 -4.187683e-17 -5.356339e-17 -1.850372e-17
11 -6.817159e-18  2.824252e-17 -4.187683e-17 -4.187683e-17 -5.356339e-17 -1.850372e-17
12  1.814958e-17  2.744570e-18 -3.722877e-17  5.918533e-17  1.173525e-16  5.533408e-18
7             8             9            10            11            12
1  -1.129701e-16 -1.158917e-16 -1.158917e-16 -1.188133e-16 -1.188133e-16 -1.197872e-16
2  -1.363432e-16 -1.743245e-16 -1.743245e-16 -2.123058e-16 -2.123058e-16 -2.249662e-16
3   1.908804e-16  2.274009e-16  2.274009e-16  2.639214e-16  2.639214e-16  2.760949e-16
4   4.012385e-16  4.202292e-16  4.202292e-16  4.392198e-16  4.392198e-16  4.455500e-16
5  -2.765819e-16 -2.751211e-16 -2.751211e-16 -2.736602e-16 -2.736602e-16 -2.731733e-16
6  -6.622383e-17 -8.229285e-17 -8.229285e-17 -9.836186e-17 -9.836186e-17 -1.037182e-16
7   3.349282e-01 -3.062201e-01 -3.062201e-01  5.263158e-02  5.263158e-02  1.722488e-01
8  -3.062201e-01  7.942584e-01 -2.057416e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
9  -3.062201e-01 -2.057416e-01  7.942584e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
10  5.263158e-02 -1.052632e-01 -1.052632e-01  7.368421e-01 -2.631579e-01 -3.157895e-01
11  5.263158e-02 -1.052632e-01 -1.052632e-01 -2.631579e-01  7.368421e-01 -3.157895e-01
12  1.722488e-01 -7.177033e-02 -7.177033e-02 -3.157895e-01 -3.157895e-01  6.028708e-01


### 2.Female=-1,Male=+1

• Without iteraction terms
X Matrix
Sex Educ
1   1   1    5
2   1   1    9
3   1   1   10
4   1   1   12
5   1   1   14
6   1   1   16
7   1  -1    8
8   1  -1   11
9   1  -1   11
10  1  -1   14
11  1  -1   14
12  1  -1   15

Y Matrix
Sal
1  17.2
2  28.9
3  42.5
4  56.1
5  56.6
6  70.5
7  21.6
8  18.5
9  17.9
10 31.8
11 35.2
12 39.5

X'X Matrix
Sex Educ
12   0  139
Sex    0  12   -7
Educ 139  -7 1725

X'Y matrix
Sal
436.3
Sex   107.3
Educ 5468.4

Beta Matrix
Sal
-13.512707
Sex   11.453158
Educ   4.305414

Yhat Matrix
Sal
1  19.467519
2  36.689173
3  40.994586
4  49.605414
5  58.216241
6  66.827068
7   9.477444
8  22.393684
9  22.393684
10 35.309925
11 35.309925
12 39.615338

Error Matrix
Sal
1  -2.2675188
2  -7.7891729
3   1.5054135
4   6.4945865
5  -1.6162406
6   3.6729323
7  12.1225564
8  -3.8936842
9  -4.4936842
10 -3.5099248
11 -0.1099248
12 -0.1153383

Test each β for H0: βi = 0
sse=321.0168
sse/(n-p)=5.972313

The variance-Covariance Matrix
Sex         Educ
1.29392231 -0.060964912 -0.104511278
Sex  -0.06096491  0.086403509  0.005263158
Educ -0.10451128  0.005263158  0.009022556

The t-stat is
Sal
-1.989050
Sex   6.524045
Educ  7.589401

The p_value is
Sal
7.791577e-02
Sex  1.083812e-04
Educ 3.363518e-05
Since P-value's are less than α = 5%, so reject H0: βi = 0 i=0,1,2

The 95% CI is
Sal       Sal
-25.966049 -1.059365
Sex    8.235073 14.671243
Educ   3.265501  5.345326


H Matrix
1           2           3           4            5           6
1   0.491478697  0.27493734  0.22080201  0.11253133  0.004260652 -0.10401003
2   0.274937343  0.20275689  0.18471178  0.14862155  0.112531328  0.07644110
3   0.220802005  0.18471178  0.17568922  0.15764411  0.139598997  0.12155388
4   0.112531328  0.14862155  0.15764411  0.17568922  0.193734336  0.21177945
5   0.004260652  0.11253133  0.13959900  0.19373434  0.247869674  0.30200501
6  -0.104010025  0.07644110  0.12155388  0.21177945  0.302005013  0.39223058
7   0.225563910  0.07518797  0.03759398 -0.03759398 -0.112781955 -0.18796992
8   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
9   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
10 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
11 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
12 -0.153383459 -0.05112782 -0.02556391  0.02556391  0.076691729  0.12781955
7           8           9          10          11          12
1   0.22556391  0.06315789  0.06315789 -0.09924812 -0.09924812 -0.15338346
2   0.07518797  0.02105263  0.02105263 -0.03308271 -0.03308271 -0.05112782
3   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
4  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
5  -0.11278195 -0.03157895 -0.03157895  0.04962406  0.04962406  0.07669173
6  -0.18796992 -0.05263158 -0.05263158  0.08270677  0.08270677  0.12781955
7   0.32330827  0.21052632  0.21052632  0.09774436  0.09774436  0.06015038
8   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
9   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
10  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
11  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
12  0.06015038  0.13684211  0.13684211  0.21353383  0.21353383  0.23909774

I-H Matrix
1           2           3           4            5           6
1   0.508521303 -0.27493734 -0.22080201 -0.11253133 -0.004260652  0.10401003
2  -0.274937343  0.79724311 -0.18471178 -0.14862155 -0.112531328 -0.07644110
3  -0.220802005 -0.18471178  0.82431078 -0.15764411 -0.139598997 -0.12155388
4  -0.112531328 -0.14862155 -0.15764411  0.82431078 -0.193734336 -0.21177945
5  -0.004260652 -0.11253133 -0.13959900 -0.19373434  0.752130326 -0.30200501
6   0.104010025 -0.07644110 -0.12155388 -0.21177945 -0.302005013  0.60776942
7  -0.225563910 -0.07518797 -0.03759398  0.03759398  0.112781955  0.18796992
8  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
9  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
10  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
11  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
12  0.153383459  0.05112782  0.02556391 -0.02556391 -0.076691729 -0.12781955
7           8           9          10          11          12
1  -0.22556391 -0.06315789 -0.06315789  0.09924812  0.09924812  0.15338346
2  -0.07518797 -0.02105263 -0.02105263  0.03308271  0.03308271  0.05112782
3  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
4   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
5   0.11278195  0.03157895  0.03157895 -0.04962406 -0.04962406 -0.07669173
6   0.18796992  0.05263158  0.05263158 -0.08270677 -0.08270677 -0.12781955
7   0.67669173 -0.21052632 -0.21052632 -0.09774436 -0.09774436 -0.06015038
8  -0.21052632  0.82105263 -0.17894737 -0.14736842 -0.14736842 -0.13684211
9  -0.21052632 -0.17894737  0.82105263 -0.14736842 -0.14736842 -0.13684211
10 -0.09774436 -0.14736842 -0.14736842  0.80300752 -0.19699248 -0.21353383
11 -0.09774436 -0.14736842 -0.14736842 -0.19699248  0.80300752 -0.21353383
12 -0.06015038 -0.13684211 -0.13684211 -0.21353383 -0.21353383  0.76090226

H(I-H) Matrix
1             2             3             4             5             6
1   1.461030e-16  2.400745e-17 -8.527928e-17 -1.798192e-16 -3.047167e-16 -3.983901e-16
2  -3.200938e-18 -1.141525e-16 -1.666990e-16 -1.893928e-16 -2.537198e-16 -3.093733e-16
3  -6.630023e-17 -1.332868e-16 -1.583176e-16 -2.161857e-16 -2.519360e-16 -2.876863e-16
4  -1.558943e-16 -1.662922e-16 -1.940008e-16 -2.158077e-16 -2.415179e-16 -2.297145e-16
5  -2.517365e-16 -2.210404e-16 -2.271111e-16 -2.106300e-16 -1.928478e-16 -2.180000e-16
6  -3.188368e-16 -2.714126e-16 -2.749473e-16 -2.260716e-16 -2.118904e-16 -1.478360e-16
7   2.441412e-16  1.276777e-16  1.080988e-16  2.644013e-17 -2.052403e-17 -8.917224e-17
8   9.980589e-17  5.649583e-17  4.590559e-17  2.299038e-17  1.809262e-18 -2.284109e-17
9   9.980589e-17  5.649583e-17  4.590559e-17  2.299038e-17  1.809262e-18 -2.284109e-17
10 -4.468607e-17 -1.488322e-17 -9.906050e-19  1.638670e-17  3.723387e-17  6.154880e-17
11 -4.468607e-17 -1.488322e-17 -9.906050e-19  1.638670e-17  3.723387e-17  6.154880e-17
12 -8.643802e-17 -3.904483e-17 -2.287836e-17  1.465833e-17  5.046114e-17  7.932294e-17
7             8             9            10            11            12
1   1.004852e-16 -5.717472e-17 -5.023583e-17 -2.381721e-16 -2.381721e-16 -2.765325e-16
2  -3.402976e-17 -1.258289e-16 -1.258289e-16 -2.134091e-16 -2.168786e-16 -2.342182e-16
3  -7.791930e-17 -1.469799e-16 -1.469799e-16 -2.104619e-16 -2.121966e-16 -2.217922e-16
4  -1.538668e-16 -1.773221e-16 -1.773221e-16 -1.992005e-16 -1.992005e-16 -1.989765e-16
5  -2.160586e-16 -2.109510e-16 -2.109510e-16 -1.993780e-16 -1.993780e-16 -1.914735e-16
6  -3.011541e-16 -2.441234e-16 -2.510623e-16 -1.835453e-16 -1.766064e-16 -1.887935e-16
7   2.066623e-16  1.258242e-16  1.119464e-16  2.280297e-17  1.933353e-17  1.101482e-17
8   1.014729e-16  7.048669e-17  7.742559e-17  4.329863e-17  5.370697e-17  2.498408e-17
9   1.014729e-16  7.048669e-17  7.742559e-17  4.329863e-17  5.370697e-17  2.498408e-17
10  3.786237e-18  4.051359e-17  2.663580e-17  5.888234e-17  5.194345e-17  7.425430e-17
11  3.786237e-18  4.051359e-17  2.663580e-17  5.888234e-17  5.194345e-17  7.425430e-17
12 -4.443196e-17  1.455203e-17  1.455203e-17  4.721023e-17  4.721023e-17  9.973305e-17


Verify H and I-H

H*H matrix is
1           2           3           4            5           6
1   0.491478697  0.27493734  0.22080201  0.11253133  0.004260652 -0.10401003
2   0.274937343  0.20275689  0.18471178  0.14862155  0.112531328  0.07644110
3   0.220802005  0.18471178  0.17568922  0.15764411  0.139598997  0.12155388
4   0.112531328  0.14862155  0.15764411  0.17568922  0.193734336  0.21177945
5   0.004260652  0.11253133  0.13959900  0.19373434  0.247869674  0.30200501
6  -0.104010025  0.07644110  0.12155388  0.21177945  0.302005013  0.39223058
7   0.225563910  0.07518797  0.03759398 -0.03759398 -0.112781955 -0.18796992
8   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
9   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
10 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
11 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
12 -0.153383459 -0.05112782 -0.02556391  0.02556391  0.076691729  0.12781955
7           8           9          10          11          12
1   0.22556391  0.06315789  0.06315789 -0.09924812 -0.09924812 -0.15338346
2   0.07518797  0.02105263  0.02105263 -0.03308271 -0.03308271 -0.05112782
3   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
4  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
5  -0.11278195 -0.03157895 -0.03157895  0.04962406  0.04962406  0.07669173
6  -0.18796992 -0.05263158 -0.05263158  0.08270677  0.08270677  0.12781955
7   0.32330827  0.21052632  0.21052632  0.09774436  0.09774436  0.06015038
8   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
9   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
10  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
11  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
12  0.06015038  0.13684211  0.13684211  0.21353383  0.21353383  0.23909774

(I-H)*(I-H) matrix is

1           2           3           4            5           6
1   0.508521303 -0.27493734 -0.22080201 -0.11253133 -0.004260652  0.10401003
2  -0.274937343  0.79724311 -0.18471178 -0.14862155 -0.112531328 -0.07644110
3  -0.220802005 -0.18471178  0.82431078 -0.15764411 -0.139598997 -0.12155388
4  -0.112531328 -0.14862155 -0.15764411  0.82431078 -0.193734336 -0.21177945
5  -0.004260652 -0.11253133 -0.13959900 -0.19373434  0.752130326 -0.30200501
6   0.104010025 -0.07644110 -0.12155388 -0.21177945 -0.302005013  0.60776942
7  -0.225563910 -0.07518797 -0.03759398  0.03759398  0.112781955  0.18796992
8  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
9  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
10  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
11  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
12  0.153383459  0.05112782  0.02556391 -0.02556391 -0.076691729 -0.12781955
7           8           9          10          11          12
1  -0.22556391 -0.06315789 -0.06315789  0.09924812  0.09924812  0.15338346
2  -0.07518797 -0.02105263 -0.02105263  0.03308271  0.03308271  0.05112782
3  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
4   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
5   0.11278195  0.03157895  0.03157895 -0.04962406 -0.04962406 -0.07669173
6   0.18796992  0.05263158  0.05263158 -0.08270677 -0.08270677 -0.12781955
7   0.67669173 -0.21052632 -0.21052632 -0.09774436 -0.09774436 -0.06015038
8  -0.21052632  0.82105263 -0.17894737 -0.14736842 -0.14736842 -0.13684211
9  -0.21052632 -0.17894737  0.82105263 -0.14736842 -0.14736842 -0.13684211
10 -0.09774436 -0.14736842 -0.14736842  0.80300752 -0.19699248 -0.21353383
11 -0.09774436 -0.14736842 -0.14736842 -0.19699248  0.80300752 -0.21353383
12 -0.06015038 -0.13684211 -0.13684211 -0.21353383 -0.21353383  0.76090226

• With iteraction terms
X Matrix
Sex Educ inter
1  1   1    5     5
2  1   1    9     9
3  1   1   10    10
4  1   1   12    12
5  1   1   14    14
6  1   1   16    16
7  1  -1    8    -8
8  1  -1   11   -11
9  1  -1   11   -11
10 1  -1   14   -14
11 1  -1   14   -14
12 1  -1   15   -15

Y Matrix
Sal
1  17.2
2  28.9
3  42.5
4  56.1
5  56.6
6  70.5
7  21.6
8  18.5
9  17.9
10 31.8
11 35.2
12 39.5

X'X Matrix
Sex Educ inter
12   0  139    -7
Sex     0  12   -7   139
Educ  139  -7 1725  -121
inter  -7 139 -121  1725

X'Y Matrix
Sal
436.3
Sex    107.3
Educ  5468.4
inter 1261.0

Beta Matrix
Sal
-8.6354665
Sex   -0.3263756
Educ   3.9346292
inter  0.9982656

Y hat Matrix
Sal
1  15.70263
2  35.43421
3  40.36711
4  50.23289
5  60.09868
6  69.96447
7  15.18182
8  23.99091
9  23.99091
10 32.80000
11 32.80000
12 35.73636

Error Matrix
Sal
1   1.4973684
2  -6.5342105
3   2.1328947
4   5.8671053
5  -3.4986842
6   0.5355263
7   6.4181818
8  -5.4909091
9  -6.0909091
10 -1.0000000
11  2.4000000
12  3.7636364

Test each β for H0: βi = 0
sse=225.8050
sse/(n-p)=5.31278

The variance-Covariance Matrix
Sex        Educ       inter
1.54375997 -0.66437400 -0.12350478  0.05113636
Sex   -0.66437400  1.54375997  0.05113636 -0.12350478
Educ  -0.12350478  0.05113636  0.01046651 -0.00388756
inter  0.05113636 -0.12350478 -0.00388756  0.01046651

The t-stat is
Sal
-1.30819986
Sex   -0.04944313
Educ   7.23904211
inter  1.83663721

The p_value is
Sal
2.271398e-01
Sex   9.617783e-01
Educ  8.899721e-05
inter 1.035781e-01
Since P-value's for β0,β1, and β3 (inter) are greater than α = 5%, so do not reject H0: βi = 0 i=0,1,3
Since P-value's the β0 (Educ) is less than α = 5%, so reject H0: β2 = 0


The 95% CI is
Sal       Sal
-20.9103989  3.639466
Sex   -12.6013080 11.948557
Educ    2.9239109  4.945347
inter  -0.0124527  2.008984

H Matrix
1            2            3            4             5             6
1   6.403509e-01 3.245614e-01 2.456140e-01 8.771930e-02 -7.017544e-02 -2.280702e-01
2   3.245614e-01 2.192982e-01 1.929825e-01 1.403509e-01  8.771930e-02  3.508772e-02
3   2.456140e-01 1.929825e-01 1.798246e-01 1.535088e-01  1.271930e-01  1.008772e-01
4   8.771930e-02 1.403509e-01 1.535088e-01 1.798246e-01  2.061404e-01  2.324561e-01
5  -7.017544e-02 8.771930e-02 1.271930e-01 2.061404e-01  2.850877e-01  3.640351e-01
6  -2.280702e-01 3.508772e-02 1.008772e-01 2.324561e-01  3.640351e-01  4.956140e-01
7   6.938894e-17 4.579670e-16 5.828671e-16 7.216450e-16  8.604228e-16  1.110223e-15
8   2.081668e-16 2.914335e-16 3.053113e-16 3.608225e-16  4.163336e-16  4.440892e-16
9   2.081668e-16 2.914335e-16 3.053113e-16 3.608225e-16  4.163336e-16  4.440892e-16
10  5.238865e-16 3.989864e-16 3.816392e-16 2.914335e-16  2.012279e-16  1.665335e-16
11  5.238865e-16 3.989864e-16 3.816392e-16 2.914335e-16  2.012279e-16  1.665335e-16
12  7.979728e-16 6.036838e-16 5.967449e-16 4.718448e-16  4.579670e-16  3.330669e-16
7             8             9            10            11            12
1  -5.551115e-16 -1.526557e-16 -1.526557e-16  2.498002e-16  2.498002e-16  4.024558e-16
2  -2.081668e-16 -5.724587e-17 -5.724587e-17  9.367507e-17  9.367507e-17  1.439820e-16
3   6.938894e-18  9.367507e-17  9.367507e-17  1.734723e-16  1.734723e-16  2.046974e-16
4   9.714451e-17  4.857226e-17  4.857226e-17  0.000000e+00  0.000000e+00 -6.938894e-18
5   3.053113e-16  1.144917e-16  1.144917e-16 -7.632783e-17 -7.632783e-17 -1.214306e-16
6   4.996004e-16  1.942890e-16  1.942890e-16 -1.110223e-16 -1.110223e-16 -2.498002e-16
7   6.650718e-01  3.062201e-01  3.062201e-01 -5.263158e-02 -5.263158e-02 -1.722488e-01
8   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
9   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
10 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
11 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
12 -1.722488e-01  7.177033e-02  7.177033e-02  3.157895e-01  3.157895e-01  3.971292e-01

I-H Matrix
1             2             3             4             5             6
1   3.596491e-01 -3.245614e-01 -2.456140e-01 -8.771930e-02  7.017544e-02  2.280702e-01
2  -3.245614e-01  7.807018e-01 -1.929825e-01 -1.403509e-01 -8.771930e-02 -3.508772e-02
3  -2.456140e-01 -1.929825e-01  8.201754e-01 -1.535088e-01 -1.271930e-01 -1.008772e-01
4  -8.771930e-02 -1.403509e-01 -1.535088e-01  8.201754e-01 -2.061404e-01 -2.324561e-01
5   7.017544e-02 -8.771930e-02 -1.271930e-01 -2.061404e-01  7.149123e-01 -3.640351e-01
6   2.280702e-01 -3.508772e-02 -1.008772e-01 -2.324561e-01 -3.640351e-01  5.043860e-01
7  -6.938894e-17 -4.579670e-16 -5.828671e-16 -7.216450e-16 -8.604228e-16 -1.110223e-15
8  -2.081668e-16 -2.914335e-16 -3.053113e-16 -3.608225e-16 -4.163336e-16 -4.440892e-16
9  -2.081668e-16 -2.914335e-16 -3.053113e-16 -3.608225e-16 -4.163336e-16 -4.440892e-16
10 -5.238865e-16 -3.989864e-16 -3.816392e-16 -2.914335e-16 -2.012279e-16 -1.665335e-16
11 -5.238865e-16 -3.989864e-16 -3.816392e-16 -2.914335e-16 -2.012279e-16 -1.665335e-16
12 -7.979728e-16 -6.036838e-16 -5.967449e-16 -4.718448e-16 -4.579670e-16 -3.330669e-16
7             8             9            10            11            12
1   5.551115e-16  1.526557e-16  1.526557e-16 -2.498002e-16 -2.498002e-16 -4.024558e-16
2   2.081668e-16  5.724587e-17  5.724587e-17 -9.367507e-17 -9.367507e-17 -1.439820e-16
3  -6.938894e-18 -9.367507e-17 -9.367507e-17 -1.734723e-16 -1.734723e-16 -2.046974e-16
4  -9.714451e-17 -4.857226e-17 -4.857226e-17  0.000000e+00  0.000000e+00  6.938894e-18
5  -3.053113e-16 -1.144917e-16 -1.144917e-16  7.632783e-17  7.632783e-17  1.214306e-16
6  -4.996004e-16 -1.942890e-16 -1.942890e-16  1.110223e-16  1.110223e-16  2.498002e-16
7   3.349282e-01 -3.062201e-01 -3.062201e-01  5.263158e-02  5.263158e-02  1.722488e-01
8  -3.062201e-01  7.942584e-01 -2.057416e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
9  -3.062201e-01 -2.057416e-01  7.942584e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
10  5.263158e-02 -1.052632e-01 -1.052632e-01  7.368421e-01 -2.631579e-01 -3.157895e-01
11  5.263158e-02 -1.052632e-01 -1.052632e-01 -2.631579e-01  7.368421e-01 -3.157895e-01
12  1.722488e-01 -7.177033e-02 -7.177033e-02 -3.157895e-01 -3.157895e-01  6.028708e-01

Verify H and (I-H) is idenponent matrix

H*H Matrix
1            2            3            4             5             6
1   6.403509e-01 3.245614e-01 2.456140e-01 8.771930e-02 -7.017544e-02 -2.280702e-01
2   3.245614e-01 2.192982e-01 1.929825e-01 1.403509e-01  8.771930e-02  3.508772e-02
3   2.456140e-01 1.929825e-01 1.798246e-01 1.535088e-01  1.271930e-01  1.008772e-01
4   8.771930e-02 1.403509e-01 1.535088e-01 1.798246e-01  2.061404e-01  2.324561e-01
5  -7.017544e-02 8.771930e-02 1.271930e-01 2.061404e-01  2.850877e-01  3.640351e-01
6  -2.280702e-01 3.508772e-02 1.008772e-01 2.324561e-01  3.640351e-01  4.956140e-01
7   6.698744e-17 7.882340e-16 9.741233e-16 1.314030e-15  1.634812e-15  2.025714e-15
8   4.784959e-16 6.806203e-16 7.427051e-16 8.246438e-16  9.145506e-16  1.030752e-15
9   4.784959e-16 6.806203e-16 7.427051e-16 8.246438e-16  9.145506e-16  1.030752e-15
10  1.100058e-15 8.334585e-16 7.843385e-16 6.335088e-16  5.177389e-16  3.844391e-16
11  1.100058e-15 8.334585e-16 7.843385e-16 6.335088e-16  5.177389e-16  3.844391e-16
12  1.452475e-15 1.079302e-15 1.005531e-15 8.019458e-16  6.424508e-16  4.508178e-16
7             8             9            10            11            12
1  -1.106471e-15 -2.927380e-16 -2.927380e-16  5.192910e-16  5.192910e-16  8.109058e-16
2  -3.747003e-16 -7.759083e-17 -7.759083e-17  2.181795e-16  2.181795e-16  3.252911e-16
3  -6.265755e-17  1.018036e-16  1.018036e-16  2.650171e-16  2.650171e-16  3.248387e-16
4   2.152468e-16  1.196904e-16  1.196904e-16  2.306878e-17  2.306878e-17 -9.929701e-18
5   6.126396e-16  2.468066e-16  2.468066e-16 -1.199090e-16 -1.199090e-16 -2.491472e-16
6   1.007310e-15  3.831526e-16  3.831526e-16 -2.417048e-16 -2.417048e-16 -4.631988e-16
7   6.650718e-01  3.062201e-01  3.062201e-01 -5.263158e-02 -5.263158e-02 -1.722488e-01
8   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
9   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
10 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
11 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
12 -1.722488e-01  7.177033e-02  7.177033e-02  3.157895e-01  3.157895e-01  3.971292e-01

(I-H)*(I-H) Matrix
1             2             3             4             5             6
1   3.596491e-01 -3.245614e-01 -2.456140e-01 -8.771930e-02  7.017544e-02  2.280702e-01
2  -3.245614e-01  7.807018e-01 -1.929825e-01 -1.403509e-01 -8.771930e-02 -3.508772e-02
3  -2.456140e-01 -1.929825e-01  8.201754e-01 -1.535088e-01 -1.271930e-01 -1.008772e-01
4  -8.771930e-02 -1.403509e-01 -1.535088e-01  8.201754e-01 -2.061404e-01 -2.324561e-01
5   7.017544e-02 -8.771930e-02 -1.271930e-01 -2.061404e-01  7.149123e-01 -3.640351e-01
6   2.280702e-01 -3.508772e-02 -1.008772e-01 -2.324561e-01 -3.640351e-01  5.043860e-01
7  -7.179044e-17 -1.277000e-16 -1.916109e-16 -1.292604e-16 -8.603343e-17 -1.947317e-16
8   6.216231e-17  9.775319e-17  1.320825e-16  1.029989e-16  8.188337e-17  1.425738e-16
9   6.216231e-17  9.775319e-17  1.320825e-16  1.029989e-16  8.188337e-17  1.425738e-16
10  5.228517e-17  3.548575e-17  2.106015e-17  5.064175e-17  1.152830e-16  5.137216e-17
11  5.228517e-17  3.548575e-17  2.106015e-17  5.064175e-17  1.152830e-16  5.137216e-17
12 -1.434702e-16 -1.280652e-16 -1.879588e-16 -1.417438e-16 -2.734832e-16 -2.153160e-16
7             8             9            10            11            12
1   3.751651e-18  1.257329e-17  1.257329e-17  1.969063e-17  1.969063e-17  5.994064e-18
2   4.163336e-17  3.690092e-17  3.690092e-17  3.082938e-17  3.082938e-17  3.732699e-17
3  -7.653534e-17 -8.554649e-17 -8.554649e-17 -8.192764e-17 -8.192764e-17 -8.455601e-17
4   2.095778e-17  2.254587e-17  2.254587e-17  2.306878e-17  2.306878e-17  3.948087e-18
5   2.016927e-18  1.782311e-17  1.782311e-17  3.274671e-17  3.274671e-17 -6.285952e-18
6   8.109210e-18 -5.425507e-18 -5.425507e-18 -1.966020e-17 -1.966020e-17  3.640153e-17
7   3.349282e-01 -3.062201e-01 -3.062201e-01  5.263158e-02  5.263158e-02  1.722488e-01
8  -3.062201e-01  7.942584e-01 -2.057416e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
9  -3.062201e-01 -2.057416e-01  7.942584e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
10  5.263158e-02 -1.052632e-01 -1.052632e-01  7.368421e-01 -2.631579e-01 -3.157895e-01
11  5.263158e-02 -1.052632e-01 -1.052632e-01 -2.631579e-01  7.368421e-01 -3.157895e-01
12  1.722488e-01 -7.177033e-02 -7.177033e-02 -3.157895e-01 -3.157895e-01  6.028708e-01

H(I-H) Matrix
1             2             3             4             5             6
1  -2.387549e-16 -3.618144e-16 -3.855948e-16 -4.766153e-16 -5.051840e-16 -5.747762e-16
2  -1.031280e-16 -2.563854e-16 -3.174709e-16 -3.649348e-16 -4.245414e-16 -4.901136e-16
3  -8.576039e-17 -2.251274e-16 -2.814648e-16 -3.236089e-16 -4.021814e-16 -4.953042e-16
4  -5.498938e-18 -1.987055e-16 -1.939604e-16 -2.975017e-16 -3.698214e-16 -4.495644e-16
5   5.151316e-17 -1.306430e-16 -1.679632e-16 -2.590430e-16 -3.362382e-16 -4.033368e-16
6   1.160706e-16 -4.078972e-17 -1.218203e-16 -2.141299e-16 -2.925584e-16 -3.711089e-16
7   2.401499e-18 -3.302670e-16 -3.912562e-16 -5.923846e-16 -7.743894e-16 -9.154913e-16
8  -2.703291e-16 -3.891867e-16 -4.373938e-16 -4.638213e-16 -4.982170e-16 -5.866630e-16
9  -2.703291e-16 -3.891867e-16 -4.373938e-16 -4.638213e-16 -4.982170e-16 -5.866630e-16
10 -5.761717e-16 -4.344721e-16 -4.026993e-16 -3.420753e-16 -3.165110e-16 -2.179056e-16
11 -5.761717e-16 -4.344721e-16 -4.026993e-16 -3.420753e-16 -3.165110e-16 -2.179056e-16
12 -6.545026e-16 -4.756186e-16 -4.087861e-16 -3.301010e-16 -1.844838e-16 -1.177509e-16
7             8             9            10            11            12
1   5.513599e-16  1.400824e-16  1.400824e-16 -2.694908e-16 -2.694908e-16 -4.084499e-16
2   1.665335e-16  2.034496e-17  2.034496e-17 -1.245045e-16 -1.245045e-16 -1.813090e-16
3   6.959644e-17 -8.128577e-18 -8.128577e-18 -9.154471e-17 -9.154471e-17 -1.201414e-16
4  -1.181023e-16 -7.111813e-17 -7.111813e-17 -2.306878e-17 -2.306878e-17  2.990807e-18
5  -3.073283e-16 -1.323149e-16 -1.323149e-16  4.358112e-17  4.358112e-17  1.277166e-16
6  -5.077096e-16 -1.888635e-16 -1.888635e-16  1.306825e-16  1.306825e-16  2.133987e-16
7  -7.647098e-16 -7.656204e-16 -7.794982e-16 -7.873476e-16 -7.942865e-16 -8.074663e-16
8  -5.660103e-16 -6.778601e-16 -6.639824e-16 -7.619536e-16 -7.619536e-16 -7.986911e-16
9  -5.660103e-16 -6.778601e-16 -6.639824e-16 -7.619536e-16 -7.619536e-16 -7.986911e-16
10 -3.990000e-16 -5.823894e-16 -5.685116e-16 -7.796566e-16 -7.657788e-16 -7.984878e-16
11 -3.990000e-16 -5.823894e-16 -5.685116e-16 -7.796566e-16 -7.657788e-16 -7.984878e-16
12 -3.119182e-16 -5.227447e-16 -5.227447e-16 -7.543879e-16 -7.543879e-16 -8.333042e-16


### 3.Female=1,Male=2

Without iteraction terms

X matrix is
Sex Educ
1  1   2    5
2  1   2    9
3  1   2   10
4  1   2   12
5  1   2   14
6  1   2   16
7  1   1    8
8  1   1   11
9  1   1   11
10 1   1   14
11 1   1   14
12 1   1   15


Y matrix is
Sal
1  17.2
2  28.9
3  42.5
4  56.1
5  56.6
6  70.5
7  21.6
8  18.5
9  17.9
10 31.8
11 35.2
12 39.5


X'X is
Sex Educ
12  18  139
Sex   18  30  205
Educ 139 205 1725


X'Y is
Sal
436.3
Sex   708.1
Educ 5468.4


Beta matrix is
Sal
-47.872180
Sex   22.906316
Educ   4.305414


Yhat Matrix is
Sal
1  19.467519
2  36.689173
3  40.994586
4  49.605414
5  58.216241
6  66.827068
7   9.477444
8  22.393684
9  22.393684
10 35.309925
11 35.309925
12 39.615338


Error Matrix:
Sal
1  -2.2675188
2  -7.7891729
3   1.5054135
4   6.4945865
5  -1.6162406
6   3.6729323
7  12.1225564
8  -3.8936842
9  -4.4936842
10 -3.5099248
11 -0.1099248
12 -0.1153383


Test each β for H0: βi = 0
sse= 321.0168
sse/(n-p)=5.972313

The variance-Covariance Matrix
Sex         Educ
2.4373434 -0.64035088 -0.120300752
Sex  -0.6403509  0.34561404  0.010526316
Educ -0.1203008  0.01052632  0.009022556

The t-stat is
Sal
-5.134312
Sex   6.524045
Educ  7.589401

The p_value is
Sal
6.159917e-04
Sex  1.083812e-04
Educ 3.363518e-05
Since P-value's are less than α = 5%, so reject H0: βi = 0 i=0,1,2

The 95% CI is
Sal        Sal
-64.964074 -30.780287
Sex   16.470146  29.342486
Educ   3.265501   5.345326


H Matrix:
1           2           3           4            5           6
1   0.491478697  0.27493734  0.22080201  0.11253133  0.004260652 -0.10401003
2   0.274937343  0.20275689  0.18471178  0.14862155  0.112531328  0.07644110
3   0.220802005  0.18471178  0.17568922  0.15764411  0.139598997  0.12155388
4   0.112531328  0.14862155  0.15764411  0.17568922  0.193734336  0.21177945
5   0.004260652  0.11253133  0.13959900  0.19373434  0.247869674  0.30200501
6  -0.104010025  0.07644110  0.12155388  0.21177945  0.302005013  0.39223058
7   0.225563910  0.07518797  0.03759398 -0.03759398 -0.112781955 -0.18796992
8   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
9   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
10 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
11 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
12 -0.153383459 -0.05112782 -0.02556391  0.02556391  0.076691729  0.12781955
7           8           9          10          11          12
1   0.22556391  0.06315789  0.06315789 -0.09924812 -0.09924812 -0.15338346
2   0.07518797  0.02105263  0.02105263 -0.03308271 -0.03308271 -0.05112782
3   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
4  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
5  -0.11278195 -0.03157895 -0.03157895  0.04962406  0.04962406  0.07669173
6  -0.18796992 -0.05263158 -0.05263158  0.08270677  0.08270677  0.12781955
7   0.32330827  0.21052632  0.21052632  0.09774436  0.09774436  0.06015038
8   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
9   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
10  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
11  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
12  0.06015038  0.13684211  0.13684211  0.21353383  0.21353383  0.23909774


I-H matrix:
1           2           3           4            5           6
1   0.508521303 -0.27493734 -0.22080201 -0.11253133 -0.004260652  0.10401003
2  -0.274937343  0.79724311 -0.18471178 -0.14862155 -0.112531328 -0.07644110
3  -0.220802005 -0.18471178  0.82431078 -0.15764411 -0.139598997 -0.12155388
4  -0.112531328 -0.14862155 -0.15764411  0.82431078 -0.193734336 -0.21177945
5  -0.004260652 -0.11253133 -0.13959900 -0.19373434  0.752130326 -0.30200501
6   0.104010025 -0.07644110 -0.12155388 -0.21177945 -0.302005013  0.60776942
7  -0.225563910 -0.07518797 -0.03759398  0.03759398  0.112781955  0.18796992
8  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
9  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
10  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
11  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
12  0.153383459  0.05112782  0.02556391 -0.02556391 -0.076691729 -0.12781955
7           8           9          10          11          12
1  -0.22556391 -0.06315789 -0.06315789  0.09924812  0.09924812  0.15338346
2  -0.07518797 -0.02105263 -0.02105263  0.03308271  0.03308271  0.05112782
3  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
4   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
5   0.11278195  0.03157895  0.03157895 -0.04962406 -0.04962406 -0.07669173
6   0.18796992  0.05263158  0.05263158 -0.08270677 -0.08270677 -0.12781955
7   0.67669173 -0.21052632 -0.21052632 -0.09774436 -0.09774436 -0.06015038
8  -0.21052632  0.82105263 -0.17894737 -0.14736842 -0.14736842 -0.13684211
9  -0.21052632 -0.17894737  0.82105263 -0.14736842 -0.14736842 -0.13684211
10 -0.09774436 -0.14736842 -0.14736842  0.80300752 -0.19699248 -0.21353383
11 -0.09774436 -0.14736842 -0.14736842 -0.19699248  0.80300752 -0.21353383
12 -0.06015038 -0.13684211 -0.13684211 -0.21353383 -0.21353383  0.76090226


H(I-H) Matrix:
1            2            3             4             5             6
1   3.735263e-16 1.393361e-16 6.777831e-17 -4.411305e-17 -1.534019e-16 -2.479452e-16
2   2.149549e-16 1.737385e-16 1.651692e-16  1.241781e-16  1.248205e-16  1.076816e-16
3   1.851877e-16 1.817280e-16 1.783694e-16  1.664480e-16  1.935578e-16  2.033205e-16
4   9.529629e-17 2.098500e-16 2.214665e-16  2.516383e-16  3.219257e-16  3.668426e-16
5   2.291139e-17 2.086793e-16 2.674814e-16  3.599316e-16  4.766682e-16  5.673842e-16
6  -6.840130e-17 2.259194e-16 3.092574e-16  4.429735e-16  6.057463e-16  7.628802e-16
7   5.349513e-16 1.814823e-16 9.918650e-17 -6.605555e-17 -2.534153e-16 -4.110681e-16
8   4.144261e-16 2.093539e-16 1.617721e-16  5.966987e-17 -4.243212e-17 -1.393301e-16
9   4.144261e-16 2.093539e-16 1.617721e-16  5.966987e-17 -4.243212e-17 -1.393301e-16
10  2.869612e-16 2.372251e-16 2.226231e-16  1.882141e-16  1.685511e-16  1.237329e-16
11  2.869612e-16 2.372251e-16 2.226231e-16  1.882141e-16  1.685511e-16  1.237329e-16
12  2.398458e-16 2.508530e-16 2.388591e-16  2.322187e-16  2.273131e-16  2.172047e-16
7            8            9           10           11           12
1   4.517006e-16 2.847301e-16 2.847301e-16 1.212307e-16 1.212307e-16 4.975133e-17
2   2.362650e-16 2.023172e-16 2.023172e-16 1.852825e-16 1.835478e-16 1.804993e-16
3   1.764348e-16 1.808873e-16 1.791526e-16 1.911944e-16 1.903270e-16 2.018717e-16
4   5.915985e-17 1.397626e-16 1.414973e-16 2.212327e-16 2.203654e-16 2.515569e-16
5  -5.412541e-17 9.972881e-17 9.625937e-17 2.483789e-16 2.483789e-16 3.006357e-16
6  -1.541723e-16 5.030529e-17 5.030529e-17 2.808033e-16 2.773338e-16 3.611816e-16
7   6.266153e-16 3.671515e-16 3.602126e-16 1.107233e-16 1.089886e-16 2.402524e-17
8   4.668575e-16 3.058975e-16 3.128364e-16 1.536128e-16 1.640212e-16 1.089623e-16
9   4.668575e-16 3.058975e-16 3.128364e-16 1.536128e-16 1.640212e-16 1.089623e-16
10  2.737060e-16 2.394410e-16 2.394410e-16 2.034404e-16 2.034404e-16 1.800182e-16
11  2.737060e-16 2.394410e-16 2.394410e-16 2.034404e-16 2.034404e-16 1.800182e-16
12  2.405472e-16 2.219125e-16 2.219125e-16 2.223631e-16 2.223631e-16 2.083294e-16


Verify H and I-H

H*H matrix is
1           2           3           4            5           6
1   0.491478697  0.27493734  0.22080201  0.11253133  0.004260652 -0.10401003
2   0.274937343  0.20275689  0.18471178  0.14862155  0.112531328  0.07644110
3   0.220802005  0.18471178  0.17568922  0.15764411  0.139598997  0.12155388
4   0.112531328  0.14862155  0.15764411  0.17568922  0.193734336  0.21177945
5   0.004260652  0.11253133  0.13959900  0.19373434  0.247869674  0.30200501
6  -0.104010025  0.07644110  0.12155388  0.21177945  0.302005013  0.39223058
7   0.225563910  0.07518797  0.03759398 -0.03759398 -0.112781955 -0.18796992
8   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
9   0.063157895  0.02105263  0.01052632 -0.01052632 -0.031578947 -0.05263158
10 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
11 -0.099248120 -0.03308271 -0.01654135  0.01654135  0.049624060  0.08270677
12 -0.153383459 -0.05112782 -0.02556391  0.02556391  0.076691729  0.12781955
7           8           9          10          11          12
1   0.22556391  0.06315789  0.06315789 -0.09924812 -0.09924812 -0.15338346
2   0.07518797  0.02105263  0.02105263 -0.03308271 -0.03308271 -0.05112782
3   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
4  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
5  -0.11278195 -0.03157895 -0.03157895  0.04962406  0.04962406  0.07669173
6  -0.18796992 -0.05263158 -0.05263158  0.08270677  0.08270677  0.12781955
7   0.32330827  0.21052632  0.21052632  0.09774436  0.09774436  0.06015038
8   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
9   0.21052632  0.17894737  0.17894737  0.14736842  0.14736842  0.13684211
10  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
11  0.09774436  0.14736842  0.14736842  0.19699248  0.19699248  0.21353383
12  0.06015038  0.13684211  0.13684211  0.21353383  0.21353383  0.23909774


(I-H)*(I-H) matrix is
1           2           3           4            5           6
1   0.508521303 -0.27493734 -0.22080201 -0.11253133 -0.004260652  0.10401003
2  -0.274937343  0.79724311 -0.18471178 -0.14862155 -0.112531328 -0.07644110
3  -0.220802005 -0.18471178  0.82431078 -0.15764411 -0.139598997 -0.12155388
4  -0.112531328 -0.14862155 -0.15764411  0.82431078 -0.193734336 -0.21177945
5  -0.004260652 -0.11253133 -0.13959900 -0.19373434  0.752130326 -0.30200501
6   0.104010025 -0.07644110 -0.12155388 -0.21177945 -0.302005013  0.60776942
7  -0.225563910 -0.07518797 -0.03759398  0.03759398  0.112781955  0.18796992
8  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
9  -0.063157895 -0.02105263 -0.01052632  0.01052632  0.031578947  0.05263158
10  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
11  0.099248120  0.03308271  0.01654135 -0.01654135 -0.049624060 -0.08270677
12  0.153383459  0.05112782  0.02556391 -0.02556391 -0.076691729 -0.12781955
7           8           9          10          11          12
1  -0.22556391 -0.06315789 -0.06315789  0.09924812  0.09924812  0.15338346
2  -0.07518797 -0.02105263 -0.02105263  0.03308271  0.03308271  0.05112782
3  -0.03759398 -0.01052632 -0.01052632  0.01654135  0.01654135  0.02556391
4   0.03759398  0.01052632  0.01052632 -0.01654135 -0.01654135 -0.02556391
5   0.11278195  0.03157895  0.03157895 -0.04962406 -0.04962406 -0.07669173
6   0.18796992  0.05263158  0.05263158 -0.08270677 -0.08270677 -0.12781955
7   0.67669173 -0.21052632 -0.21052632 -0.09774436 -0.09774436 -0.06015038
8  -0.21052632  0.82105263 -0.17894737 -0.14736842 -0.14736842 -0.13684211
9  -0.21052632 -0.17894737  0.82105263 -0.14736842 -0.14736842 -0.13684211
10 -0.09774436 -0.14736842 -0.14736842  0.80300752 -0.19699248 -0.21353383
11 -0.09774436 -0.14736842 -0.14736842 -0.19699248  0.80300752 -0.21353383
12 -0.06015038 -0.13684211 -0.13684211 -0.21353383 -0.21353383  0.76090226



With iteraction terms

X matrix is
Sex Educ inter
1  1   2    5    10
2  1   2    9    18
3  1   2   10    20
4  1   2   12    24
5  1   2   14    28
6  1   2   16    32
7  1   1    8     8
8  1   1   11    11
9  1   1   11    11
10 1   1   14    14
11 1   1   14    14
12 1   1   15    15


Y matrix is
Sal
1  17.2
2  28.9
3  42.5
4  56.1
5  56.6
6  70.5
7  21.6
8  18.5
9  17.9
10 31.8
11 35.2
12 39.5


X'X is
Sex Educ inter
12  18  139   205
Sex    18  30  205   337
Educ  139 205 1725  2527
inter 205 337 2527  4131


X'Y is
Sal
436.3
Sex    708.1
Educ  5468.4
inter 8833.1

Beta matrix is
Sal
-7.6563397
Sex   -0.6527512
Educ   0.9398325
inter  1.9965311



Yhat Matrix is
Sal
1  15.70263
2  35.43421
3  40.36711
4  50.23289
5  60.09868
6  69.96447
7  15.18182
8  23.99091
9  23.99091
10 32.80000
11 32.80000
12 35.73636


Error Matrix:
Sal
1   1.4973684
2  -6.5342105
3   2.1328947
4   5.8671053
5  -3.4986842
6   0.5355263
7   6.4181818
8  -5.4909091
9  -6.0909091
10 -1.0000000
11  2.4000000
12  3.7636364


Test each β for H0: βi = 0
sse=225.8050
sse/(n-p)=5.31278
The variance-Covariance Matrix
Sex        Educ       inter
19.4238437 -10.5913078 -1.54186603  0.84330144
Sex   -10.5913078   6.1750399  0.84330144 -0.49401914
Educ   -1.5418660   0.8433014  0.12799043 -0.07057416
inter   0.8433014  -0.4940191 -0.07057416  0.04186603


The t-stat is
Sal
-0.32698798
Sex   -0.04944313
Educ   0.49446995
inter  1.83663721

The p_value is
Sal
0.7520685
Sex   0.9617783
Educ  0.6342655
inter 0.1035781
Since P-value's are all greater than α = 5%, so do not reject H0: βi = 0 i=0,1,2,3

The 95% CI is
Sal       Sal
-51.1971801 35.884501
Sex   -25.2026159 23.897114
Educ   -2.5945860  4.474251
inter  -0.0249054  4.017968


H Matrix:
1             2             3             4             5             6
1   6.403509e-01  3.245614e-01  2.456140e-01  8.771930e-02 -7.017544e-02 -2.280702e-01
2   3.245614e-01  2.192982e-01  1.929825e-01  1.403509e-01  8.771930e-02  3.508772e-02
3   2.456140e-01  1.929825e-01  1.798246e-01  1.535088e-01  1.271930e-01  1.008772e-01
4   8.771930e-02  1.403509e-01  1.535088e-01  1.798246e-01  2.061404e-01  2.324561e-01
5  -7.017544e-02  8.771930e-02  1.271930e-01  2.061404e-01  2.850877e-01  3.640351e-01
6  -2.280702e-01  3.508772e-02  1.008772e-01  2.324561e-01  3.640351e-01  4.956140e-01
7  -5.329071e-15 -3.996803e-15 -3.552714e-15 -3.108624e-15 -2.664535e-15 -1.776357e-15
8  -3.483325e-15 -2.872702e-15 -2.747802e-15 -2.386980e-15 -2.026157e-15 -1.776357e-15
9  -3.483325e-15 -2.872702e-15 -2.747802e-15 -2.386980e-15 -2.026157e-15 -1.776357e-15
10 -1.526557e-15 -1.637579e-15 -1.720846e-15 -1.665335e-15 -1.609823e-15 -1.776357e-15
11 -1.526557e-15 -1.637579e-15 -1.720846e-15 -1.665335e-15 -1.609823e-15 -1.776357e-15
12 -4.996004e-16 -1.054712e-15 -1.221245e-15 -1.554312e-15 -1.887379e-15 -1.776357e-15
7             8             9            10            11            12
1  -2.775558e-15 -2.206568e-15 -2.206568e-15 -1.637579e-15 -1.637579e-15 -1.373901e-15
2  -1.110223e-16  5.134781e-16  5.134781e-16  1.137979e-15  1.137979e-15  1.346145e-15
3  -1.998401e-15 -2.081668e-15 -2.081668e-15 -2.164935e-15 -2.164935e-15 -2.192690e-15
4   4.440892e-16  6.106227e-16  6.106227e-16  7.771561e-16  7.771561e-16  8.326673e-16
5  -1.554312e-15 -2.137179e-15 -2.137179e-15 -2.720046e-15 -2.720046e-15 -2.914335e-15
6   0.000000e+00 -6.661338e-16 -6.661338e-16 -1.332268e-15 -1.332268e-15 -1.554312e-15
7   6.650718e-01  3.062201e-01  3.062201e-01 -5.263158e-02 -5.263158e-02 -1.722488e-01
8   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
9   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
10 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
11 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
12 -1.722488e-01  7.177033e-02  7.177033e-02  3.157895e-01  3.157895e-01  3.971292e-01


I-H matrix:
1             2             3             4             5             6
1   3.596491e-01 -3.245614e-01 -2.456140e-01 -8.771930e-02  7.017544e-02  2.280702e-01
2  -3.245614e-01  7.807018e-01 -1.929825e-01 -1.403509e-01 -8.771930e-02 -3.508772e-02
3  -2.456140e-01 -1.929825e-01  8.201754e-01 -1.535088e-01 -1.271930e-01 -1.008772e-01
4  -8.771930e-02 -1.403509e-01 -1.535088e-01  8.201754e-01 -2.061404e-01 -2.324561e-01
5   7.017544e-02 -8.771930e-02 -1.271930e-01 -2.061404e-01  7.149123e-01 -3.640351e-01
6   2.280702e-01 -3.508772e-02 -1.008772e-01 -2.324561e-01 -3.640351e-01  5.043860e-01
7   5.329071e-15  3.996803e-15  3.552714e-15  3.108624e-15  2.664535e-15  1.776357e-15
8   3.483325e-15  2.872702e-15  2.747802e-15  2.386980e-15  2.026157e-15  1.776357e-15
9   3.483325e-15  2.872702e-15  2.747802e-15  2.386980e-15  2.026157e-15  1.776357e-15
10  1.526557e-15  1.637579e-15  1.720846e-15  1.665335e-15  1.609823e-15  1.776357e-15
11  1.526557e-15  1.637579e-15  1.720846e-15  1.665335e-15  1.609823e-15  1.776357e-15
12  4.996004e-16  1.054712e-15  1.221245e-15  1.554312e-15  1.887379e-15  1.776357e-15
7             8             9            10            11            12
1   2.775558e-15  2.206568e-15  2.206568e-15  1.637579e-15  1.637579e-15  1.373901e-15
2   1.110223e-16 -5.134781e-16 -5.134781e-16 -1.137979e-15 -1.137979e-15 -1.346145e-15
3   1.998401e-15  2.081668e-15  2.081668e-15  2.164935e-15  2.164935e-15  2.192690e-15
4  -4.440892e-16 -6.106227e-16 -6.106227e-16 -7.771561e-16 -7.771561e-16 -8.326673e-16
5   1.554312e-15  2.137179e-15  2.137179e-15  2.720046e-15  2.720046e-15  2.914335e-15
6   0.000000e+00  6.661338e-16  6.661338e-16  1.332268e-15  1.332268e-15  1.554312e-15
7   3.349282e-01 -3.062201e-01 -3.062201e-01  5.263158e-02  5.263158e-02  1.722488e-01
8  -3.062201e-01  7.942584e-01 -2.057416e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
9  -3.062201e-01 -2.057416e-01  7.942584e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
10  5.263158e-02 -1.052632e-01 -1.052632e-01  7.368421e-01 -2.631579e-01 -3.157895e-01
11  5.263158e-02 -1.052632e-01 -1.052632e-01 -2.631579e-01  7.368421e-01 -3.157895e-01
12  1.722488e-01 -7.177033e-02 -7.177033e-02 -3.157895e-01 -3.157895e-01  6.028708e-01


H(I-H) Matrix:
1             2             3             4             5             6
1  9.854110e-16 -1.665216e-16 -4.228456e-16 -1.077741e-15 -1.684064e-15 -2.241818e-15
2  1.232640e-15  3.535829e-16  1.024311e-16 -2.905848e-16 -6.744940e-16 -1.136466e-15
3  1.269028e-15  4.726120e-16  2.770857e-16 -8.013948e-17 -4.512416e-16 -8.743853e-16
4  1.359759e-15  7.541448e-16  5.953676e-16  3.055722e-16  1.230569e-17 -3.087130e-16
5  1.455236e-15  1.022370e-15  9.063456e-16  6.742992e-16  4.630763e-16  2.518466e-16
6  1.552910e-15  1.289591e-15  1.214222e-15  1.091236e-15  9.335523e-16  8.175155e-16
7  5.364573e-15  4.090738e-15  3.815838e-15  3.072679e-15  2.329521e-15  1.856215e-15
8  3.438991e-15  2.819603e-15  2.628103e-15  2.399684e-15  2.171265e-15  1.756392e-15
9  3.438991e-15  2.819603e-15  2.628103e-15  2.399684e-15  2.171265e-15  1.756392e-15
10 1.447185e-15  1.575738e-15  1.602032e-15  1.713055e-15  1.824077e-15  1.736428e-15
11 1.447185e-15  1.575738e-15  1.602032e-15  1.713055e-15  1.824077e-15  1.736428e-15
12 8.059741e-16  1.197474e-15  1.336783e-15  1.382732e-15  1.428682e-15  1.975028e-15
7            8            9           10           11           12
1   2.168919e-15 1.396831e-15 1.396831e-15 6.247439e-16 6.247439e-16 3.940008e-16
2   1.384857e-15 1.130431e-15 1.130431e-15 8.760049e-16 8.760049e-16 7.671738e-16
3   1.192029e-15 1.062503e-15 1.062503e-15 9.329769e-16 9.329769e-16 8.716225e-16
4   8.063725e-16 9.266467e-16 9.266467e-16 1.046921e-15 1.046921e-15 1.080520e-15
5   4.207161e-16 7.907904e-16 7.907904e-16 1.160865e-15 1.160865e-15 1.289417e-15
6   3.505967e-17 6.549342e-16 6.549342e-16 1.274809e-15 1.274809e-15 1.498314e-15
7  -4.704956e-15 4.400624e-16 4.470013e-16 5.661409e-15 5.661409e-15 7.302542e-15
8   4.381041e-16 2.091473e-15 2.077595e-15 3.654635e-15 3.654635e-15 4.266271e-15
9   4.381041e-16 2.091473e-15 2.077595e-15 3.654635e-15 3.654635e-15 4.266271e-15
10  5.633721e-15 3.682242e-15 3.682242e-15 1.772400e-15 1.772400e-15 1.091290e-15
11  5.633721e-15 3.682242e-15 3.682242e-15 1.772400e-15 1.772400e-15 1.091290e-15
12  7.362105e-15 4.227492e-15 4.227492e-15 1.092876e-15 1.092876e-15 7.944491e-17


Verify H and I-H

H*H matrix is
1             2             3             4             5             6
1   6.403509e-01  3.245614e-01  2.456140e-01  8.771930e-02 -7.017544e-02 -2.280702e-01
2   3.245614e-01  2.192982e-01  1.929825e-01  1.403509e-01  8.771930e-02  3.508772e-02
3   2.456140e-01  1.929825e-01  1.798246e-01  1.535088e-01  1.271930e-01  1.008772e-01
4   8.771930e-02  1.403509e-01  1.535088e-01  1.798246e-01  2.061404e-01  2.324561e-01
5  -7.017544e-02  8.771930e-02  1.271930e-01  2.061404e-01  2.850877e-01  3.640351e-01
6  -2.280702e-01  3.508772e-02  1.008772e-01  2.324561e-01  3.640351e-01  4.956140e-01
7  -1.069364e-14 -8.087541e-15 -7.368552e-15 -6.181304e-15 -4.994056e-15 -3.632572e-15
8  -6.922316e-15 -5.692306e-15 -5.375905e-15 -4.786664e-15 -4.197422e-15 -3.532749e-15
9  -6.922316e-15 -5.692306e-15 -5.375905e-15 -4.786664e-15 -4.197422e-15 -3.532749e-15
10 -2.973742e-15 -3.213317e-15 -3.322878e-15 -3.378389e-15 -3.433900e-15 -3.512785e-15
11 -2.973742e-15 -3.213317e-15 -3.322878e-15 -3.378389e-15 -3.433900e-15 -3.512785e-15
12 -1.305574e-15 -2.252186e-15 -2.558028e-15 -2.937045e-15 -3.316061e-15 -3.751385e-15
7             8             9            10            11            12
1  -4.944477e-15 -3.603400e-15 -3.603400e-15 -2.262323e-15 -2.262323e-15 -1.767902e-15
2  -1.495879e-15 -6.169529e-16 -6.169529e-16  2.619737e-16  2.619737e-16  5.789716e-16
3  -3.190430e-15 -3.144171e-15 -3.144171e-15 -3.097912e-15 -3.097912e-15 -3.064313e-15
4  -3.622833e-16 -3.160240e-16 -3.160240e-16 -2.697647e-16 -2.697647e-16 -2.478524e-16
5  -1.975028e-15 -2.927970e-15 -2.927970e-15 -3.880911e-15 -3.880911e-15 -4.203752e-15
6  -3.505967e-17 -1.321068e-15 -1.321068e-15 -2.607076e-15 -2.607076e-15 -3.052626e-15
7   6.650718e-01  3.062201e-01  3.062201e-01 -5.263158e-02 -5.263158e-02 -1.722488e-01
8   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
9   3.062201e-01  2.057416e-01  2.057416e-01  1.052632e-01  1.052632e-01  7.177033e-02
10 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
11 -5.263158e-02  1.052632e-01  1.052632e-01  2.631579e-01  2.631579e-01  3.157895e-01
12 -1.722488e-01  7.177033e-02  7.177033e-02  3.157895e-01  3.157895e-01  3.971292e-01


(I-H)*(I-H) is
1             2             3             4             5             6
1   3.596491e-01 -3.245614e-01 -2.456140e-01 -8.771930e-02  7.017544e-02  2.280702e-01
2  -3.245614e-01  7.807018e-01 -1.929825e-01 -1.403509e-01 -8.771930e-02 -3.508772e-02
3  -2.456140e-01 -1.929825e-01  8.201754e-01 -1.535088e-01 -1.271930e-01 -1.008772e-01
4  -8.771930e-02 -1.403509e-01 -1.535088e-01  8.201754e-01 -2.061404e-01 -2.324561e-01
5   7.017544e-02 -8.771930e-02 -1.271930e-01 -2.061404e-01  7.149123e-01 -3.640351e-01
6   2.280702e-01 -3.508772e-02 -1.008772e-01 -2.324561e-01 -3.640351e-01  5.043860e-01
7  -3.550235e-17 -9.393514e-17 -2.631246e-16  3.594502e-17  3.350147e-16 -7.985815e-17
8   4.433367e-17  5.309859e-17  1.196987e-16 -1.270471e-17 -1.451081e-16  1.996454e-17
9   4.433367e-17  5.309859e-17  1.196987e-16 -1.270471e-17 -1.451081e-16  1.996454e-17
10  7.937121e-17  6.184137e-17  1.188133e-16 -4.772011e-17 -2.142536e-16  3.992907e-17
11  7.937121e-17  6.184137e-17  1.188133e-16 -4.772011e-17 -2.142536e-16  3.992907e-17
12 -3.063737e-16 -1.427619e-16 -1.155376e-16  1.715799e-16  4.586974e-16 -1.986715e-16
7             8             9            10            11            12
1   6.066386e-16  8.097368e-16  8.097368e-16  1.012835e-15  1.012835e-15  9.799002e-16
2  -1.273835e-15 -1.643909e-15 -1.643909e-15 -2.013984e-15 -2.013984e-15 -2.113319e-15
3   8.063725e-16  1.019165e-15  1.019165e-15  1.231958e-15  1.231958e-15  1.321068e-15
4  -1.250462e-15 -1.537269e-15 -1.537269e-15 -1.824077e-15 -1.824077e-15 -1.913187e-15
5   1.133596e-15  1.346389e-15  1.346389e-15  1.559182e-15  1.559182e-15  1.624919e-15
6  -3.505967e-17  1.119962e-17  1.119962e-17  5.745891e-17  5.745891e-17  5.599809e-17
7   3.349282e-01 -3.062201e-01 -3.062201e-01  5.263158e-02  5.263158e-02  1.722488e-01
8  -3.062201e-01  7.942584e-01 -2.057416e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
9  -3.062201e-01 -2.057416e-01  7.942584e-01 -1.052632e-01 -1.052632e-01 -7.177033e-02
10  5.263158e-02 -1.052632e-01 -1.052632e-01  7.368421e-01 -2.631579e-01 -3.157895e-01
11  5.263158e-02 -1.052632e-01 -1.052632e-01 -2.631579e-01  7.368421e-01 -3.157895e-01
12  1.722488e-01 -7.177033e-02 -7.177033e-02 -3.157895e-01 -3.157895e-01  6.028708e-01


## Question 2

Under the BM
Since $\hat\beta=(X'X)^{-1}X'Y$
$E[\hat\beta] = E[(X'X)^{-1}X'Y] = (X'X)^{-1}X'E[Y] = (X'X)^{-1}X'X\beta = \beta$
$Var[\hat\beta] = (X'X)^{-1}X'Var[Y]X(X'X)^{-1} = \sigma^2(X'X)^{-1}X'X(X'X)^{-1} = \sigma^2(X'X)^{-1}$
So, $\beta\sim(\beta,\sigma^2(X'X)^{-1})$

Under the BNM, the error terms ε are normally distributed,  and  Y = Xβ + ε , so Y is also multivariate normal distribution.
Furthermore, with the same argument, $\hat\beta$ is a linear combination of Y, so $\beta\sim MVN(\beta,\sigma^2(X'X)^{-1})$


## Question 3

$Cov(\hat\beta,\epsilon)$

= Cov((X'X) − 1X'Y,(I − H)Y)

= (X'X) − 1X'cov(Y,Y)(I − H)'

= σ2(X'X) − 1X' * (I − H)

= σ2((X'X) − 1X' * I − (X'X) − 1X' * X(X'X) − 1X')

= σ2((X'X) − 1X' − (X'X) − 1X')

= 0