ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:79.88KB ,
资源ID:5969323      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5969323.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(统计建模与R软件第六章课后习题答案.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

统计建模与R软件第六章课后习题答案.docx

1、统计建模与R软件第六章课后习题答案统计建模与R软件第六章习题答案(回归分析)Ex6.1(1) x y plot(x,y)由此判断,Y和X有线性关系。(2) lm.sol summary(lm.sol)Call:lm(formula = y 1 + x)Residuals: Min 1Q Median 3Q Max-128.591 -70.978 -3.727 49.263 167.228Coefficients: Estimate Std. Error t value Pr(|t|)(Intercept) 140.95 125.11 1.127 0.293x 364.18 19.26 18.9

2、08 6.33e-08 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 96.42 on 8 degrees of freedomMultiple R-squared: 0.9781, Adjusted R-squared: 0.9754F-statistic: 357.5 on 1 and 8 DF, p-value: 6.33e-08回归方程为 Y=140.95+364.18X(3)1项很显著,但常数项0不显著。回归方程很显著。(4) new lm.pred lm.pred fit lwr u

3、pr1 2690.227 2454.971 2925.484故Y(7)= 2690.227, 2454.971,2925.484Ex6.2(1)pho-data.frame(x1 - c(0.4,0.4,3.1,0.6,4.7,1.7,9.4,10.1,11.6,12.6,10.9,23.1,23.1,21.6,23.1,1.9,26.8,29.9), x2 - c(52,34,19,34,24,65,44,31,29,58,37,46,50,44,56,36,58,51), x3 - c(158,163,37,157,59,123,46,117,173,112,111,114,134,73,

4、168,143,202,124), y lm.sol summary(lm.sol)Call:lm(formula = y x1 + x2 + x3, data = pho)Residuals: Min 1Q Median 3Q Max-27.575 -11.160 -2.799 11.574 48.808Coefficients: Estimate Std. Error t value Pr(|t|)(Intercept) 44.9290 18.3408 2.450 0.02806 *x1 1.8033 0.5290 3.409 0.00424 *x2 -0.1337 0.4440 -0.3

5、01 0.76771x3 0.1668 0.1141 1.462 0.16573-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 19.93 on 14 degrees of freedomMultiple R-squared: 0.551, Adjusted R-squared: 0.4547F-statistic: 5.726 on 3 and 14 DF, p-value: 0.009004回归方程为 y=44.9290+1.8033x1-0.1337x2+0.1668x3(2)回归方程显著,但

6、有些回归系数不显著。(3) lm.step-step(lm.sol)Start: AIC=111.2y x1 + x2 + x3 Df Sum of Sq RSS AIC- x2 1 36.0 5599.4 109.3 5563.4 111.2- x3 1 849.8 6413.1 111.8- x1 1 4617.8 10181.2 120.1Step: AIC=109.32y x1 + x3 Df Sum of Sq RSS AIC 5599.4 109.3- x3 1 833.2 6432.6 109.8- x1 1 5169.5 10768.9 119.1 summary(lm.ste

7、p)Call:lm(formula = y x1 + x3, data = pho)Residuals: Min 1Q Median 3Q Max-29.713 -11.324 -2.953 11.286 48.679Coefficients: Estimate Std. Error t value Pr(|t|)(Intercept) 41.4794 13.8834 2.988 0.00920 *x1 1.7374 0.4669 3.721 0.00205 *x3 0.1548 0.1036 1.494 0.15592-Signif. codes: 0 * 0.001 * 0.01 * 0.

8、05 . 0.1 1Residual standard error: 19.32 on 15 degrees of freedomMultiple R-squared: 0.5481, Adjusted R-squared: 0.4878F-statistic: 9.095 on 2 and 15 DF, p-value: 0.002589x3仍不够显著。再用drop1函数做逐步回归。 drop1(lm.step)Single term deletionsModel:y x1 + x3 Df Sum of Sq RSS AIC 5599.4 109.3x1 1 5169.5 10768.9 1

9、19.1x3 1 833.2 6432.6 109.8可以考虑再去掉x3. lm.opt|t|)(Intercept) 59.2590 7.4200 7.986 5.67e-07 *x1 1.8434 0.4789 3.849 0.00142 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 20.05 on 16 degrees of freedomMultiple R-squared: 0.4808, Adjusted R-squared: 0.4484F-statistic: 14.82 on

10、 1 and 16 DF, p-value: 0.001417皆显著。Ex6.3 x y plot(x,y) lm.sol summary(lm.sol)Call:lm(formula = y 1 + x)Residuals: Min 1Q Median 3Q Max-9.8413 -2.3369 -0.0214 1.0592 17.8320Coefficients: Estimate Std. Error t value Pr(|t|)(Intercept) -1.4519 1.8353 -0.791 0.436x 1.5578 0.2807 5.549 7.93e-06 *-Signif.

11、 codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 5.168 on 26 degrees of freedomMultiple R-squared: 0.5422, Adjusted R-squared: 0.5246F-statistic: 30.8 on 1 and 26 DF, p-value: 7.931e-06线性回归方程为 y=-1.4519+1.5578x,通过F 检验。 常数项参数未通过t 检验。 abline(lm.sol) y.yes y.fit y.rst plot(y.yesy.fit) pl

12、ot(y.rsty.fit)残差并非是等方差的。修正模型,对相应变量Y做开方。 lm.new summary(lm.new)Call:lm(formula = sqrt(y) x)Residuals: Min 1Q Median 3Q Max-1.54255 -0.45280 -0.01177 0.34925 2.12486Coefficients: Estimate Std. Error t value Pr(|t|)(Intercept) 0.76650 0.25592 2.995 0.00596 *x 0.29136 0.03914 7.444 6.64e-08 *-Signif. co

13、des: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 0.7206 on 26 degrees of freedomMultiple R-squared: 0.6806, Adjusted R-squared: 0.6684F-statistic: 55.41 on 1 and 26 DF, p-value: 6.645e-08此时所有参数和方程均通过检验。对新模型做标准化残差图,情况有所改善,不过还是存在一个离群值。第24和第28个值存在问题。Ex6.4 toothpaste lm.sol|t|)(Intercept) 4.

