a2_09soln

a2_09soln - iii“,éfl 2g.155144;iii—Egjij‘ifii...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

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

View Full Document Right Arrow Icon
Background image of page 2
Background image of page 3

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

View Full Document Right Arrow Icon
Background image of page 4
Background image of page 5

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

View Full Document Right Arrow Icon
Background image of page 6
Background image of page 7

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

View Full Document Right Arrow Icon
Background image of page 8
Background image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: iii“: ,éfl 2g)-..155144;;iii—Egjij‘ifii: imm;:;5[é;ff I “fig? ITCETELZDI; ' _ :flf; _, 6333321211: W 7 if j;Q;1,va,mé?T‘-fl W I {MW . P .__.__._.‘_.‘fi ‘.,____-_ .7 ._.... ——-—-—‘r ~.___._.— ——__.¥fi_____,.vk__..—.fi.~___\_n.__m..~_mk ,m_____ ___..__._. 7+ __ _____ .‘égégggjjjwaé;g&m;(fl_z—_——yzt v—vmfln—----———u——-u wi—n—n—w—‘Hf—mum—pfl :_Z_7.¢.;:%>g_a_;[email protected]:325:;mifliQQZL .442. > A <- 1/(1:25) > A <— matrix(A, nrow=5) > > #3(a) > > t(A) [,1] [,2] [,3] [,4] [,5] [1,] 1.00000000 0.50000000 0.33333333 0.25000000 0.20000000 [2,] 0.16666667 0.14285714 0.12500000 0.11111111 0.10000000 [3,] 0.09090909 0.08333333 0.07692308 0.07142857 0.06666667 [4,] 0.06250000 0.05882353 0.05555556 0.05263158 0.05000000 [5,] 0.04761905 0.04545455 0.04347826 0.04166667 0.04000000 > t(A)%*%A [,1] [,2] [,3] [,4] [,5] 1 ] 1.4636111 0.32753968 0.18940726 0.13358818 0.10325574 [2 ] 0.3275397 0.08615662 0.05127484 0.03661243 0.02849443 [3,] 0.1894073 0.05127484 0.03067255 0.02195002 0.01710422 [4 ] 0.1335882 0.03661243 0.02195002 0.01572296 0.01225843 [ ] 0.1032557 0.02849443 0.01710422 0.01225843 0.00956016 #3(b) > det(A) [1] 5.222033—14 #3Cc) > diag(A) [1] 1.00000000 0.14285714 0.07692308 0.05263158 0.04000000 #3(d) > trace <— functionCA) sum(diag(A)) > trace(A) [1] 1.312412 #SCe) > solve(A) [,1] [,2] [,3] [,4] [,5] [1,] 7.392 -41.888 86.112 -76.608 25 [2, -1241.856 12063.744 ~32550.336 34320.384 -12600 [3,] 12108.096 -125789.664 358053.696 -394377.984 150150 [4,] -28651.392 305614.848 —890053.632 1000194.048 -387600 [5,] 18701.760 -202319.040 596756.160 -678363.840 265650 #3(f) > solveCA, c(1,0,2,0,1)) [1] 204.616 -78942.528 878365.488 -2196358.656 1477864.080 #3(g) > A%*%c(1:5) [,1] [1,] 2.094156 [2,] 1.493231 [3,] 1.253716 [4,] 1.105363 [5,] 1.000000 #3(h) > eigenA <- eigen(A) > lambda.min <— min(eigenA$va1ues) > lambda.min [1] 6.153909e-07 eigenA$vectors[,5] [1] 0.0000624466 -0.0271705528 0.3107065401 -0.7865534257 0.5329698974 > y <— eigenA$vectors[,5] > 1ambda.min*y [1] 3.8429076-11 -1.672051e*08 1.9120606-07 -4.8403799-07 3.2798489-07 > A%*%y [,1] [1,] 3.8429069-11 [2,] —1.672051e-08 [3,] 1.912060e—07 [4,] -4.840379e—OT [5,] 3.279848e—07 > sum(eigenA$va1ues) [1] 1.312412 #matches trace > prod(eigenA$va1ues) [1] 5.222039—14 #matches determinant 4. (a) To fit the required model, use > y.67 <- 1m(y ’” x6 + x7, data=table.b5) > coef(y.67) (Intercept) x6 x7 2.526460 0.018522 2.185753 The fitted model is i]: 2.53 + .01836 + 2.186927 (b) > summary(y . 67) Coefficients: Estimate Std. Error t value Pr(>ltl) (Intercept) 2.526460 3.610055 0.700 0.4908 x6 0.018522 0.002747 6.742 5.66e-07 *** x7 2.185753 0.972696 2.247 0.0341 * 95% confidence intervals for the coefficients can be computed from > 2.53 + qt(c(.025, .975), 24)*3.61 [1] —4.920674 9.980674 > .0185 + qt(c(.025, .975), 24)*.oo275 £1] 0.01282428 0 02417572 > 2.186 + qt(c(.025, .975), 24)*.9727 [1] 0.1784459 4.1935541 The 95% interval for the intercept is (—4.92, 9.98), the interval for the coefficient of :96 is ( .0128, .0242), and the interval for the coefficient of :97 is (178,419). (c) The partial F—test for the remaining 5 coeflicients of the full model can be conducted with: > y.:Eull <- 1m(y '“ ., data=table.b5) > y.red <— 37.67 > anovaCy.red, y.full) Analysis of Variance Table Model 1: y"x6+x7 Model2:y'x1+x2+x3+x4+x5+x6+x7 Res.Df RSS Df Sum of Sq F Pr(>F) 1 24 2363.8 2 19 2140.8 5 223.00 0.3958 0.8456 The null hypothesis is that the 5 coefiicients are 0. Since the p-value is very large, we have no evidence to suggest otherwise. The reduced model is preferred over the full model. (d) Re—computing the sums of squares needed for the ANOVA table given above goes as follows: > x.full <- model.matrix(y.full) > X.red <— model.matrix(y.red) > beta.red <- coef(y.red) > beta.fu11 <— coef(y.full) > y <— table.b5$y > SSR <- beta.full‘7.*%t (X.full)°/.*%y — beta.red°/.*Zt(x.red)%*%y > SSR [,1] [1,] 223.0027 > SSE <— y°/.*°Ay — beta.fu11%*%t(x.full)%*%y > SSE [,1] [1,] 2140.832 (e) The sequential F—test for the coefficient of 9:7, given that .126 is already in the model goes as follows: > y.6 <- lm(y " x6, data=table.b5) > anova(y.6, y.red) Analysis of Variance Table Model 1: y ” x6 Model 2: y ' x6 + x7 Res.Df RSS Df Sum of Sq F Pr(>F) 1 25 2861.2 2 24 2363.8 1 497.34 5.0495 0.0341 * Since the p—value is less than .05, we conclude that the coefficient of 2:7 diflFers from 0. (f) The pairs plot of all data is on the next page. The plot of x6 against x5 reveals a single outlying observation which is preventing these variables from being highly linearly dependent. When this observation is in the data set, the resulting standard errors for the coeflicients of $5 and 3:6 are small. When this observation is deleted, the multicoilinearity induced by the linear dependence makes the standard errors become very large. The Cook’s distance plot reveals that the observation is highly influential. (g) The required prediction interval can be calculated from > predict(y.red, newdata=data.frame(x6=2050, x7=1.2), interval="prediction”) fit lwr upr 1 43.11946 21.22939 65.00954 The amount produced is predicted to be in the interval (212,650) with 95% probability. To see if we are extrapolating, compare $31(XTX)_11:0 with the maximum hat diagonal entry: 10 30 50 50 70 90 1000 200 200 400 440 Figure 1: Pairs plot for table.b5 data. 1000 10 40 70 10 40 70 400 440 2000 500 > K <— mode1.matrix(y.red) > c(1, 2050, 1.2)Z*%solve(t(X)%*%X)%*%C(1, 2050, 1.2) [,1] [1,] 0.1421200 > max (1m . influence (y . red) $hat) [1] 0.4986029 Since the maximum hat diagonal value is much larger than our test value, we conclude that we are not extrapolating. flux X' CWJQ KL mg Vorflodkd ,_ ‘jllxim ,, b), _.____._.__:U4J:‘:S_.|L_“(gbxoéacn iLL. ...
View Full Document

{[ snackBarMessage ]}

Page1 / 9

a2_09soln - iii“,éfl 2g.155144;iii—Egjij‘ifii...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online