hw2_5 thru 8 answers.txt - 6(a...

• Homework Help
• 4

This preview shows page 1 - 3 out of 4 pages.

6: (a): x<-c(2.4,1.6,2.0,2.6,1.4,1.6,2.0,2.2) y<-c(225,184,220,240,180,184,186,215) cor(x,y) [1] 0.9129053 //sqrt root of R^2 (b): summary(lm(y~x)) Call: lm(formula = y ~ x) Residuals: Min 1Q Median 3Q Max -19.5182 -1.2267 -0.7368 4.2632 14.4818 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 104.06 18.65 5.581 0.00141 ** x 50.73 9.26 5.478 0.00155 ** --- Signif. codes: 0 ¡®***¡¯ 0.001 ¡®**¡¯ 0.01 ¡®*¡¯ 0.05 ¡®.¡¯ 0.1 ¡® ¡¯ 1 Residual standard error: 10.29 on 6 degrees of freedom Multiple R-squared: 0.8334, Adjusted R-squared: 0.8056 F-statistic: 30.01 on 1 and 6 DF, p-value: 0.001546 LS regression equation:104.06+ 50.73 x cat("the ls regression equation is y=",lm(y~x)\$coefficients[1],"+x*",lm(y~x) \$coefficients[2]) (c): According to (b): Multiple R-squared: 0.8334 summary(lm(y~x))\$r.squared [1] 0.8333961 (d): > anova(lm(y~x)) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(>F) x 1 3178.2 3178.2 30.014 0.001546 ** Residuals 6 635.3 105.9 --- Signif. codes: 0 ¡®***¡¯ 0.001 ¡®**¡¯ 0.01 ¡®*¡¯ 0.05 ¡®.¡¯ 0.1 ¡® ¡¯ 1 p-value = 0.001546, so there is significant linear relationship. anova(lm(y~x))\$Pr[1] Another way: p-value of slope is the same as p-value in anova summary(lm(y~x))\$coeff[2,4] (e):

Subscribe to view the full document.

predict(lm(y~x),data.frame(x=1.8)) 1 195.3725 lm(y~x)\$coefficients[1]+lm(y~x)\$coefficients[2]*1.8
You've reached the end of this preview.

{[ 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