14、0759 0.6267 6.504 1.00e-06 *X1 1.5276 0.2354 6.489 1.04e-06 *X2 0.6138 0.1027 5.974 3.63e-06 *-Signif. codes: 0 * 0.001 * 0.01 * 0.05 . 0.1 1Residual standard error: 0.1767 on 24 degrees of freedomMultiple R-squared: 0.9378, Adjusted R-squared: 0.9327F-statistic: 181 on 2 and 24 DF, p-value: 3.33e-1

15、5回归诊断: influence.measures(lm.sol)Influence measures of lm(formula = Y X1 + X2, data = toothpaste) : dfb.1_ dfb.X1 dfb.X2 dffit cov.r cook.d hat inf1 0.00908 0.00260 -0.00847 0.0121 1.366 5.11e-05 0.16812 0.06277 0.04467 -0.06785 -0.1244 1.159 5.32e-03 0.05373 -0.02809 0.07724 0.02540 0.1858 1.283 1.

16、19e-02 0.13864 0.11688 0.05055 -0.11078 0.1404 1.377 6.83e-03 0.1843 *5 0.01167 0.01887 -0.01766 -0.1037 1.141 3.69e-03 0.03846 -0.43010 -0.42881 0.45774 0.6061 0.814 1.11e-01 0.09367 0.07840 0.01534 -0.07284 0.1082 1.481 4.07e-03 0.2364 *8 0.01577 0.00913 -0.01485 0.0208 1.237 1.50e-04 0.08239 0.01

17、127 -0.02714 -0.00364 0.1071 1.156 3.95e-03 0.046610 -0.07830 0.00171 0.08052 0.1890 1.155 1.22e-02 0.072611 0.00301 -0.09652 -0.00365 -0.2281 1.127 1.76e-02 0.073512 -0.03114 0.01848 0.03459 0.1542 1.132 8.12e-03 0.051413 -0.09236 -0.03801 0.09940 0.2201 1.071 1.62e-02 0.052214 -0.02650 0.03434 0.0

18、2606 0.1179 1.235 4.81e-03 0.095615 0.00968 -0.11445 -0.00857 -0.2545 1.150 2.19e-02 0.091016 -0.00285 -0.06185 0.00098 -0.1608 1.146 8.83e-03 0.059417 0.07201 0.09744 -0.07796 -0.1099 1.364 4.19e-03 0.173118 0.15132 0.30204 -0.17755 -0.3907 1.087 5.04e-02 0.108519 0.07489 0.47472 -0.12980 -0.7579 0

19、.731 1.66e-01 0.109220 0.05249 0.08484 -0.07940 -0.4660 0.625 6.11e-02 0.0384 *21 0.07557 0.07284 -0.07861 -0.0880 1.471 2.69e-03 0.2304 *22 -0.17959 -0.39016 0.18241 -0.5494 0.912 9.41e-02 0.102223 0.06026 0.10607 -0.06207 0.1251 1.374 5.42e-03 0.180424 -0.54830 -0.74197 0.59358 0.8371 0.914 2.13e-

20、01 0.173125 0.08541 0.01624 -0.07775 0.1314 1.249 5.97e-03 0.106926 0.32556 0.11734 -0.30200 0.4480 1.018 6.49e-02 0.103327 0.17243 0.32754 -0.17676 0.4127 1.148 5.66e-02 0.1369 source(Reg_Diag.R);Reg_Diag(lm.sol) #薛毅老师自己写的程序 residual s1 standard s2 student s3 hat_matrix s4 DFFITS s51 0.00443843 0.0

21、2753865 0.02695925 0.16811819 0.012119492 -0.09114255 -0.53021138 -0.52211469 0.05369239 -0.124367273 0.07726887 0.47112863 0.46335666 0.13857353 0.185843104 0.04805665 0.30111062 0.29532912 0.18427663 0.140368605 -0.09130271 -0.52689847 -0.51881406 0.03838430 -0.103654426 0.30162101 1.79287913 1.88

22、596579 0.09362223 0.606134067 0.03066005 0.19855842 0.19453763 0.23641540 * 0.108246268 0.01199519 0.07085860 0.06937393 0.08226537 0.020770479 0.08491891 0.49217591 0.48426323 0.04664158 0.1071124610 0.11625405 0.68315814 0.67537315 0.07261134 0.1889796911 -0.13874451 -0.81570765 -0.80983786 0.07348894 -0.2280782012 0.11540228 0.67051940 0.66263761 0.05137589 0.1542086413 0.16178406

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1