# 420Hw08ans - STAT 420(due Friday October 24 by 3:00 p.m...

This preview shows pages 1–6. Sign up to view the full content.

STAT 420 Fall 2008 Homework #8 (due Friday, October 24, by 3:00 p.m.) From the textbook: 6.7 (a), (b) Year Y X1 X2 X1 X1 X1 X2 X2 X2 1930 2.31 120 52 14400 6240 2704 1931 2.61 84 23 7056 1932 529 1932 1.94 66 20 4356 1320 400 1933 2.30 52 25 2704 1300 625 1934 2.53 72 17 5184 1224 289 1935 2.35 53 33 2809 1749 1089 1936 2.33 68 40 4624 2720 1600 1937 2.45 80 36 6400 2880 1296 1938 1.93 89 40 7921 3560 1600 1939 2.53 67 36 4489 2412 1296 1940 2.33 68 44 4624 2992 1936 25.61 819 366 64567 28329 13364 Year Y X1 X2 X1 Y X2 Y Y Y 1930 2.31 120 52 277.2 120.12 5.3361 1931 2.61 84 23 219.24 60.03 6.8121 1932 1.94 66 20 128.04 38.8 3.7636 1933 2.30 52 25 119.6 57.5 5.29 1934 2.53 72 17 182.16 43.01 6.4009 1935 2.35 53 33 124.55 77.55 5.5225 1936 2.33 68 40 158.44 93.2 5.4289 1937 2.45 80 36 196 88.2 6.0025 1938 1.93 89 40 171.77 77.2 3.7249 1939 2.53 67 36 169.51 91.08 6.4009 1940 2.33 68 44 158.44 102.52 5.4289 25.61 819 366 1904.95 849.21 60.1113 a) X T X = ° ° ° ± ² ³ ³ ³ ´ µ = ° ° ° ± ² ³ ³ ³ ´ µ 13364 28329 366 28329 64567 819 366 819 11 X X X X X X X X X X 2 2 2 1 2 2 1 2 1 1 2 1 i i i i i i i i i i n .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
det ( X T X ) = 34027693. ( X T X ) 1 = ° ° ° ± ² ³ ³ ³ ´ µ - - - - - - × 39476 11865 430071 11865 13048 576702 430071 576702 60341147 34027693 1 = ° ° ° ± ² ³ ³ ³ ´ µ - - - - - - 00116 . 0 00035 . 0 01264 . 0 00035 . 0 000383 . 0 01695 . 0 01264 . 0 01695 . 0 773295 . 1 . X T Y = ° ° ° ± ² ³ ³ ³ ´ µ = ° ° ° ± ² ³ ³ ³ ´ µ 849.21 1904.95 25.61 Y X Y X Y 2 1 i i i i i . ° ˆ = ( X T X ) 1 X T Y = ° ° ° ± ² ³ ³ ³ ´ µ - 00273 . 0 0.000311 2.395922 . Y ˆ = 2.395922 + 0.000311 X 1 – 0.00273 X 2 . b) Year Y X1 X2 Y ˆ e 1930 2.31 120 52 2.29118548 0.01881452 1931 2.61 84 23 2.35920445 0.25079555 1932 1.94 66 20 2.36180525 -0.42180525 1933 2.30 52 25 2.34379937 -0.04379937 1934 2.53 72 17 2.37186308 0.15813692 1935 2.35 53 33 2.32226056 0.02773944 1936 2.33 68 40 2.30780287 0.02219713 1937 2.45 80 36 2.32245614 0.12754386 1938 1.93 89 40 2.31432777 -0.38432777 1939 2.53 67 36 2.31841692 0.21158308 1940 2.33 68 44 2.29687811 0.03312189 25.61 819 366 25.61 0
> Pr67.dat <- read.table("http://www.stat.uiuc.edu/~stepanov/Pr67.csv", header=T, sep=",") > Pr67.dat Year Y X1 X2 1 1930 2.31 120 52 2 1931 2.61 84 23 3 1932 1.94 66 20 4 1933 2.30 52 25 5 1934 2.53 72 17 6 1935 2.35 53 33 7 1936 2.33 68 40 8 1937 2.45 80 36 9 1938 1.93 89 40 10 1939 2.53 67 36 11 1940 2.33 68 44 > > Pr67.fit <- lm(Y ~ X1 + X2, data=Pr67.dat) > summary(Pr67.fit) Call: lm(formula = Y ~ X1 + X2, data = Pr67.dat) Residuals: Min 1Q Median 3Q Max -0.42181 -0.01249 0.02774 0.14284 0.25080 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.3959222 0.3259146 7.351 7.98e-05 *** X1 0.0003107 0.0047926 0.065 0.950 X2 -0.0027312 0.0083361 -0.328 0.752 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 0.2447 on 8 degrees of freedom Multiple R-squared: 0.01513, Adjusted R-squared: -0.2311 F-statistic: 0.06147 on 2 and 8 DF, p-value: 0.9408 > Pr67.fit\$coefficients (Intercept) X1 X2 2.3959222231 0.0003107096 -0.0027311902 > > Pr67.fit\$fitted.values 1 2 3 4 5 6 7 8 2.291185 2.359204 2.361805 2.343799 2.371863 2.322261 2.307803 2.322456 9 10 11 2.314328 2.318417 2.296878 > Pr67.fit\$residuals 1 2 3 4 5 6 0.01881452 0.25079555 -0.42180525 -0.04379937 0.15813692 0.02773944 7 8 9 10 11 0.02219713 0.12754386 -0.38432777 0.21158308 0.03312189

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
OR > X <- cbind(c(rep(1,11)),Pr67.dat\$X1,Pr67.dat\$X2) > t(X) %*% X [,1] [,2] [,3] [1,] 11 819 366 [2,] 819 64567 28329 [3,] 366 28329 13364 > C <- solve(t(X) %*% X); C [,1] [,2] [,3] [1,] 1.77329527 -0.0169480194 -0.0126388527 [2,] -0.01694802 0.0003834524 -0.0003486866 [3,] -0.01263885 -0.0003486866 0.0011601139 > t(X) %*% Pr67.dat\$Y [,1] [1,] 25.61 [2,] 1904.95 [3,] 849.21 > > C %*% t(X) %*% Pr67.dat\$Y [,1] [1,] 2.3959222231 [2,] 0.0003107096 [3,] -0.0027311902 > > Yhat <- X %*% C %*% t(X) %*% Pr67.dat\$Y; Yhat [,1] [1,] 2.291185 [2,] 2.359204 [3,] 2.361805 [4,] 2.343799 [5,] 2.371863 [6,] 2.322261 [7,] 2.307803 [8,] 2.322456 [9,] 2.314328 [10,] 2.318417 [11,] 2.296878 > > e <- Pr67.dat\$Y – Yhat; e [,1] [1,] 0.01881452 [2,] 0.25079555 [3,] -0.42180525 [4,] -0.04379937 [5,] 0.15813692 [6,] 0.02773944 [7,] 0.02219713 [8,] 0.12754386 [9,] -0.38432777 [10,] 0.21158308 [11,] 0.03312189
2.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern