# Bion 9.5b

## Question

p.214-215

Matrix computations using Canadian data for the regression of occupational prestige on income, education, and percentage of women (in prestige.dat):18

(b) verify that the least-squares slope coeffients b1 = [B1, B2, B3]' can be computed as $\ b_1 = (X^{*'} X^{*})^{-1} X^{*'}y^{*}$, where X* and y* contain mean deviations fro the X's and Y, respectively.

> library(car)

> data(Prestige)

> attach(Prestige)

> Prestige

> fit <- lm(prestige ~ income + education + women)

> summary (fit)

Call: lm(formula = prestige ~ income + education + women)

Residuals:

```   Min       1Q   Median       3Q      Max
-19.8246  -5.3332  -0.1364   5.1587  17.5045
```

Coefficients:

```             Estimate Std. Error t value Pr(>|t|)
(Intercept) -6.7943342  3.2390886  -2.098   0.0385 *
income       0.0013136  0.0002778   4.729 7.58e-06 ***
education    4.1866373  0.3887013  10.771  < 2e-16 ***
women       -0.0089052  0.0304071  -0.293   0.7702
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
```
```Residual standard error: 7.846 on 98 degrees of freedom
Multiple R-Squared: 0.7982,     Adjusted R-squared: 0.792
F-statistic: 129.2 on 3 and 98 DF,  p-value: < 2.2e-16
```

> y <- Prestige\$prestige

> x <- model.matrix (y~income+education+women)

> xpx <- t(x) %*% x

> xpy <- t(x) %*% y

> b <- solve(xpx, xpy)

> b

```                   [,1]
(Intercept) -6.794334203
income       0.001313560
education    4.186637275
women       -0.008905157
```

Need to find the means of all three x variables, income, education & women:

> mean(income)

[1] 6797.902

> mean(education)

[1] 10.73804

> mean(women)

[1] 28.97902

Take y (prestige variable) and subtract it from the mean of the dependent y variable, prestige:

> ystar<-y-mean(y)

> ystar

``` [1]  21.9666667  22.2666667  16.5666667   9.9666667  26.6666667  30.7666667
[7]  25.7666667  31.2666667  26.2666667  21.9666667  15.1666667  13.1666667
[13]   6.9666667  15.3666667  28.0666667   8.2666667  35.4666667  11.2666667
[19]  11.4666667  25.9666667  37.7666667  12.7666667  19.2666667  40.3666667
[25]  19.8666667  21.5666667  17.8666667 -11.9333333  25.2666667  22.4666667
[31]  20.6666667  10.3666667  10.7666667   7.2666667  -0.8333333  -4.9333333
[37]   2.5666667  -4.5333333   0.8666667 -15.9333333 -14.1333333  -8.1333333
[43] -10.7333333  -9.6333333  -8.7333333 -17.4333333   4.2666667 -11.1333333
[49] -11.2333333  -5.3333333  -6.6333333 -20.3333333 -32.0333333 -23.5333333
[55]   0.4666667   0.2666667   4.2666667  -3.3333333   4.7666667 -17.1333333
[61] -26.6333333   8.0666667 -20.9333333 -26.0333333 -29.5333333 -26.7333333
[67]  -2.7333333 -25.3333333 -11.5333333  -7.9333333 -21.6333333 -12.0333333
[73] -23.6333333 -13.5333333 -18.0333333  -4.3333333  -2.6333333 -10.9333333
[79]  -5.0333333 -10.9333333  -3.1333333   3.9666667  -9.6333333 -18.6333333
[85]  -8.7333333   3.4666667 -19.5333333  -5.9333333   3.3666667   4.2666667
[91]  -7.9333333 -10.6333333 -16.9333333  -3.9333333 -20.3333333  19.2666667
[97]   2.0666667 -10.9333333 -21.7333333 -20.7333333  -4.6333333 -11.6333333
```

Next, we must combine the 3 x variables into a matrix and then subtract the x's from the corresponding x means (also in matrix form):

> X<-cbind (income,education,women)

> X

```      income education women
[1,]  12351     13.11 11.16
[2,]  25879     12.26  4.02
[3,]   9271     12.77 15.70
[4,]   8865     11.42  9.11
[5,]   8403     14.62 11.68
[6,]  11030     15.64  5.13
[7,]   8258     15.09 25.65
[8,]  14163     15.44  2.69
[9,]  11377     14.52  1.03
[10,]  11023     14.64  0.94
[11,]   5902     12.39  1.91
[12,]   7059     12.30  7.83
[13,]   8425     13.83 15.33
[14,]   8049     14.44 57.31
[15,]   7405     14.36 48.28
[16,]   6336     14.21 54.77
[17,]  19263     15.77  5.13
[18,]   6112     14.15 77.10
[19,]   9593     15.22 34.89
[20,]   4686     14.50  4.14
[21,]  12480     15.97 19.59
[22,]   5648     13.62 83.78
[23,]   8034     15.08 46.80
[24,]  25308     15.96 10.56
[25,]  14558     15.94  4.32
[26,]  17498     14.71  6.91
[27,]   4614     12.46 96.12
[28,]   3485      9.45 76.14
[29,]   5092     13.62 82.66
[30,]  10432     15.21 24.71
[31,]   5180     12.79 76.04
[32,]   6197     11.09 21.03
[33,]   7562     12.71 11.15
[34,]   8206     11.44  8.13
[35,]   4036     11.59 97.51
[36,]   3148     11.49 95.97
[37,]   4348     11.32 68.24
[38,]   2448     10.64 91.76
[39,]   4330     11.36 75.92
[40,]   4761      9.17 11.37
[41,]   3016     12.09 83.19
[42,]   2901     11.04 92.86
[43,]   5511      9.22  7.62
[44,]   3739     10.07 52.27
[45,]   3161     10.51 96.14
[46,]   4741     11.20 47.06
[47,]   5052     11.13 56.10
[48,]   6259     11.43 39.17
[49,]   4075     11.00 63.23
[50,]   7482      9.84 17.04
[51,]   8780     11.13  3.16
[52,]   2594     10.05 67.82
[53,]    918      9.62  7.00
[54,]   2370      9.93  3.69
[55,]   8131     11.60 13.09
[56,]   6992     11.09 24.44
[57,]   7956     11.03 23.88
[58,]   8895      9.47  0.00
[59,]   8891     10.93  1.65
[60,]   3116      7.74 52.00
[61,]   3930      8.50 15.51
[62,]   7869     10.57  6.01
[63,]    611      9.46 96.53
[64,]   3000      7.33 69.31
[65,]   3472      7.11 33.57
[66,]   3582      7.58 30.08
[67,]   3643      6.84  3.60
[68,]   1656      8.60 27.75
[69,]   6860      8.88  0.00
[70,]   4199      7.54 33.30
[71,]   5134      7.64 17.26
[72,]   5134      7.64 17.26
[73,]   1890      7.42 72.24
[74,]   4443      6.69 31.36
[75,]   3485      6.74 39.48
[76,]   8043     10.09  1.50
[77,]   6686      8.81  4.28
[78,]   6565      8.40  2.30
[79,]   6477      7.92  5.17
[80,]   5811      8.43 13.62
[81,]   6573      8.78  5.78
[82,]   3942      8.76 74.54
[83,]   5449     10.29  2.92
[84,]   2847      6.38 90.67
[85,]   5795      8.10  0.81
[86,]   7716     10.10  0.78
[87,]   4696      6.67  0.00
[88,]   8316      9.05  1.34
[89,]   7147      9.93  0.99
[90,]   8880      8.24  0.65
[91,]   5299      6.92  0.56
[92,]   5959      6.60  0.52
[93,]   4549      7.81  2.46
[94,]   6928      8.33  0.61
[95,]   3910      7.52  1.09
[96,]  14032     12.27  0.58
[97,]   8845      8.49  0.00
[98,]   5562      7.58  9.47
[99,]   4224      7.93  3.59
[100,]   4753      8.37  0.00
[101,]   6462     10.00 13.58
[102,]   3617      8.55 70.87
```

> Xmean<-cbind(mean (income), mean(education), mean(women))

``` > Xmean
[,1]     [,2]     [,3]
[1,]    6797.902 10.73804 28.97902
```

> womenmean<-matrix(Xmean[3],nrow=102,ncol=1)

> educationmean<-matrix(Xmean[2],nrow=102, ncol=1)

> incomemean<-matrix(Xmean[1],nrow=102,ncol=1)

> incomemean

```          [,1]
[1,] 6797.902
[2,] 6797.902
[3,] 6797.902
[4,] 6797.902
[5,] 6797.902
[6,] 6797.902
[7,] 6797.902
[8,] 6797.902
[9,] 6797.902
[10,] 6797.902
[11,] 6797.902
[12,] 6797.902
[13,] 6797.902
[14,] 6797.902
[15,] 6797.902
[16,] 6797.902
[17,] 6797.902
[18,] 6797.902
[19,] 6797.902
[20,] 6797.902
[21,] 6797.902
[22,] 6797.902
[23,] 6797.902
[24,] 6797.902
[25,] 6797.902
[26,] 6797.902
[27,] 6797.902
[28,] 6797.902
[29,] 6797.902
[30,] 6797.902
[31,] 6797.902
[32,] 6797.902
[33,] 6797.902
[34,] 6797.902
[35,] 6797.902
[36,] 6797.902
[37,] 6797.902
[38,] 6797.902
[39,] 6797.902
[40,] 6797.902
[41,] 6797.902
[42,] 6797.902
[43,] 6797.902
[44,] 6797.902
[45,] 6797.902
[46,] 6797.902
[47,] 6797.902
[48,] 6797.902
[49,] 6797.902
[50,] 6797.902
[51,] 6797.902
[52,] 6797.902
[53,] 6797.902
[54,] 6797.902
[55,] 6797.902
[56,] 6797.902
[57,] 6797.902
[58,] 6797.902
[59,] 6797.902
[60,] 6797.902
[61,] 6797.902
[62,] 6797.902
[63,] 6797.902
[64,] 6797.902
[65,] 6797.902
[66,] 6797.902
[67,] 6797.902
[68,] 6797.902
[69,] 6797.902
[70,] 6797.902
[71,] 6797.902
[72,] 6797.902
[73,] 6797.902
[74,] 6797.902
[75,] 6797.902
[76,] 6797.902
[77,] 6797.902
[78,] 6797.902
[79,] 6797.902
[80,] 6797.902
[81,] 6797.902
[82,] 6797.902
[83,] 6797.902
[84,] 6797.902
[85,] 6797.902
[86,] 6797.902
[87,] 6797.902
[88,] 6797.902
[89,] 6797.902
[90,] 6797.902
[91,] 6797.902
[92,] 6797.902
[93,] 6797.902
[94,] 6797.902
[95,] 6797.902
[96,] 6797.902
[97,] 6797.902
[98,] 6797.902
[99,] 6797.902
[100,] 6797.902
[101,] 6797.902
[102,] 6797.902
```

> educationmean

```          [,1]
[1,] 10.73804
[2,] 10.73804
[3,] 10.73804
[4,] 10.73804
[5,] 10.73804
[6,] 10.73804
[7,] 10.73804
[8,] 10.73804
[9,] 10.73804
[10,] 10.73804
[11,] 10.73804
[12,] 10.73804
[13,] 10.73804
[14,] 10.73804
[15,] 10.73804
[16,] 10.73804
[17,] 10.73804
[18,] 10.73804
[19,] 10.73804
[20,] 10.73804
[21,] 10.73804
[22,] 10.73804
[23,] 10.73804
[24,] 10.73804
[25,] 10.73804
[26,] 10.73804
[27,] 10.73804
[28,] 10.73804
[29,] 10.73804
[30,] 10.73804
[31,] 10.73804
[32,] 10.73804
[33,] 10.73804
[34,] 10.73804
[35,] 10.73804
[36,] 10.73804
[37,] 10.73804
[38,] 10.73804
[39,] 10.73804
[40,] 10.73804
[41,] 10.73804
[42,] 10.73804
[43,] 10.73804
[44,] 10.73804
[45,] 10.73804
[46,] 10.73804
[47,] 10.73804
[48,] 10.73804
[49,] 10.73804
[50,] 10.73804
[51,] 10.73804
[52,] 10.73804
[53,] 10.73804
[54,] 10.73804
[55,] 10.73804
[56,] 10.73804
[57,] 10.73804
[58,] 10.73804
[59,] 10.73804
[60,] 10.73804
[61,] 10.73804
[62,] 10.73804
[63,] 10.73804
[64,] 10.73804
[65,] 10.73804
[66,] 10.73804
[67,] 10.73804
[68,] 10.73804
[69,] 10.73804
[70,] 10.73804
[71,] 10.73804
[72,] 10.73804
[73,] 10.73804
[74,] 10.73804
[75,] 10.73804
[76,] 10.73804
[77,] 10.73804
[78,] 10.73804
[79,] 10.73804
[80,] 10.73804
[81,] 10.73804
[82,] 10.73804
[83,] 10.73804
[84,] 10.73804
[85,] 10.73804
[86,] 10.73804
[87,] 10.73804
[88,] 10.73804
[89,] 10.73804
[90,] 10.73804
[91,] 10.73804
[92,] 10.73804
[93,] 10.73804
[94,] 10.73804
[95,] 10.73804
[96,] 10.73804
[97,] 10.73804
[98,] 10.73804
[99,] 10.73804
[100,] 10.73804
[101,] 10.73804
[102,] 10.73804
```

> womenmean

```          [,1]
[1,] 28.97902
[2,] 28.97902
[3,] 28.97902
[4,] 28.97902
[5,] 28.97902
[6,] 28.97902
[7,] 28.97902
[8,] 28.97902
[9,] 28.97902
[10,] 28.97902
[11,] 28.97902
[12,] 28.97902
[13,] 28.97902
[14,] 28.97902
[15,] 28.97902
[16,] 28.97902
[17,] 28.97902
[18,] 28.97902
[19,] 28.97902
[20,] 28.97902
[21,] 28.97902
[22,] 28.97902
[23,] 28.97902
[24,] 28.97902
[25,] 28.97902
[26,] 28.97902
[27,] 28.97902
[28,] 28.97902
[29,] 28.97902
[30,] 28.97902
[31,] 28.97902
[32,] 28.97902
[33,] 28.97902
[34,] 28.97902
[35,] 28.97902
[36,] 28.97902
[37,] 28.97902
[38,] 28.97902
[39,] 28.97902
[40,] 28.97902
[41,] 28.97902
[42,] 28.97902
[43,] 28.97902
[44,] 28.97902
[45,] 28.97902
[46,] 28.97902
[47,] 28.97902
[48,] 28.97902
[49,] 28.97902
[50,] 28.97902
[51,] 28.97902
[52,] 28.97902
[53,] 28.97902
[54,] 28.97902
[55,] 28.97902
[56,] 28.97902
[57,] 28.97902
[58,] 28.97902
[59,] 28.97902
[60,] 28.97902
[61,] 28.97902
[62,] 28.97902
[63,] 28.97902
[64,] 28.97902
[65,] 28.97902
[66,] 28.97902
[67,] 28.97902
[68,] 28.97902
[69,] 28.97902
[70,] 28.97902
[71,] 28.97902
[72,] 28.97902
[73,] 28.97902
[74,] 28.97902
[75,] 28.97902
[76,] 28.97902
[77,] 28.97902
[78,] 28.97902
[79,] 28.97902
[80,] 28.97902
[81,] 28.97902
[82,] 28.97902
[83,] 28.97902
[84,] 28.97902
[85,] 28.97902
[86,] 28.97902
[87,] 28.97902
[88,] 28.97902
[89,] 28.97902
[90,] 28.97902
[91,] 28.97902
[92,] 28.97902
[93,] 28.97902
[94,] 28.97902
[95,] 28.97902
[96,] 28.97902
[97,] 28.97902
[98,] 28.97902
[99,] 28.97902
[100,] 28.97902
[101,] 28.97902
[102,] 28.97902
```

> Xmeanmatrix=matrix(c(incomemean, educationmean,womenmean),ncol=3)

> Xmeanmatrix

```   [,1]     [,2]     [,3]
[1,] 6797.902 10.73804 28.97902
[2,] 6797.902 10.73804 28.97902
[3,] 6797.902 10.73804 28.97902
[4,] 6797.902 10.73804 28.97902
[5,] 6797.902 10.73804 28.97902
[6,] 6797.902 10.73804 28.97902
[7,] 6797.902 10.73804 28.97902
[8,] 6797.902 10.73804 28.97902
[9,] 6797.902 10.73804 28.97902
[10,] 6797.902 10.73804 28.97902
[11,] 6797.902 10.73804 28.97902
[12,] 6797.902 10.73804 28.97902
[13,] 6797.902 10.73804 28.97902
[14,] 6797.902 10.73804 28.97902
[15,] 6797.902 10.73804 28.97902
[16,] 6797.902 10.73804 28.97902
[17,] 6797.902 10.73804 28.97902
[18,] 6797.902 10.73804 28.97902
[19,] 6797.902 10.73804 28.97902
[20,] 6797.902 10.73804 28.97902
[21,] 6797.902 10.73804 28.97902
[22,] 6797.902 10.73804 28.97902
[23,] 6797.902 10.73804 28.97902
[24,] 6797.902 10.73804 28.97902
[25,] 6797.902 10.73804 28.97902
[26,] 6797.902 10.73804 28.97902
[27,] 6797.902 10.73804 28.97902
[28,] 6797.902 10.73804 28.97902
[29,] 6797.902 10.73804 28.97902
[30,] 6797.902 10.73804 28.97902
[31,] 6797.902 10.73804 28.97902
[32,] 6797.902 10.73804 28.97902
[33,] 6797.902 10.73804 28.97902
[34,] 6797.902 10.73804 28.97902
[35,] 6797.902 10.73804 28.97902
[36,] 6797.902 10.73804 28.97902
[37,] 6797.902 10.73804 28.97902
[38,] 6797.902 10.73804 28.97902
[39,] 6797.902 10.73804 28.97902
[40,] 6797.902 10.73804 28.97902
[41,] 6797.902 10.73804 28.97902
[42,] 6797.902 10.73804 28.97902
[43,] 6797.902 10.73804 28.97902
[44,] 6797.902 10.73804 28.97902
[45,] 6797.902 10.73804 28.97902
[46,] 6797.902 10.73804 28.97902
[47,] 6797.902 10.73804 28.97902
[48,] 6797.902 10.73804 28.97902
[49,] 6797.902 10.73804 28.97902
[50,] 6797.902 10.73804 28.97902
[51,] 6797.902 10.73804 28.97902
[52,] 6797.902 10.73804 28.97902
[53,] 6797.902 10.73804 28.97902
[54,] 6797.902 10.73804 28.97902
[55,] 6797.902 10.73804 28.97902
[56,] 6797.902 10.73804 28.97902
[57,] 6797.902 10.73804 28.97902
[58,] 6797.902 10.73804 28.97902
[59,] 6797.902 10.73804 28.97902
[60,] 6797.902 10.73804 28.97902
[61,] 6797.902 10.73804 28.97902
[62,] 6797.902 10.73804 28.97902
[63,] 6797.902 10.73804 28.97902
[64,] 6797.902 10.73804 28.97902
[65,] 6797.902 10.73804 28.97902
[66,] 6797.902 10.73804 28.97902
[67,] 6797.902 10.73804 28.97902
[68,] 6797.902 10.73804 28.97902
[69,] 6797.902 10.73804 28.97902
[70,] 6797.902 10.73804 28.97902
[71,] 6797.902 10.73804 28.97902
[72,] 6797.902 10.73804 28.97902
[73,] 6797.902 10.73804 28.97902
[74,] 6797.902 10.73804 28.97902
[75,] 6797.902 10.73804 28.97902
[76,] 6797.902 10.73804 28.97902
[77,] 6797.902 10.73804 28.97902
[78,] 6797.902 10.73804 28.97902
[79,] 6797.902 10.73804 28.97902
[80,] 6797.902 10.73804 28.97902
[81,] 6797.902 10.73804 28.97902
[82,] 6797.902 10.73804 28.97902
[83,] 6797.902 10.73804 28.97902
[84,] 6797.902 10.73804 28.97902
[85,] 6797.902 10.73804 28.97902
[86,] 6797.902 10.73804 28.97902
[87,] 6797.902 10.73804 28.97902
[88,] 6797.902 10.73804 28.97902
[89,] 6797.902 10.73804 28.97902
[90,] 6797.902 10.73804 28.97902
[91,] 6797.902 10.73804 28.97902
[92,] 6797.902 10.73804 28.97902
[93,] 6797.902 10.73804 28.97902
[94,] 6797.902 10.73804 28.97902
[95,] 6797.902 10.73804 28.97902
[96,] 6797.902 10.73804 28.97902
[97,] 6797.902 10.73804 28.97902
[98,] 6797.902 10.73804 28.97902
[99,] 6797.902 10.73804 28.97902
[100,] 6797.902 10.73804 28.97902
[101,] 6797.902 10.73804 28.97902
[102,] 6797.902 10.73804 28.97902
```

Subtracting the X matrix from the matrix of the X means gives the matrix below (named Xstar):

> Xstar<-X-Xmeanmatrix

``` > Xstar
income   education      women
[1,]  5553.09804  2.37196078 -17.819020
[2,] 19081.09804  1.52196078 -24.959020
[3,]  2473.09804  2.03196078 -13.279020
[4,]  2067.09804  0.68196078 -19.869020
[5,]  1605.09804  3.88196078 -17.299020
[6,]  4232.09804  4.90196078 -23.849020
[7,]  1460.09804  4.35196078  -3.329020
[8,]  7365.09804  4.70196078 -26.289020
[9,]  4579.09804  3.78196078 -27.949020
[10,]  4225.09804  3.90196078 -28.039020
[11,]  -895.90196  1.65196078 -27.069020
[12,]   261.09804  1.56196078 -21.149020
[13,]  1627.09804  3.09196078 -13.649020
[14,]  1251.09804  3.70196078  28.330980
[15,]   607.09804  3.62196078  19.300980
[16,]  -461.90196  3.47196078  25.790980
[17,] 12465.09804  5.03196078 -23.849020
[18,]  -685.90196  3.41196078  48.120980
[19,]  2795.09804  4.48196078   5.910980
[20,] -2111.90196  3.76196078 -24.839020
[21,]  5682.09804  5.23196078  -9.389020
[22,] -1149.90196  2.88196078  54.800980
[23,]  1236.09804  4.34196078  17.820980
[24,] 18510.09804  5.22196078 -18.419020
[25,]  7760.09804  5.20196078 -24.659020
[26,] 10700.09804  3.97196078 -22.069020
[27,] -2183.90196  1.72196078  67.140980
[28,] -3312.90196 -1.28803922  47.160980
[29,] -1705.90196  2.88196078  53.680980
[30,]  3634.09804  4.47196078  -4.269020
[31,] -1617.90196  2.05196078  47.060980
[32,]  -600.90196  0.35196078  -7.949020
[33,]   764.09804  1.97196078 -17.829020
[34,]  1408.09804  0.70196078 -20.849020
[35,] -2761.90196  0.85196078  68.530980
[36,] -3649.90196  0.75196078  66.990980
[37,] -2449.90196  0.58196078  39.260980
[38,] -4349.90196 -0.09803922  62.780980
[39,] -2467.90196  0.62196078  46.940980
[40,] -2036.90196 -1.56803922 -17.609020
[41,] -3781.90196  1.35196078  54.210980
[42,] -3896.90196  0.30196078  63.880980
[43,] -1286.90196 -1.51803922 -21.359020
[44,] -3058.90196 -0.66803922  23.290980
[45,] -3636.90196 -0.22803922  67.160980
[46,] -2056.90196  0.46196078  18.080980
[47,] -1745.90196  0.39196078  27.120980
[48,]  -538.90196  0.69196078  10.190980
[49,] -2722.90196  0.26196078  34.250980
[50,]   684.09804 -0.89803922 -11.939020
[51,]  1982.09804  0.39196078 -25.819020
[52,] -4203.90196 -0.68803922  38.840980
[53,] -5879.90196 -1.11803922 -21.979020
[54,] -4427.90196 -0.80803922 -25.289020
[55,]  1333.09804  0.86196078 -15.889020
[56,]   194.09804  0.35196078  -4.539020
[57,]  1158.09804  0.29196078  -5.099020
[58,]  2097.09804 -1.26803922 -28.979020
[59,]  2093.09804  0.19196078 -27.329020
[60,] -3681.90196 -2.99803922  23.020980
[61,] -2867.90196 -2.23803922 -13.469020
[62,]  1071.09804 -0.16803922 -22.969020
[63,] -6186.90196 -1.27803922  67.550980
[64,] -3797.90196 -3.40803922  40.330980
[65,] -3325.90196 -3.62803922   4.590980
[66,] -3215.90196 -3.15803922   1.100980
[67,] -3154.90196 -3.89803922 -25.379020
[68,] -5141.90196 -2.13803922  -1.229020
[69,]    62.09804 -1.85803922 -28.979020
[70,] -2598.90196 -3.19803922   4.320980
[71,] -1663.90196 -3.09803922 -11.719020
[72,] -1663.90196 -3.09803922 -11.719020
[73,] -4907.90196 -3.31803922  43.260980
[74,] -2354.90196 -4.04803922   2.380980
[75,] -3312.90196 -3.99803922  10.500980
[76,]  1245.09804 -0.64803922 -27.479020
[77,]  -111.90196 -1.92803922 -24.699020
[78,]  -232.90196 -2.33803922 -26.679020
[79,]  -320.90196 -2.81803922 -23.809020
[80,]  -986.90196 -2.30803922 -15.359020
[81,]  -224.90196 -1.95803922 -23.199020
[82,] -2855.90196 -1.97803922  45.560980
[83,] -1348.90196 -0.44803922 -26.059020
[84,] -3950.90196 -4.35803922  61.690980
[85,] -1002.90196 -2.63803922 -28.169020
[86,]   918.09804 -0.63803922 -28.199020
[87,] -2101.90196 -4.06803922 -28.979020
[88,]  1518.09804 -1.68803922 -27.639020
[89,]   349.09804 -0.80803922 -27.989020
[90,]  2082.09804 -2.49803922 -28.329020
[91,] -1498.90196 -3.81803922 -28.419020
[92,]  -838.90196 -4.13803922 -28.459020
[93,] -2248.90196 -2.92803922 -26.519020
[94,]   130.09804 -2.40803922 -28.369020
[95,] -2887.90196 -3.21803922 -27.889020
[96,]  7234.09804  1.53196078 -28.399020
[97,]  2047.09804 -2.24803922 -28.979020
[98,] -1235.90196 -3.15803922 -19.509020
[99,] -2573.90196 -2.80803922 -25.389020
[100,] -2044.90196 -2.36803922 -28.979020
[101,]  -335.90196 -0.73803922 -15.399020
[102,] -3180.90196 -2.18803922  41.890980
```

> xpxstar<-t(Xstar)%*%Xstar

> xpystar<-t(Xstar)%*%ystar

``` > xpxstar
income   education         women
income    1820813411.0 675804.0804 -6000549.7498
education     675804.1    751.8852      540.7505
women       -6000549.7    540.7505   101653.5935
```
``` > xpystar
[,1]
income    5274530.833
education    4030.765
women       -6523.400
```

Solving for b1:

> b1<-solve(xpxstar)%*%(xpystar)

> b1

```                  [,1]
income     0.001313560
education  4.186637275
women     -0.008905157
```